impc:ir:compiler:bitwise   scheme


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

Implementation

(define impc:ir:compiler:bitwise
  (lambda (v ast types . hint?)
    (let* ((bitops '("and" "or" "xor" "shl" "lshr"))
           (os (make-string 0))
           (a (impc:ir:compiler (cadr ast) types))
           (aval (impc:ir:gname))
           (b (impc:ir:compiler (caddr ast) types))
           (bval (impc:ir:gname))
           (type (cadr aval)))
      (emit a os)
      (emit b os)
      (emit (string-append (impc:ir:gname "val" type)
                           " = " (list-ref bitops v)
                           " " type " " (car aval) ", " (car bval) "\n") os)
      ;;(println 'bitwise 'ast: ast)
      ;;(println 'bitwise 'ir: os)
      (impc:ir:strip-space os))))


Back to Index

Similar Entries