Added print int in the code gen.
This commit is contained in:
parent
88fb529679
commit
c9424c47b9
2 changed files with 2 additions and 0 deletions
|
|
@ -58,6 +58,7 @@ defaultStart =
|
||||||
, UnsafeRaw "@.non_exhaustive_patterns = private unnamed_addr constant [41 x i8] c\"Non-exhaustive patterns in case at %i:%i\n\"\n"
|
, UnsafeRaw "@.non_exhaustive_patterns = private unnamed_addr constant [41 x i8] c\"Non-exhaustive patterns in case at %i:%i\n\"\n"
|
||||||
, UnsafeRaw "@.char_print = private unnamed_addr constant [2 x i8] c\"%c\"\n"
|
, UnsafeRaw "@.char_print = private unnamed_addr constant [2 x i8] c\"%c\"\n"
|
||||||
, UnsafeRaw "@.char_print_no_nl = private unnamed_addr constant [3 x i8] c\"%c\0\"\n"
|
, UnsafeRaw "@.char_print_no_nl = private unnamed_addr constant [3 x i8] c\"%c\0\"\n"
|
||||||
|
, UnsafeRaw "@.int_print_no_nl = private unnamed_addr constant [3 x i8] c\"%i\0\"\n"
|
||||||
, UnsafeRaw "declare i32 @printf(ptr noalias nocapture, ...)\n"
|
, UnsafeRaw "declare i32 @printf(ptr noalias nocapture, ...)\n"
|
||||||
, UnsafeRaw "declare i32 @exit(i32 noundef)\n"
|
, UnsafeRaw "declare i32 @exit(i32 noundef)\n"
|
||||||
, UnsafeRaw "declare ptr @malloc(i32 noundef)\n"
|
, UnsafeRaw "declare ptr @malloc(i32 noundef)\n"
|
||||||
|
|
|
||||||
|
|
@ -381,6 +381,7 @@ preludeFuns def xs arg1 arg2 = case xs of
|
||||||
"$minus$$Int_Int_Int" -> pure $ Sub I64 arg1 arg2
|
"$minus$$Int_Int_Int" -> pure $ Sub I64 arg1 arg2
|
||||||
"$plus$$Int_Int_Int" -> pure $ Add I64 arg1 arg2
|
"$plus$$Int_Int_Int" -> pure $ Add I64 arg1 arg2
|
||||||
"printChar$Char_Unit" -> pure . UnsafeRaw $ "add i16 0,0\n call void (ptr, ...) @printf(ptr noundef @.char_print_no_nl, i8 noundef " <> toIr arg1 <> ")\n"
|
"printChar$Char_Unit" -> pure . UnsafeRaw $ "add i16 0,0\n call void (ptr, ...) @printf(ptr noundef @.char_print_no_nl, i8 noundef " <> toIr arg1 <> ")\n"
|
||||||
|
"printInt$Int_Unit" -> pure . UnsafeRaw $ "add i16 0,0\n call void (ptr, ...) @printf(ptr noundef @.int_print_no_nl, i8 noundef " <> toIr arg1 <> ")\n"
|
||||||
_ -> pure def
|
_ -> pure def
|
||||||
|
|
||||||
-- | Emits a function call.
|
-- | Emits a function call.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue