Fixed prelude and codegen
This commit is contained in:
parent
dbc1dc4982
commit
5af9509a5f
2 changed files with 3 additions and 4 deletions
|
|
@ -367,9 +367,8 @@ emitApp rt e1 e2 = do
|
||||||
Global <$ Map.lookup name consts
|
Global <$ Map.lookup name consts
|
||||||
<|> Global <$ Map.lookup (name, t) funcs
|
<|> Global <$ Map.lookup (name, t) funcs
|
||||||
-- this piece of code could probably be improved, i.e remove the double `const Global`
|
-- this piece of code could probably be improved, i.e remove the double `const Global`
|
||||||
|
|
||||||
call <- case name of
|
call <- case name of
|
||||||
Ident ('l' : 't' : '$' : _) ->
|
Ident ('$' : 'l' : 'a' : 'n' : 'g' : 'l' : 'e' : '$' : _) ->
|
||||||
pure $ Icmp LLSlt I64 (snd (head args)) (snd (args !! 1))
|
pure $ Icmp LLSlt I64 (snd (head args)) (snd (args !! 1))
|
||||||
Ident ('$' : 'm' : 'i' : 'n' : 'u' : 's' : '$' : '$' : _) ->
|
Ident ('$' : 'm' : 'i' : 'n' : 'u' : 's' : '$' : '$' : _) ->
|
||||||
pure $ Sub I64 (snd (head args)) (snd (args !! 1))
|
pure $ Sub I64 (snd (head args)) (snd (args !! 1))
|
||||||
|
|
|
||||||
|
|
@ -175,8 +175,8 @@ prelude =
|
||||||
, " False : Bool"
|
, " False : Bool"
|
||||||
, " True : Bool"
|
, " True : Bool"
|
||||||
, -- The function body of lt is replaced during code gen. It exists here for type checking purposes.
|
, -- The function body of lt is replaced during code gen. It exists here for type checking purposes.
|
||||||
"lt : Int -> Int -> Bool"
|
".< : Int -> Int -> Bool"
|
||||||
, "lt x y = case x of"
|
, ".< x y = case x of"
|
||||||
, " _ => True"
|
, " _ => True"
|
||||||
, " _ => False"
|
, " _ => False"
|
||||||
, "\n"
|
, "\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue