diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-01-26 22:04:38 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-01-26 22:04:38 +0100 |
commit | 22518d52828733a3fc2b0d827b1dbccefef46355 (patch) | |
tree | 93cb566d2126944a173f9ab7fda0463845ce6319 | |
parent | 311a353fea97e74eb049180da51b5395561975cc (diff) |
Actually compile to an object file
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | main.hs | 21 |
2 files changed, 13 insertions, 10 deletions
@@ -5,3 +5,5 @@ main ll/gen ll/test.s ll/test + +output_gen @@ -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 |