Permalink
Browse files

%lleq prim.

Using `%llicmp eq` didn't cut it, because eq? is polymorphic.
Define an alias that's typed correctly.
  • Loading branch information...
samrushing committed Mar 10, 2017
1 parent f9a2423 commit 33bebf27f99fb3f8275ec00e04aeca963e4bd7e8
Showing with 3 additions and 1 deletion.
  1. +1 −1 lib/core.scm
  2. +1 −0 self/llvm.scm
  3. +1 −0 self/typing.scm
@@ -210,7 +210,7 @@
(define (eq? a b)
(%backend c (%%cexp ('a 'a -> bool) "%0==%1" a b))
(%backend llvm (%llicmp eq a b))
(%backend llvm (%lleq #f a b))
(%backend bytecode (%%cexp ('a 'a -> bool) "eq" a b))
)
@@ -153,6 +153,7 @@
(match name params args with
'%llarith (sexp:symbol op) (arg0 arg1) -> (emit-arith op arg0 arg1 target)
'%llicmp (sexp:symbol op) (arg0 arg1) -> (emit-icmp op arg0 arg1 target)
'%lleq _ (arg0 arg1) -> (emit-icmp 'eq arg0 arg1 target)
'%dtcon (sexp:cons dtname altname) args -> (emit-dtcon dtname altname args target)
'%nvget (sexp:list (_ (sexp:int index) _)) (reg) -> (emit-nvget target reg index)
'%make-vector _ (vlen vval) -> (emit-make-vector vlen vval target)
@@ -617,6 +617,7 @@
;; llvm prims
'%llarith -> (:scheme '() (arrow int-type (LIST int-type int-type)))
'%llicmp -> (:scheme '() (arrow bool-type (LIST int-type int-type)))
'%lleq -> (:scheme (LIST T0) (arrow bool-type (LIST T0 T0)))
_ -> (error1 "lookup-primapp" name)))
;; each exception is stored in a global table along with a tvar

0 comments on commit 33bebf2

Please sign in to comment.