Commit 23efe668 authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

Remove some CPP in nativeGen/X86/Regs.hs

parent a3d77e86
......@@ -1978,11 +1978,11 @@ genCCall64' platform target dest_regs args = do
(stack_args, int_regs_used, fp_regs_used, load_args_code)
<-
if platformOS platform == OSMinGW32
then load_args_win args [] [] allArgRegs nilOL
then load_args_win args [] [] (allArgRegs platform) nilOL
else do (stack_args, aregs, fregs, load_args_code)
<- load_args args allIntArgRegs allFPArgRegs nilOL
let fp_regs_used = reverse (drop (length fregs) (reverse allFPArgRegs))
int_regs_used = reverse (drop (length aregs) (reverse allIntArgRegs))
<- load_args args (allIntArgRegs platform) (allFPArgRegs platform) nilOL
let fp_regs_used = reverse (drop (length fregs) (reverse (allFPArgRegs platform)))
int_regs_used = reverse (drop (length aregs) (reverse (allIntArgRegs platform)))
return (stack_args, int_regs_used, fp_regs_used, load_args_code)
let
......@@ -1991,7 +1991,7 @@ genCCall64' platform target dest_regs args = do
-- for annotating the call instruction with
sse_regs = length fp_regs_used
arg_stack_slots = if platformOS platform == OSMinGW32
then length stack_args + length allArgRegs
then length stack_args + length (allArgRegs platform)
else length stack_args
tot_arg_size = arg_size * arg_stack_slots
......@@ -2014,7 +2014,7 @@ genCCall64' platform target dest_regs args = do
-- On Win64, we also have to leave stack space for the arguments
-- that we are passing in registers
lss_code <- if platformOS platform == OSMinGW32
then leaveStackSpace (length allArgRegs)
then leaveStackSpace (length (allArgRegs platform))
else return nilOL
delta <- getDeltaNat
......
......@@ -421,11 +421,26 @@ xmm n = regSingle (firstxmm+n)
-- horror show -----------------------------------------------------------------
freeReg :: RegNo -> FastBool
globalRegMaybe :: GlobalReg -> Maybe RealReg
allArgRegs :: [(Reg, Reg)]
allIntArgRegs :: [Reg]
allFPArgRegs :: [Reg]
callClobberedRegs :: Platform -> [Reg]
allArgRegs :: Platform -> [(Reg, Reg)]
allArgRegs platform
| platformOS platform == OSMinGW32 = zip [rcx,rdx,r8,r9]
(map regSingle [firstxmm ..])
| otherwise = panic "X86.Regs.allArgRegs: not defined for this arch"
allIntArgRegs :: Platform -> [Reg]
allIntArgRegs platform
| (platformOS platform == OSMinGW32) || target32Bit platform
= panic "X86.Regs.allIntArgRegs: not defined for this platform"
| otherwise = [rdi,rsi,rdx,rcx,r8,r9]
allFPArgRegs :: Platform -> [Reg]
allFPArgRegs platform
| platformOS platform == OSMinGW32
= panic "X86.Regs.allFPArgRegs: not defined for this platform"
| otherwise = map regSingle [firstxmm .. firstxmm+7]
#if i386_TARGET_ARCH
#define eax 0
#define ebx 1
......@@ -601,27 +616,6 @@ globalRegMaybe _ = Nothing
--
#if defined(mingw32_HOST_OS)
allArgRegs = zip (map regSingle [rcx,rdx,r8,r9])
(map regSingle [firstxmm ..])
allIntArgRegs = panic "X86.Regs.allIntArgRegs: not defined for this platform"
allFPArgRegs = panic "X86.Regs.allFPArgRegs: not defined for this platform"
#elif i386_TARGET_ARCH
allArgRegs = panic "X86.Regs.allArgRegs: not defined for this arch"
allIntArgRegs = panic "X86.Regs.allIntArgRegs: should not be used!"
allFPArgRegs = map regSingle [firstxmm .. firstxmm+7]
#else
allArgRegs = panic "X86.Regs.allArgRegs: not defined for this arch"
allIntArgRegs = map regSingle [rdi,rsi,rdx,rcx,r8,r9]
allFPArgRegs = map regSingle [firstxmm .. firstxmm+7]
#endif
-- All machine registers that are used for argument-passing to Haskell functions
allHaskellArgRegs :: [Reg]
allHaskellArgRegs = [ RegReal r | Just r <- map globalRegMaybe globalArgRegs ]
......
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