on master help sign in
Fix compatibility with llvm-general 3.3.2 and tighten version constraints to avoid future breakage
340beedBenjamin Saunders
idris.cabal+1−1
@@ -272,7 +272,7 @@ Executable idris
272 haskeline>=0.7, split, directory,
272 haskeline>=0.7, split, directory,
273 containers, process, transformers, filepath,
273 containers, process, transformers, filepath,
274 directory, binary, bytestring, text, pretty,
274 directory, binary, bytestring, text, pretty,
275− language-java>=0.2.2, libffi, llvm-general>=3.3.0.6 && <3.4
275+ language-java>=0.2.2, libffi, llvm-general==3.3.2.*
276
276
277 Extensions: MultiParamTypeClasses, FunctionalDependencies,
277 Extensions: MultiParamTypeClasses, FunctionalDependencies,
278 FlexibleInstances, TemplateHaskell
278 FlexibleInstances, TemplateHaskell
src/IRTS/CodegenLLVM.hs+3−2
@@ -32,6 +32,7 @@ import Control.Applicative
32import Control.Monad.RWS
32import Control.Monad.RWS
33import Control.Monad.Writer
33import Control.Monad.Writer
34import Control.Monad.State
34import Control.Monad.State
35+import Control.Monad.Error
35
36
36import qualified System.Info as SI (arch, os)
37import qualified System.Info as SI (arch, os)
37import System.IO
38import System.IO
@@ -50,7 +51,7 @@ codegenLLVM :: [(TT.Name, SDecl)] ->
50codegenLLVM defs file outty = withContext $ \context -> do
51codegenLLVM defs file outty = withContext $ \context -> do
51 let target = Target { arch = SI.arch, os = SI.os }
52 let target = Target { arch = SI.arch, os = SI.os }
52 let ast = codegen target (map snd defs)
53 let ast = codegen target (map snd defs)
53− result <- M.withModuleFromAST context ast (outputModule file outty)
54+ result <- runErrorT $ M.withModuleFromAST context ast (outputModule file outty)
54 case result of
55 case result of
55 Right _ -> return ()
56 Right _ -> return ()
56 Left msg -> ierror msg
57 Left msg -> ierror msg
@@ -60,7 +61,7 @@ itWidth ITNative = 32
60itWidth x = fromIntegral $ intTyWidth x
61itWidth x = fromIntegral $ intTyWidth x
61
62
62outputModule :: FilePath -> OutputType -> M.Module -> IO ()
63outputModule :: FilePath -> OutputType -> M.Module -> IO ()
63−outputModule file Raw m = M.writeBitcodeToFile file m
64+outputModule file Raw m = either fail return <=< runErrorT $ M.writeBitcodeToFile file m
64outputModule file Object m = withTmpFile $ \bc -> do
65outputModule file Object m = withTmpFile $ \bc -> do
65 outputModule bc Raw m
66 outputModule bc Raw m
66 exit <- rawSystem "llc" ["-filetype=obj", "--disable-fp-elim", "-o", file, bc]
67 exit <- rawSystem "llc" ["-filetype=obj", "--disable-fp-elim", "-o", file, bc]