impc:ir:compiler:pdref   scheme


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

Implementation

;; returns a ptr's value
(define impc:ir:compiler:pdref
  (lambda (ast types)
    (let* ((os (make-string 0))
           (val-str (impc:ir:compiler (cadr ast) types))
           (val (impc:ir:gname))
           (type (- (impc:ir:get-type-from-str (cadr val)) *impc:ir:pointer*)))
      (if (not (impc:ir:pointer? val))
          (impc:compiler:print-bad-type-error-with-ast val "ptrdef must take a pointer argument" ast))
      (emit val-str os)
      (emit (impc:ir:gname "val" (impc:ir:get-type-str type)) " = load " (impc:ir:pointer-- (cadr val)) ", " (cadr val) " " (car val) "\n" os)
      (impc:ir:strip-space os))))


Back to Index

Similar Entries