impc:ir:compiler:bitcast   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/llvmir.xtm

Implementation

(define impc:ir:compiler:bitcast
  (lambda (ast types . hint?)
    ;; (println 'bitcast-hint: hint? ast (cddr ast))
    (if (and (null? (car hint?))
             (null? (cddr ast)))
        (impc:compiler:print-could-not-resolve-type-error ast "try forcing the cast"))
    (let* ((os (make-string 0))
           (a (impc:ir:compiler (cadr ast) types))
           (at (impc:ir:gname))
           (type-str (if (null? (cddr ast))
                         (impc:ir:get-type-str (car hint?))
                         (impc:ir:get-type-str (impc:ir:convert-from-pretty-types (caddr ast))))))
      (emit a os)
      (emit (string-append (impc:ir:gname "val" type-str)
                           " = bitcast " (cadr at) " " (car at) " to " type-str "\n") os)
      (impc:ir:strip-space os))))


Back to Index

Similar Entries

  • impc:ti:bitcast-check    scheme