[commit: ghc] master: More CPP removal in nativeGen/X86/Regs.hs (f26027e)
Ian Lynagh
igloo at earth.li
Wed Aug 22 02:39:32 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/f26027ee187c643b74ce19c7719376e6c987d8ae
>---------------------------------------------------------------
commit f26027ee187c643b74ce19c7719376e6c987d8ae
Author: Ian Lynagh <ian at well-typed.com>
Date: Wed Aug 22 00:51:09 2012 +0100
More CPP removal in nativeGen/X86/Regs.hs
>---------------------------------------------------------------
compiler/nativeGen/X86/CodeGen.hs | 4 ++--
compiler/nativeGen/X86/Regs.hs | 18 ++++++++----------
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs
index a8bbcbb..c00a0d5 100644
--- a/compiler/nativeGen/X86/CodeGen.hs
+++ b/compiler/nativeGen/X86/CodeGen.hs
@@ -926,6 +926,7 @@ getByteReg expr = do
-- be modified by code to evaluate an arbitrary expression.
getNonClobberedReg :: CmmExpr -> NatM (Reg, InstrBlock)
getNonClobberedReg expr = do
+ dflags <- getDynFlags
r <- getRegister expr
case r of
Any rep code -> do
@@ -933,8 +934,7 @@ getNonClobberedReg expr = do
return (tmp, code tmp)
Fixed rep reg code
-- only certain regs can be clobbered
- | RegReal real <- reg
- , real `elem` instrClobberedRegs
+ | reg `elem` instrClobberedRegs (targetPlatform dflags)
-> do
tmp <- getNewRegNat rep
return (tmp, code `snocOL` reg2reg rep reg tmp)
diff --git a/compiler/nativeGen/X86/Regs.hs b/compiler/nativeGen/X86/Regs.hs
index 1affca7..15f20a2 100644
--- a/compiler/nativeGen/X86/Regs.hs
+++ b/compiler/nativeGen/X86/Regs.hs
@@ -451,6 +451,14 @@ allFPArgRegs platform
= panic "X86.Regs.allFPArgRegs: not defined for this platform"
| otherwise = map regSingle [firstxmm .. firstxmm+7]
+-- Machine registers which might be clobbered by instructions that
+-- generate results into fixed registers, or need arguments in a fixed
+-- register.
+instrClobberedRegs :: Platform -> [Reg]
+instrClobberedRegs platform
+ | target32Bit platform = [ eax, ecx, edx ]
+ | otherwise = [ rax, rcx, rdx ]
+
#if i386_TARGET_ARCH
#define eax 0
#define ebx 1
@@ -630,16 +638,6 @@ globalRegMaybe _ = Nothing
allHaskellArgRegs :: [Reg]
allHaskellArgRegs = [ RegReal r | Just r <- map globalRegMaybe globalArgRegs ]
--- Machine registers which might be clobbered by instructions that
--- generate results into fixed registers, or need arguments in a fixed
--- register.
-instrClobberedRegs :: [RealReg]
-#if i386_TARGET_ARCH
-instrClobberedRegs = map RealRegSingle [ eax, ecx, edx ]
-#else
-instrClobberedRegs = map RealRegSingle [ rax, rcx, rdx ]
-#endif
-
-- allocatableRegs is allMachRegNos with the fixed-use regs removed.
-- i.e., these are the regs for which we are prepared to allow the
-- register allocator to attempt to map VRegs to.
More information about the Cvs-ghc
mailing list