aboutsummaryrefslogtreecommitdiff
path: root/CodeGen.hs
diff options
context:
space:
mode:
Diffstat (limited to 'CodeGen.hs')
-rw-r--r--CodeGen.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/CodeGen.hs b/CodeGen.hs
index 774696f..764a900 100644
--- a/CodeGen.hs
+++ b/CodeGen.hs
@@ -9,7 +9,6 @@ import Data.List
import Data.Maybe
import Data.Map.Strict ((!))
import qualified Data.Map.Strict as Map
-import Text.Heredoc
import Debug.Trace
import AST
@@ -66,8 +65,10 @@ codegen (IRProgram vars funcs) = do
X64.verify x64
varcg <- liftM unlines $ mapM codegenVar vars
x64opt <- x64Optimise x64
- return $ [there|prologue.asm|] ++ "\n" ++ X64.stringify x64opt ++
- "\nsection .data\n" ++ (if length vars > 0 then varcg else "db 0 ; keep dyld happy\n")
+ return $ "extern putc, putint, getc, _builtin_malloc\n" ++
+ "global main\ndefault rel\nsection .text\n" ++
+ X64.stringify x64opt ++
+ "\nsection .data\n" ++ varcg
codegenVar :: DVar -> Error String