[commit: ghc] master: Fix llvm.prefetch instrinct for old LLVM versions (126285e)
David Terei
davidterei at gmail.com
Sat Jul 6 02:00:46 CEST 2013
Repository : http://darcs.haskell.org/ghc.git/
On branch : master
https://github.com/ghc/ghc/commit/126285e6d856da9ed9bd48f8ba5e6acbea8c9e02
>---------------------------------------------------------------
commit 126285e6d856da9ed9bd48f8ba5e6acbea8c9e02
Author: Peter Wortmann <scpmw at leeds.ac.uk>
Date: Thu Jul 4 17:15:27 2013 +0100
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 at gmail.com>
>---------------------------------------------------------------
compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
index 6e372fd..d223a5c 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)
More information about the ghc-commits
mailing list