@@ -19,7 +19,7 @@ import LLVM.General.Target ( TargetMachine
19 , initializeAllTargets, lookupTarget
19 , initializeAllTargets, lookupTarget
21import LLVM.General.AST.DataLayout
21import LLVM.General.AST.DataLayout
22−import LLVM.General.PassManager
22+import qualified LLVM.General.PassManager as PM
23import qualified LLVM.General.Module as M
23import qualified LLVM.General.Module as M
24import qualified LLVM.General.AST.IntegerPredicate as IPred
24import qualified LLVM.General.AST.IntegerPredicate as IPred
25import qualified LLVM.General.AST.Linkage as L
25import qualified LLVM.General.AST.Linkage as L
@@ -59,7 +59,7 @@ data Target = Target { triple :: String, dataLayout :: DataLayout }
59codegenLLVM :: [(TT.Name, SDecl)] ->
59codegenLLVM :: [(TT.Name, SDecl)] ->
60 String -> -- target triple
60 String -> -- target triple
61 String -> -- target CPU
61 String -> -- target CPU
62− Int -> -- Optimization degree
62+ Word -> -- Optimization degree
63 FilePath -> -- output file name
63 FilePath -> -- output file name
64 OutputType ->
64 OutputType ->
@@ -71,12 +71,12 @@ codegenLLVM defs triple cpu optimize file outty = withContext $ \context -> do
71 do layout <- getTargetMachineDataLayout tm
71 do layout <- getTargetMachineDataLayout tm
72 let ast = codegen (Target triple layout) (map snd defs)
72 let ast = codegen (Target triple layout) (map snd defs)
73 result <- runErrorT . M.withModuleFromAST context ast $ \m ->
73 result <- runErrorT . M.withModuleFromAST context ast $ \m ->
74− do let opts = defaultCuratedPassSetSpec
74+ do let opts = PM.defaultCuratedPassSetSpec
75− { optLevel = Just optimize
75+ { PM.optLevel = Just optimize
76− , simplifyLibCalls = Just True
76+ , PM.simplifyLibCalls = Just True
77− , useInlinerWithThreshold = Just 225
77+ , PM.useInlinerWithThreshold = Just 225
79− when (optimize /= 0) $ withPassManager opts $ void . flip runPassManager m
79+ when (optimize /= 0) $ PM.withPassManager opts $ void . flip PM.runPassManager m
80 outputModule tm file outty m
80 outputModule tm file outty m
81 case result of
81 case result of
82 Right _ -> return ()
82 Right _ -> return ()