on master help sign in
Merge pull request #419 from Ralith/fix-llvm-fixed-width-compares

Integers of fixed width should use unsigned comparisons

commit700f7d76bae7793b8065de4cd4b5c787e36f00e3 authorEdwin Brady <edwin.brady@gmail.com> dateSun 28 Jul 2013, 05:35 (13 years ago) parent61d39da3dcdaa7
3 files changed+12−6
Setup.hs+3 idris.cabal+1−1 src/IRTS/CodegenLLVM.hs+8−5
Setup.hs+3
@@ -78,6 +78,8 @@ installLLVMLib verbosity pkg local copy =
7878 let idir = datadir $ L.absoluteInstallDirs pkg local copy in
7979 make verbosity ["-C", "llvm", "install", "TARGET=" ++ idir </> "llvm"]
8080
81+buildLLVMLib verbosity = make verbosity ["-C", "llvm", "all"]
82+
8183installJavaPom pkg local verbosity copy version = do
8284 putStrLn $ "Installing java pom template"
8385 let dir = datadir $ L.absoluteInstallDirs pkg local copy
@@ -169,6 +171,7 @@ main = do
169171 cleanJavaPom verb
170172 , postBuild = \ _ flags _ lbi -> do
171173 let verb = S.fromFlag $ S.buildVerbosity flags
174+ when (llvmFlag $ configFlags lbi) (buildLLVMLib verb)
172175 let withoutEffects = noEffectsFlag $ configFlags lbi
173176 checkStdLib lbi withoutEffects verb
174177 }
idris.cabal+1−1
@@ -295,6 +295,6 @@ Executable idris
295295 if flag(LLVM)
296296 other-modules: IRTS.CodegenLLVM
297297 cpp-options: -DIDRIS_LLVM
298− build-depends: llvm-general>=3.3.4.1 && <3.3.4.5
298+ build-depends: llvm-general==3.3.5.*
299299 else
300300 other-modules: Util.LLVMStubs
src/IRTS/CodegenLLVM.hs+8−5
@@ -14,7 +14,10 @@ import LLVM.General.Context
1414import LLVM.General.Diagnostic
1515import LLVM.General.AST
1616import LLVM.General.AST.AddrSpace
17−import LLVM.General.Target
17+import LLVM.General.Target ( TargetMachine
18+ , withTargetOptions, withTargetMachine, getTargetMachineDataLayout
19+ , initializeAllTargets, lookupTarget
20+ )
1821import LLVM.General.AST.DataLayout
1922import LLVM.General.PassManager
2023import qualified LLVM.General.Module as M
@@ -895,11 +898,11 @@ cgOp (LZExt (ITFixed from) (ITFixed to)) [x]
895898cgOp (LSExt (ITFixed from) (ITFixed to)) [x]
896899 | nativeTyWidth from < nativeTyWidth to = iCoerce SExt from to x
897900
898−cgOp (LLt (ATInt ity)) [x,y] = iCmp ity IPred.SLT x y
899−cgOp (LLe (ATInt ity)) [x,y] = iCmp ity IPred.SLE x y
901+cgOp (LLt (ATInt ity)) [x,y] = iCmp ity IPred.ULT x y
902+cgOp (LLe (ATInt ity)) [x,y] = iCmp ity IPred.ULE x y
900903cgOp (LEq (ATInt ity)) [x,y] = iCmp ity IPred.EQ x y
901−cgOp (LGe (ATInt ity)) [x,y] = iCmp ity IPred.SGE x y
902−cgOp (LGt (ATInt ity)) [x,y] = iCmp ity IPred.SGT x y
904+cgOp (LGe (ATInt ity)) [x,y] = iCmp ity IPred.UGE x y
905+cgOp (LGt (ATInt ity)) [x,y] = iCmp ity IPred.UGT x y
903906cgOp (LPlus (ATInt ity)) [x,y] = ibin ity x y (Add False False)
904907cgOp (LMinus (ATInt ity)) [x,y] = ibin ity x y (Sub False False)
905908cgOp (LTimes (ATInt ity)) [x,y] = ibin ity x y (Mul False False)