impc:ir:compile:eval-gvar   scheme


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

Implementation

(define impc:ir:compile:eval-gvar
  (lambda (var)
    (let* ((os (make-string 0))
           (type (impc:ti:get-globalvar-type (symbol->string var)))
           (type2 (impc:ir:pointer-- type))
           (typestr (impc:ir:get-type-str type2)))
      (if (and (or (impc:ir:array? type2)
                   (impc:ir:vector? type2)
                   (impc:ir:tuple? type2))
               (= (impc:ir:get-ptr-depth type2) 0))
          (emit (impc:ir:gname "val" (impc:ir:get-type-str type))
                " = select i1 true, "
                (impc:ir:get-type-str type) " @" (symbol->string var) ", "
                (impc:ir:get-type-str type) " @" (symbol->string var) "\n" os)
          (emit (string-append (impc:ir:gname "val" typestr)
                               " = load " typestr ", " typestr
                               "* @" (symbol->string var) "\n") os))
      (impc:ir:strip-space os))))


Back to Index