2 -- | Hard wired things related to registers.
3 -- This is module is preventing the native code generator being able to
4 -- emit code for non-host architectures.
6 -- TODO: Do a better job of the overloading, and eliminate this module.
7 -- We'd probably do better with a Register type class, and hook this to
8 -- Instruction somehow.
10 -- TODO: We should also make arch specific versions of RegAlloc.Graph.TrivColorable
21 #include "HsVersions.h"
27 import CmmExpr (wordWidth)
32 #if i386_TARGET_ARCH || x86_64_TARGET_ARCH
33 import qualified X86.Regs as X86
34 import qualified X86.RegInfo as X86
36 #elif powerpc_TARGET_ARCH
37 import qualified PPC.Regs as PPC
38 import qualified PPC.RegInfo as PPC
40 #elif sparc_TARGET_ARCH
41 import qualified SPARC.Regs as SPARC
42 import qualified SPARC.RegInfo as SPARC
46 #error "RegAlloc.Graph.TargetReg: not defined"
49 -- x86 -------------------------------------------------------------------------
50 #if i386_TARGET_ARCH || x86_64_TARGET_ARCH
51 targetRegClass :: Reg -> RegClass
52 targetRegClass = X86.regClass
54 targetWordSize :: Size
55 targetWordSize = intSize wordWidth
57 targetMkVReg :: Unique -> Size -> Reg
58 targetMkVReg = X86.mkVReg
60 targetRegDotColor :: Reg -> SDoc
61 targetRegDotColor = X86.regDotColor
64 -- ppc -------------------------------------------------------------------------
65 #elif powerpc_TARGET_ARCH
66 targetRegClass :: Reg -> RegClass
67 targetRegClass = PPC.regClass
69 targetWordSize :: Size
70 targetWordSize = intSize wordWidth
72 targetMkVReg :: Unique -> Size -> Reg
73 targetMkVReg = PPC.mkVReg
75 targetRegDotColor :: Reg -> SDoc
76 targetRegDotColor = PPC.regDotColor
79 -- sparc -----------------------------------------------------------------------
80 #elif sparc_TARGET_ARCH
81 targetRegClass :: Reg -> RegClass
82 targetRegClass = SPARC.regClass
84 -- | Size of a machine word.
85 -- This is big enough to hold a pointer.
86 targetWordSize :: Size
87 targetWordSize = intSize wordWidth
89 targetMkVReg :: Unique -> Size -> Reg
90 targetMkVReg = SPARC.mkVReg
92 targetRegDotColor :: Reg -> SDoc
93 targetRegDotColor = SPARC.regDotColor
95 --------------------------------------------------------------------------------
97 #error "RegAlloc.Graph.TargetReg: not defined"