summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--main.hs21
2 files changed, 13 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index aea9637..63bb50a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,5 @@ main
ll/gen
ll/test.s
ll/test
+
+output_gen
diff --git a/main.hs b/main.hs
index 3f3a81b..ad9627b 100644
--- a/main.hs
+++ b/main.hs
@@ -5,9 +5,10 @@ import Control.Monad.Except
import Data.Either
import System.Environment
import System.Exit
+import qualified Data.ByteString as BS
import qualified LLVM.General as General
import qualified LLVM.General.Context as General
--- import qualified LLVM.General.Target as General
+import qualified LLVM.General.Target as General
import Check
import Codegen
@@ -50,8 +51,8 @@ main = do
putStrLn $ pshow checked
llvmMod <- either die return $ codegen checked "Module" fname
- -- putStrLn "Module:"
- -- print llvmMod
+ putStrLn "Module:"
+ print llvmMod
putStrLn "Calling withContext:"
General.withContext $ \context -> do
@@ -61,10 +62,10 @@ main = do
llvmasm <- General.moduleLLVMAssembly genmod
putStr llvmasm
putStrLn ""
- -- assert $ General.withHostTargetMachine $ \machine -> do
- -- General.getTargetMachineTriple machine >>= putStrLn
- -- putStrLn ""
- -- assert (General.moduleTargetAssembly machine genmod)
- -- >>= putStr
- -- bs <- assert $ General.moduleObject machine genmod
- -- BS.writeFile "output_gen.o" bs
+ assert $ General.withHostTargetMachine $ \machine -> do
+ General.getTargetMachineTriple machine >>= putStrLn
+ putStrLn ""
+ assert (General.moduleTargetAssembly machine genmod)
+ >>= putStr
+ bs <- assert $ General.moduleObject machine genmod
+ BS.writeFile "output_gen.o" bs