summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/X86/Regs.hs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-03-21 14:38:53 +0000
committerIan Lynagh <igloo@earth.li>2012-03-21 14:38:53 +0000
commit3bdc739ebfb6a081b1ae9e537b9fe25bdd4bd91c (patch)
treeaaf7b85d285ca01926d1b81056ef13d790978419 /compiler/nativeGen/X86/Regs.hs
parentc4167f75518bcdeab38b33ca39920ae9170d5345 (diff)
downloadhaskell-3bdc739ebfb6a081b1ae9e537b9fe25bdd4bd91c.tar.gz
Fixes for the calling convention on Win64
In particular, fixes for FP arguments
Diffstat (limited to 'compiler/nativeGen/X86/Regs.hs')
-rw-r--r--compiler/nativeGen/X86/Regs.hs32
1 files changed, 20 insertions, 12 deletions
diff --git a/compiler/nativeGen/X86/Regs.hs b/compiler/nativeGen/X86/Regs.hs
index e0ddfc49f0..6abf1e2e88 100644
--- a/compiler/nativeGen/X86/Regs.hs
+++ b/compiler/nativeGen/X86/Regs.hs
@@ -15,6 +15,7 @@ module X86.Regs (
-- registers
spRel,
argRegs,
+ allArgRegs,
allIntArgRegs,
callClobberedRegs,
allMachRegNos,
@@ -378,9 +379,6 @@ xmm13 = regSingle 37
xmm14 = regSingle 38
xmm15 = regSingle 39
-allFPArgRegs :: [Reg]
-allFPArgRegs = map regSingle [firstxmm .. firstxmm+7]
-
ripRel :: Displacement -> AddrMode
ripRel imm = AddrBaseIndex EABaseRip EAIndexNone imm
@@ -406,7 +404,9 @@ xmm n = regSingle (firstxmm+n)
-- horror show -----------------------------------------------------------------
freeReg :: RegNo -> FastBool
globalRegMaybe :: GlobalReg -> Maybe RealReg
+allArgRegs :: [(Reg, Reg)]
allIntArgRegs :: [Reg]
+allFPArgRegs :: [Reg]
callClobberedRegs :: [Reg]
#if defined(i386_TARGET_ARCH) || defined(x86_64_TARGET_ARCH)
@@ -625,20 +625,28 @@ globalRegMaybe _ = Nothing
--
-#if i386_TARGET_ARCH
-allIntArgRegs = panic "X86.Regs.allIntArgRegs: should not be used!"
+#if defined(mingw32_HOST_OS) && x86_64_TARGET_ARCH
+
+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 x86_64_TARGET_ARCH
-#if defined(mingw32_HOST_OS)
-allIntArgRegs = map regSingle [rcx,rdx,r8,r9]
#else
+
+allArgRegs = panic "X86.Regs.allArgRegs: not defined for this arch"
+
+# if i386_TARGET_ARCH
+allIntArgRegs = panic "X86.Regs.allIntArgRegs: should not be used!"
+# elif x86_64_TARGET_ARCH
allIntArgRegs = map regSingle [rdi,rsi,rdx,rcx,r8,r9]
-#endif
+# else
+allIntArgRegs = panic "X86.Regs.allIntArgRegs: not defined for this arch"
+# endif
-#else
-allIntArgRegs = panic "X86.Regs.allIntArgRegs: not defined for this architecture"
-#endif
+allFPArgRegs = map regSingle [firstxmm .. firstxmm+7]
+#endif
-- | these are the regs which we cannot assume stay alive over a C call.