diff options
author | Ian Lynagh <igloo@earth.li> | 2011-10-15 10:41:47 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2011-10-15 10:41:47 +0100 |
commit | ceef80b2fbd414c701bb2a346226a357475983ad (patch) | |
tree | c8752bd1ad52d46349f842e0fe0a2178a1d01dea /compiler/llvmGen | |
parent | 7b44e519e7bd746ccab648c75c89a0f42f6c5871 (diff) | |
download | haskell-ceef80b2fbd414c701bb2a346226a357475983ad.tar.gz |
Remove CPP from llvmGen/LlvmCodeGen/CodeGen.hs
Diffstat (limited to 'compiler/llvmGen')
-rw-r--r-- | compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs index 09ccf72fb6..b4e27903fa 100644 --- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs +++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs @@ -22,6 +22,7 @@ import FastString import ForeignCall import Outputable hiding ( panic, pprPanic ) import qualified Outputable +import Platform import UniqSupply import Unique import Util @@ -143,11 +144,10 @@ genCall :: LlvmEnv -> CmmCallTarget -> [HintedCmmFormal] -> [HintedCmmActual] -- Write barrier needs to be handled specially as it is implemented as an LLVM -- intrinsic function. -#if i386_TARGET_ARCH || x86_64_TARGET_ARCH || sparc_TARGET_ARCH -genCall env (CmmPrim MO_WriteBarrier) _ _ _ = return (env, nilOL, []) - -#else -genCall env (CmmPrim MO_WriteBarrier) _ _ _ = do +genCall env (CmmPrim MO_WriteBarrier) _ _ _ + | platformArch (getLlvmPlatform env) `elem` [ArchX86, ArchX86_64, ArchSPARC] + = return (env, nilOL, []) + | otherwise = do let fname = fsLit "llvm.memory.barrier" let funSig = LlvmFunctionDecl fname ExternallyVisible CC_Ccc LMVoid FixedArgs (tysToParams [i1, i1, i1, i1, i1]) llvmFunAlign @@ -167,7 +167,6 @@ genCall env (CmmPrim MO_WriteBarrier) _ _ _ = do where lmTrue :: LlvmVar lmTrue = mkIntLit i1 (-1) -#endif -- Handle popcnt function specifically since GHC only really has i32 and i64 -- types and things like Word8 are backed by an i32 and just present a logical @@ -235,11 +234,10 @@ genCall env target res args ret = do -- translate to LLVM call convention let lmconv = case cconv of -#if i386_TARGET_ARCH || x86_64_TARGET_ARCH - StdCallConv -> CC_X86_Stdcc -#else - StdCallConv -> CC_Ccc -#endif + StdCallConv -> case platformArch (getLlvmPlatform env) of + ArchX86 -> CC_X86_Stdcc + ArchX86_64 -> CC_X86_Stdcc + _ -> CC_Ccc CCallConv -> CC_Ccc PrimCallConv -> CC_Ccc CmmCallConv -> panic "CmmCallConv not supported here!" |