on master help sign in
Merge pull request #485 from lambdadomain/master
39bc4c4Edwin Brady
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
@@ -435,13 +436,13 @@ targetCPU :: Idris String
435targetCPU = do i <- getIState
436targetCPU = do i <- getIState
436 return (opt_cpu (idris_options i))
437 return (opt_cpu (idris_options i))
437
438
438−setOptLevel :: Int -> Idris ()
439+setOptLevel :: Word -> Idris ()
439setOptLevel t = do i <- getIState
440setOptLevel t = do i <- getIState
440 let opts = idris_options i
441 let opts = idris_options i
441 opt' = opts { opt_optLevel = t }
442 opt' = opts { opt_optLevel = t }
442 putIState $ i { idris_options = opt' }
443 putIState $ i { idris_options = opt' }
443
444
444−optLevel :: Idris Int
445+optLevel :: Idris Word
445optLevel = do i <- getIState
446optLevel = do i <- getIState
446 return (opt_optLevel (idris_options i))
447 return (opt_optLevel (idris_options i))
447
448
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
@@ -943,7 +944,7 @@ getCPU :: Opt -> Maybe String
943getCPU (TargetCPU x) = Just x
944getCPU (TargetCPU x) = Just x
944getCPU _ = Nothing
945getCPU _ = Nothing
945
946
946−getOptLevel :: Opt -> Maybe Int
947+getOptLevel :: Opt -> Maybe Word
947getOptLevel (OptLevel x) = Just x
948getOptLevel (OptLevel x) = Just x
948getOptLevel _ = Nothing
949getOptLevel _ = Nothing
949
950