on master help sign in
Updated dependencies and types for Haskell llvm bindings v3.3.8.1.
ed8114elambdadomain
idris.cabal+1−1
@@ -303,6 +303,6 @@ Executable idris
303 if flag(LLVM)
303 if flag(LLVM)
304 other-modules: IRTS.CodegenLLVM
304 other-modules: IRTS.CodegenLLVM
305 cpp-options: -DIDRIS_LLVM
305 cpp-options: -DIDRIS_LLVM
306− build-depends: llvm-general==3.3.5.*
306+ build-depends: llvm-general==3.3.8.*, llvm-general-pure==3.3.8.*
307 else
307 else
308 other-modules: Util.LLVMStubs
308 other-modules: Util.LLVMStubs
src/IRTS/CodegenLLVM.hs+7−7
@@ -19,7 +19,7 @@ import LLVM.General.Target ( TargetMachine
19 , initializeAllTargets, lookupTarget
19 , initializeAllTargets, lookupTarget
20 )
20 )
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 ->
65 IO ()
65 IO ()
@@ -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
78 }
78 }
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 ()
src/Idris/AbsSyntax.hs+3−2
@@ -23,6 +23,7 @@ import Data.List
23import Data.Char
23import Data.Char
24import Data.Either
24import Data.Either
25import Data.Maybe
25import Data.Maybe
26+import Data.Word (Word)
26
27
27import Debug.Trace
28import Debug.Trace
28
29
@@ -432,13 +433,13 @@ targetCPU :: Idris String
432targetCPU = do i <- getIState
433targetCPU = do i <- getIState
433 return (opt_cpu (idris_options i))
434 return (opt_cpu (idris_options i))
434
435
435−setOptLevel :: Int -> Idris ()
436+setOptLevel :: Word -> Idris ()
436setOptLevel t = do i <- getIState
437setOptLevel t = do i <- getIState
437 let opts = idris_options i
438 let opts = idris_options i
438 opt' = opts { opt_optLevel = t }
439 opt' = opts { opt_optLevel = t }
439 putIState $ i { idris_options = opt' }
440 putIState $ i { idris_options = opt' }
440
441
441−optLevel :: Idris Int
442+optLevel :: Idris Word
442optLevel = do i <- getIState
443optLevel = do i <- getIState
443 return (opt_optLevel (idris_options i))
444 return (opt_optLevel (idris_options i))
444
445
src/Idris/AbsSyntaxTree.hs+3−2
@@ -24,6 +24,7 @@ import Control.Monad.Trans.State.Strict
24import Data.List
24import Data.List
25import Data.Char
25import Data.Char
26import Data.Either
26import Data.Either
27+import Data.Word (Word)
27
28
28import Debug.Trace
29import Debug.Trace
29
30
@@ -42,7 +43,7 @@ data IOption = IOption { opt_logLevel :: Int,
42 opt_importdirs :: [FilePath],
43 opt_importdirs :: [FilePath],
43 opt_triple :: String,
44 opt_triple :: String,
44 opt_cpu :: String,
45 opt_cpu :: String,
45− opt_optLevel :: Int,
46+ opt_optLevel :: Word,
46 opt_cmdline :: [Opt] -- remember whole command line
47 opt_cmdline :: [Opt] -- remember whole command line
47 }
48 }
48 deriving (Show, Eq)
49 deriving (Show, Eq)
@@ -278,7 +279,7 @@ data Opt = Filename String
278 | InterpretScript String
279 | InterpretScript String
279 | TargetTriple String
280 | TargetTriple String
280 | TargetCPU String
281 | TargetCPU String
281− | OptLevel Int
282+ | OptLevel Word
282 deriving (Show, Eq)
283 deriving (Show, Eq)
283
284
284-- Parsed declarations
285-- Parsed declarations
src/Idris/REPL.hs+2−1
@@ -59,6 +59,7 @@ import Data.Maybe
59import Data.List
59import Data.List
60import Data.Char
60import Data.Char
61import Data.Version
61import Data.Version
62+import Data.Word (Word)
62
63
63import Debug.Trace
64import Debug.Trace
64
65
@@ -939,7 +940,7 @@ getCPU :: Opt -> Maybe String
939getCPU (TargetCPU x) = Just x
940getCPU (TargetCPU x) = Just x
940getCPU _ = Nothing
941getCPU _ = Nothing
941
942
942−getOptLevel :: Opt -> Maybe Int
943+getOptLevel :: Opt -> Maybe Word
943getOptLevel (OptLevel x) = Just x
944getOptLevel (OptLevel x) = Just x
944getOptLevel _ = Nothing
945getOptLevel _ = Nothing
945
946