summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/X86/Regs.hs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-08-31 20:30:55 +0100
committerIan Lynagh <igloo@earth.li>2011-08-31 20:30:55 +0100
commitf948ebfcfcbe0918e181fcc7689de7f43d7f375a (patch)
treecb108f147fcb9dac329bdf27cfa45d299e6b2615 /compiler/nativeGen/X86/Regs.hs
parent5ee7d4ef87e79a54c6a0dcaa6836850b872d9652 (diff)
downloadhaskell-f948ebfcfcbe0918e181fcc7689de7f43d7f375a.tar.gz
Some CPP removal in X86.Regs
Diffstat (limited to 'compiler/nativeGen/X86/Regs.hs')
-rw-r--r--compiler/nativeGen/X86/Regs.hs20
1 files changed, 8 insertions, 12 deletions
diff --git a/compiler/nativeGen/X86/Regs.hs b/compiler/nativeGen/X86/Regs.hs
index 43b9c1721e..2a1c6fa5ab 100644
--- a/compiler/nativeGen/X86/Regs.hs
+++ b/compiler/nativeGen/X86/Regs.hs
@@ -269,22 +269,18 @@ classOfRealReg reg
RealRegPair{} -> panic "X86.Regs.classOfRealReg: RegPairs on this arch"
-- | Get the name of the register with this number.
-showReg :: RegNo -> String
-showReg n
+showReg :: Platform -> RegNo -> String
+showReg platform n
| n >= firstxmm = "%xmm" ++ show (n-firstxmm)
| n >= firstfake = "%fake" ++ show (n-firstfake)
| n >= 8 = "%r" ++ show n
- | otherwise = regNames !! n
+ | otherwise = regNames platform !! n
-regNames :: [String]
-regNames
-#if i386_TARGET_ARCH
- = ["%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp", "%esp"]
-#elif x86_64_TARGET_ARCH
- = ["%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi", "%rbp", "%rsp" ]
-#else
- = []
-#endif
+regNames :: Platform -> [String]
+regNames platform
+ = if target32Bit platform
+ then ["%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp", "%esp"]
+ else ["%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi", "%rbp", "%rsp"]