impc:ir:compiler:ret   scheme


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

Implementation

;; ret-> (return statement)
(define impc:ir:compiler:ret
  (lambda (ast types . hint?)
    ;; (println 'ast: ast)
    ;; (println 'types: types)
    ;; (println 'hint?: hint?)
    ;; (println 'ping: (assoc-strcmp (caddr ast) types))
    ;; (println 'return-> (cadr (assoc-strcmp (cadr ast) types)))
    (let* ((hinttype? (cadr (cdr (assoc-strcmp (cadr ast) types))))
           (str (impc:ir:compiler (caddr ast) types hinttype?)) ;(if (null? hint?) hinttype? (car hint?))))
           (val (impc:ir:gname))
           (os (make-string 0)))
      (emit str os)
      (if (impc:ir:void? (cadr (impc:ir:gname)))
          (emit "ret void\n" os)
          (let ((type (cadr (cdr (assoc-strcmp (cadr ast) types)))))
                                        ;(println 'type: type)
            (if (and (not (equal? (impc:ir:get-type-from-str (cadr (impc:ir:gname))) type))
                     (not (equal? (cadr ast) (caddr ast)))) ;; this line is a weird catch for outer let??
                (emit (impc:ir:gname "retval" (impc:ir:get-type-str type)) " = bitcast " (cadr val) " " (car val) " to " (impc:ir:get-type-str type) "\n" os))
            (emit "ret " (cadr (impc:ir:gname)) " " (car (impc:ir:gname)) "\n" os)))
      ;;(println 'os2: os)
      (impc:ir:strip-space os))))


Back to Index

Similar Entries

  • aiProcess_PreTransformVertices    scheme
  • define-with-return    macro
  • format_return    xtlang
  • impc:compiler:print-no-retval-error    scheme
  • impc:ir:compiler:ifret    scheme
  • impc:ir:convert-from-pretty-types    scheme
  • impc:ir:get-arity-from-pretty-closure    scheme
  • impc:ir:get-pretty-closure-arg-strings    scheme
  • impc:ir:get-pretty-tuple-arg-strings    scheme
  • impc:ir:get-type-from-pretty-array    scheme
  • impc:ir:get-type-from-pretty-closure    scheme
  • impc:ir:get-type-from-pretty-str    scheme
  • impc:ir:get-type-from-pretty-str-rec    scheme
  • impc:ir:get-type-from-pretty-tuple    scheme
  • impc:ir:get-type-from-pretty-vector    scheme
  • impc:ir:pretty-print-type    scheme
  • impc:pretty-print-vars    macro
  • impc:ti:genericfunc-pretty-print    scheme
  • impc:ti:get-polyfunc-candidate-pretty-types    scheme
  • impc:ti:get-polytype-candidate-pretty-types    scheme
  • impc:ti:get-typealias-ground-type-pretty    scheme
  • impc:ti:get-typealias-type-pretty    scheme
  • impc:ti:mark-returns    scheme
  • impc:ti:nativef-generics-check-return-type    scheme
  • impc:ti:polyfunc-pretty-print    scheme
  • impc:ti:polytype-pretty-print    scheme
  • impc:ti:ret-check    scheme
  • impc:ti:simplify-genericfunc-pretty-type    scheme
  • impc:ti:simplify-generictype-pretty-type    scheme
  • impc:ti:tuple-list-from-pretty-tuple-str    scheme
  • ivl:retrograde    scheme
  • print_return    xtlang
  • return_ptr_gv_first_with_docstring    xtlang
  • return_ptr_gv_second_with_docstring    xtlang
  • toString_return    xtlang