diff options
author | Peter Wortmann <scpmw@leeds.ac.uk> | 2013-07-04 17:15:27 +0100 |
---|---|---|
committer | David Terei <davidterei@gmail.com> | 2013-07-05 16:59:13 -0700 |
commit | 126285e6d856da9ed9bd48f8ba5e6acbea8c9e02 (patch) | |
tree | 15b99dceef3aa6dcfbd2114b4a0ed1cca3fa7d3e | |
parent | 279ac9f66a83203448b279ea478b2cc1dafbd35d (diff) | |
download | haskell-126285e6d856da9ed9bd48f8ba5e6acbea8c9e02.tar.gz |
Fix llvm.prefetch instrinct for old LLVM versions
Seems the last parameter to llvm.prefectch was added in LLVM 3.0.
Signed-off-by: David Terei <davidterei@gmail.com>
-rw-r--r-- | compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs index 6e372fd61b..d223a5c9cd 100644 --- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs +++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs @@ -201,7 +201,9 @@ genCall (PrimTarget (MO_UF_Conv _)) [_] args = -- Handle prefetching data genCall t@(PrimTarget MO_Prefetch_Data) [] args = do - let argTy = [i8Ptr, i32, i32, i32] + ver <- getLlvmVer + let argTy | ver <= 29 = [i8Ptr, i32, i32] + | otherwise = [i8Ptr, i32, i32, i32] funTy = \name -> LMFunction $ LlvmFunctionDecl name ExternallyVisible CC_Ccc LMVoid FixedArgs (tysToParams argTy) Nothing @@ -212,8 +214,9 @@ genCall t@(PrimTarget MO_Prefetch_Data) [] args = do (argVars', stmts3) <- castVars $ zip argVars argTy trash <- getTrashStmts - let arguments = argVars' ++ [mkIntLit i32 0, mkIntLit i32 3, mkIntLit i32 1] - call = Expr $ Call StdCall fptr arguments [] + let argSuffix | ver <= 29 = [mkIntLit i32 0, mkIntLit i32 3] + | otherwise = [mkIntLit i32 0, mkIntLit i32 3, mkIntLit i32 1] + call = Expr $ Call StdCall fptr (argVars' ++ argSuffix) [] stmts = stmts1 `appOL` stmts2 `appOL` stmts3 `appOL` trash `snocOL` call return (stmts, top1 ++ top2) |