summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-06-01 00:20:08 +0100
committerIan Lynagh <igloo@earth.li>2011-06-01 00:20:08 +0100
commit013e6f33f55a2ca1a7469b239cac3ae23879299d (patch)
tree123380130fcf152d9e1a347310b86a4ebec64130
parent7867349134ee26e4276ff04ace7c815c1de43338 (diff)
downloadhaskell-013e6f33f55a2ca1a7469b239cac3ae23879299d.tar.gz
Fix a build failure on non-{x86,amd64}
-rw-r--r--compiler/nativeGen/X86/RegInfo.hs68
1 files changed, 28 insertions, 40 deletions
diff --git a/compiler/nativeGen/X86/RegInfo.hs b/compiler/nativeGen/X86/RegInfo.hs
index 21b594e38f..140ff57ae9 100644
--- a/compiler/nativeGen/X86/RegInfo.hs
+++ b/compiler/nativeGen/X86/RegInfo.hs
@@ -13,12 +13,11 @@ import Size
import Reg
import Outputable
+import Platform
import Unique
-#if i386_TARGET_ARCH || x86_64_TARGET_ARCH
import UniqFM
import X86.Regs
-#endif
mkVirtualReg :: Unique -> Size -> VirtualReg
@@ -29,52 +28,41 @@ mkVirtualReg u size
FF80 -> VirtualRegD u
_other -> VirtualRegI u
-
--- reg colors for x86
-#if i386_TARGET_ARCH
regDotColor :: RealReg -> SDoc
regDotColor reg
= let Just str = lookupUFM regColors reg
in text str
regColors :: UniqFM [Char]
-regColors
- = listToUFM
- $ [ (eax, "#00ff00")
- , (ebx, "#0000ff")
- , (ecx, "#00ffff")
- , (edx, "#0080ff") ]
- ++ fpRegColors
+regColors = listToUFM (normalRegColors ++ fpRegColors)
--- reg colors for x86_64
-#elif x86_64_TARGET_ARCH
-regDotColor :: RealReg -> SDoc
-regDotColor reg
- = let Just str = lookupUFM regColors reg
- in text str
+-- TODO: We shouldn't be using defaultTargetPlatform here.
+-- We should be passing DynFlags in instead, and looking at
+-- its targetPlatform.
-regColors :: UniqFM [Char]
-regColors
- = listToUFM
- $ [ (rax, "#00ff00"), (eax, "#00ff00")
- , (rbx, "#0000ff"), (ebx, "#0000ff")
- , (rcx, "#00ffff"), (ecx, "#00ffff")
- , (rdx, "#0080ff"), (edx, "#00ffff")
- , (r8, "#00ff80")
- , (r9, "#008080")
- , (r10, "#0040ff")
- , (r11, "#00ff40")
- , (r12, "#008040")
- , (r13, "#004080")
- , (r14, "#004040")
- , (r15, "#002080") ]
- ++ fpRegColors
-#else
-regDotColor :: Reg -> SDoc
-regDotColor = panic "not defined"
-#endif
+normalRegColors :: [(Reg,String)]
+normalRegColors = case platformArch defaultTargetPlatform of
+ ArchX86 -> [ (eax, "#00ff00")
+ , (ebx, "#0000ff")
+ , (ecx, "#00ffff")
+ , (edx, "#0080ff") ]
+ ArchX86_64 -> [ (rax, "#00ff00"), (eax, "#00ff00")
+ , (rbx, "#0000ff"), (ebx, "#0000ff")
+ , (rcx, "#00ffff"), (ecx, "#00ffff")
+ , (rdx, "#0080ff"), (edx, "#00ffff")
+ , (r8, "#00ff80")
+ , (r9, "#008080")
+ , (r10, "#0040ff")
+ , (r11, "#00ff40")
+ , (r12, "#008040")
+ , (r13, "#004080")
+ , (r14, "#004040")
+ , (r15, "#002080") ]
+ ArchPPC -> panic "X86 normalRegColors ArchPPC"
+ ArchPPC_64 -> panic "X86 normalRegColors ArchPPC_64"
+ ArchSPARC -> panic "X86 normalRegColors ArchSPARC"
+ ArchUnknown -> panic "X86 normalRegColors ArchUnknown"
-#if i386_TARGET_ARCH || x86_64_TARGET_ARCH
fpRegColors :: [(Reg,String)]
fpRegColors =
[ (fake0, "#ff00ff")
@@ -85,4 +73,4 @@ fpRegColors =
, (fake5, "#5500ff") ]
++ zip (map regSingle [24..39]) (repeat "red")
-#endif
+