Commit ceef80b2 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Remove CPP from llvmGen/LlvmCodeGen/CodeGen.hs

parent 7b44e519
...@@ -22,6 +22,7 @@ import FastString ...@@ -22,6 +22,7 @@ import FastString
import ForeignCall import ForeignCall
import Outputable hiding ( panic, pprPanic ) import Outputable hiding ( panic, pprPanic )
import qualified Outputable import qualified Outputable
import Platform
import UniqSupply import UniqSupply
import Unique import Unique
import Util import Util
...@@ -143,11 +144,10 @@ genCall :: LlvmEnv -> CmmCallTarget -> [HintedCmmFormal] -> [HintedCmmActual] ...@@ -143,11 +144,10 @@ genCall :: LlvmEnv -> CmmCallTarget -> [HintedCmmFormal] -> [HintedCmmActual]
-- Write barrier needs to be handled specially as it is implemented as an LLVM -- Write barrier needs to be handled specially as it is implemented as an LLVM
-- intrinsic function. -- intrinsic function.
#if i386_TARGET_ARCH || x86_64_TARGET_ARCH || sparc_TARGET_ARCH genCall env (CmmPrim MO_WriteBarrier) _ _ _
genCall env (CmmPrim MO_WriteBarrier) _ _ _ = return (env, nilOL, []) | platformArch (getLlvmPlatform env) `elem` [ArchX86, ArchX86_64, ArchSPARC]
= return (env, nilOL, [])
#else | otherwise = do
genCall env (CmmPrim MO_WriteBarrier) _ _ _ = do
let fname = fsLit "llvm.memory.barrier" let fname = fsLit "llvm.memory.barrier"
let funSig = LlvmFunctionDecl fname ExternallyVisible CC_Ccc LMVoid let funSig = LlvmFunctionDecl fname ExternallyVisible CC_Ccc LMVoid
FixedArgs (tysToParams [i1, i1, i1, i1, i1]) llvmFunAlign FixedArgs (tysToParams [i1, i1, i1, i1, i1]) llvmFunAlign
...@@ -167,7 +167,6 @@ genCall env (CmmPrim MO_WriteBarrier) _ _ _ = do ...@@ -167,7 +167,6 @@ genCall env (CmmPrim MO_WriteBarrier) _ _ _ = do
where where
lmTrue :: LlvmVar lmTrue :: LlvmVar
lmTrue = mkIntLit i1 (-1) lmTrue = mkIntLit i1 (-1)
#endif
-- Handle popcnt function specifically since GHC only really has i32 and i64 -- 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 -- 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 ...@@ -235,11 +234,10 @@ genCall env target res args ret = do
-- translate to LLVM call convention -- translate to LLVM call convention
let lmconv = case cconv of let lmconv = case cconv of
#if i386_TARGET_ARCH || x86_64_TARGET_ARCH StdCallConv -> case platformArch (getLlvmPlatform env) of
StdCallConv -> CC_X86_Stdcc ArchX86 -> CC_X86_Stdcc
#else ArchX86_64 -> CC_X86_Stdcc
StdCallConv -> CC_Ccc _ -> CC_Ccc
#endif
CCallConv -> CC_Ccc CCallConv -> CC_Ccc
PrimCallConv -> CC_Ccc PrimCallConv -> CC_Ccc
CmmCallConv -> panic "CmmCallConv not supported here!" CmmCallConv -> panic "CmmCallConv 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