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    /digego/extempore/tree/v0.8.9/libs/external/assimp.xtm
  • define-with-return    macro    /digego/extempore/tree/v0.8.9/runtime/init.xtm
  • format_return    xtlang    /digego/extempore/tree/v0.8.9/libs/base/base.xtm
  • impc:compiler:print-no-retval-error    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ir:compiler:ifret    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • impc:ir:convert-from-pretty-types    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • impc:ir:get-arity-from-pretty-closure    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • impc:ir:get-pretty-closure-arg-strings    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • impc:ir:get-pretty-tuple-arg-strings    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • impc:ir:get-type-from-pretty-array    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • impc:ir:get-type-from-pretty-closure    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • impc:ir:get-type-from-pretty-str    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • impc:ir:get-type-from-pretty-str-rec    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • impc:ir:get-type-from-pretty-tuple    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • impc:ir:get-type-from-pretty-vector    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • impc:ir:pretty-print-type    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmir.xtm
  • impc:pretty-print-vars    macro    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:genericfunc-pretty-print    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:get-polyfunc-candidate-pretty-types    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:get-polytype-candidate-pretty-types    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:get-typealias-ground-type-pretty    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:get-typealias-type-pretty    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:mark-returns    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:nativef-generics-check-return-type    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:polyfunc-pretty-print    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:polytype-pretty-print    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:ret-check    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:simplify-genericfunc-pretty-type    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:simplify-generictype-pretty-type    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • impc:ti:tuple-list-from-pretty-tuple-str    scheme    /digego/extempore/tree/v0.8.9/runtime/llvmti.xtm
  • ivl:retrograde    scheme    /digego/extempore/tree/v0.8.9/libs/core/pc_ivl.xtm
  • print_return    xtlang    /digego/extempore/tree/v0.8.9/libs/base/base.xtm
  • return_ptr_gv_first_with_docstring    xtlang    /digego/extempore/tree/v0.8.9/tests/core/aot-compilation.xtm
  • return_ptr_gv_second_with_docstring    xtlang    /digego/extempore/tree/v0.8.9/tests/core/aot-compilation.xtm
  • toString_return    xtlang    /digego/extempore/tree/v0.8.9/libs/base/base.xtm