Commit 578d2bad authored by Michal Terepeta's avatar Michal Terepeta Committed by Austin Seipp

Remove unneeded compatibility with LLVM < 3.6

Since GHC requires at least LLVM 3.6, some of the special cases (for,
e.g., LLVM 2.8 or 2.9) in the LLVM CodeGen can be simply removed.

Reviewed By: rwbarton, austin

Differential Revision: https://phabricator.haskell.org/D884

GHC Trac Issues: #10074
parent 5cbac886
......@@ -156,21 +156,6 @@ barrier = do
let s = Fence False SyncSeqCst
return (unitOL s, [])
-- | Memory barrier instruction for LLVM < 3.0
oldBarrier :: LlvmM StmtData
oldBarrier = do
(fv, _, tops) <- getInstrinct (fsLit "llvm.memory.barrier") LMVoid [i1, i1, i1, i1, i1]
let args = [lmTrue, lmTrue, lmTrue, lmTrue, lmTrue]
let s1 = Expr $ Call StdCall fv args llvmStdFunAttrs
return (unitOL s1, tops)
where
lmTrue :: LlvmVar
lmTrue = mkIntLit i1 (-1)
-- | Foreign Calls
genCall :: ForeignTarget -> [CmmFormal] -> [CmmActual]
-> LlvmM StmtData
......@@ -179,12 +164,9 @@ genCall :: ForeignTarget -> [CmmFormal] -> [CmmActual]
-- intrinsic function.
genCall (PrimTarget MO_WriteBarrier) _ _ = do
platform <- getLlvmPlatform
ver <- getLlvmVer
case () of
_ | platformArch platform `elem` [ArchX86, ArchX86_64, ArchSPARC]
-> return (nilOL, [])
| ver > 29 -> barrier
| otherwise -> oldBarrier
if platformArch platform `elem` [ArchX86, ArchX86_64, ArchSPARC]
then return (nilOL, [])
else barrier
genCall (PrimTarget MO_Touch) _ _
= return (nilOL, [])
......@@ -206,9 +188,7 @@ genCall (PrimTarget (MO_UF_Conv _)) [_] args =
-- Handle prefetching data
genCall t@(PrimTarget (MO_Prefetch_Data localityInt)) [] args
| 0 <= localityInt && localityInt <= 3 = do
ver <- getLlvmVer
let argTy | ver <= 29 = [i8Ptr, i32, i32]
| otherwise = [i8Ptr, i32, i32, i32]
let argTy = [i8Ptr, i32, i32, i32]
funTy = \name -> LMFunction $ LlvmFunctionDecl name ExternallyVisible
CC_Ccc LMVoid FixedArgs (tysToParams argTy) Nothing
......@@ -219,8 +199,7 @@ genCall t@(PrimTarget (MO_Prefetch_Data localityInt)) [] args
(argVars', stmts3) <- castVars $ zip argVars argTy
trash <- getTrashStmts
let argSuffix | ver <= 29 = [mkIntLit i32 0, mkIntLit i32 localityInt]
| otherwise = [mkIntLit i32 0, mkIntLit i32 localityInt, mkIntLit i32 1]
let argSuffix = [mkIntLit i32 0, mkIntLit i32 localityInt, mkIntLit i32 1]
call = Expr $ Call StdCall fptr (argVars' ++ argSuffix) []
stmts = stmts1 `appOL` stmts2 `appOL` stmts3
`appOL` trash `snocOL` call
......@@ -255,12 +234,10 @@ genCall t@(PrimTarget op) [] args'
| op == MO_Memcpy ||
op == MO_Memset ||
op == MO_Memmove = do
ver <- getLlvmVer
dflags <- getDynFlags
let (args, alignVal) = splitAlignVal args'
(isVolTy, isVolVal)
| ver >= 28 = ([i1], [mkIntLit i1 0])
| otherwise = ([], [])
isVolTy = [i1]
isVolVal = [mkIntLit i1 0]
argTy | op == MO_Memset = [i8Ptr, i8, llvmWord dflags, i32] ++ isVolTy
| otherwise = [i8Ptr, i8Ptr, llvmWord dflags, i32] ++ isVolTy
funTy = \name -> LMFunction $ LlvmFunctionDecl name ExternallyVisible
......@@ -516,12 +493,9 @@ castVar v t | getVarType v == t
cmmPrimOpFunctions :: CallishMachOp -> LlvmM LMString
cmmPrimOpFunctions mop = do
ver <- getLlvmVer
dflags <- getDynFlags
let intrinTy1 = (if ver >= 28
then "p0i8.p0i8." else "") ++ showSDoc dflags (ppr $ llvmWord dflags)
intrinTy2 = (if ver >= 28
then "p0i8." else "") ++ showSDoc dflags (ppr $ llvmWord dflags)
let intrinTy1 = "p0i8.p0i8." ++ showSDoc dflags (ppr $ llvmWord dflags)
intrinTy2 = "p0i8." ++ showSDoc dflags (ppr $ llvmWord dflags)
unsupported = panic ("cmmPrimOpFunctions: " ++ show mop
++ " not supported here")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment