The GC argument is now passed to the compiler and codegen.
This commit is contained in:
parent
ddffe7913c
commit
f9d28028b5
3 changed files with 6 additions and 6 deletions
|
|
@ -18,8 +18,8 @@ import TypeChecker.TypeCheckerIr (Ident (..))
|
||||||
An easy way to actually "compile" this output is to
|
An easy way to actually "compile" this output is to
|
||||||
Simply pipe it to LLI
|
Simply pipe it to LLI
|
||||||
-}
|
-}
|
||||||
generateCode :: MIR.Program -> Err String
|
generateCode :: MIR.Program -> Bool -> Err String
|
||||||
generateCode (MIR.Program scs) = do
|
generateCode (MIR.Program scs) addGc = do
|
||||||
let tree = filter (not . detectPrelude) (sortBy lowData scs)
|
let tree = filter (not . detectPrelude) (sortBy lowData scs)
|
||||||
let codegen = initCodeGenerator tree
|
let codegen = initCodeGenerator tree
|
||||||
llvmIrToString . instructions <$> execStateT (compileScs tree) codegen
|
llvmIrToString . instructions <$> execStateT (compileScs tree) codegen
|
||||||
|
|
|
||||||
|
|
@ -29,5 +29,5 @@ compileClang =
|
||||||
, "-"
|
, "-"
|
||||||
]
|
]
|
||||||
|
|
||||||
compile :: String -> IO String
|
compile :: String -> Bool -> IO String
|
||||||
compile s = optimize s >>= compileClang
|
compile s addGc = optimize s >>= compileClang
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ main' opts s =
|
||||||
log monomorphized
|
log monomorphized
|
||||||
|
|
||||||
printToErr "\n -- Compiler --"
|
printToErr "\n -- Compiler --"
|
||||||
generatedCode <- fromErr $ generateCode monomorphized
|
generatedCode <- fromErr $ generateCode monomorphized (gc opts)
|
||||||
|
|
||||||
check <- doesPathExist "output"
|
check <- doesPathExist "output"
|
||||||
when check (removeDirectoryRecursive "output")
|
when check (removeDirectoryRecursive "output")
|
||||||
|
|
@ -146,7 +146,7 @@ main' opts s =
|
||||||
writeFile "output/llvm.ll" generatedCode
|
writeFile "output/llvm.ll" generatedCode
|
||||||
debugDotViz
|
debugDotViz
|
||||||
|
|
||||||
compile generatedCode
|
compile generatedCode (gc opts)
|
||||||
printToErr "Compilation done!"
|
printToErr "Compilation done!"
|
||||||
printToErr "\n-- Program output --"
|
printToErr "\n-- Program output --"
|
||||||
print =<< spawnWait "./output/hello_world"
|
print =<< spawnWait "./output/hello_world"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue