impc:ir:compiler:while-loop   scheme


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

Implementation

(define impc:ir:compiler:while-loop
  (lambda (ast types)
    (let* ((os (make-string 0))
           (loop-num-string (number->string (llvm:count++)))
           (loop (string-append "%loop" loop-num-string))
           (after (string-append "%after" loop-num-string)))
      (emit "; while loop\n" os)
      ;; initial test
      (emit (impc:ir:compiler (car ast) types) os)
      (emit "br i1 " (car (impc:ir:gname))
            ", label " loop
            ", label " after
            "\n" os)


Back to Index