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
44 #error "RegAlloc.Graph.TargetReg: not defined"
47 -- x86 -------------------------------------------------------------------------
48 #if i386_TARGET_ARCH || x86_64_TARGET_ARCH
49 targetRegClass :: Reg -> RegClass
50 targetRegClass = X86.regClass
52 targetWordSize :: Size
53 targetWordSize = intSize wordWidth
55 targetMkVReg :: Unique -> Size -> Reg
56 targetMkVReg = X86.mkVReg
58 targetRegDotColor :: Reg -> SDoc
59 targetRegDotColor = X86.regDotColor
62 -- ppc -------------------------------------------------------------------------
63 #elif powerpc_TARGET_ARCH
64 targetRegClass :: Reg -> RegClass
65 targetRegClass = PPC.regClass
67 targetWordSize :: Size
68 targetWordSize = intSize wordWidth
70 targetMkVReg :: Unique -> Size -> Reg
71 targetMkVReg = PPC.mkVReg
73 targetRegDotColor :: Reg -> SDoc
74 targetRegDotColor = PPC.regDotColor
77 -- sparc -----------------------------------------------------------------------
78 #elif sparc_TARGET_ARCH
79 targetRegClass :: Reg -> RegClass
80 targetRegClass = SPARC.regClass
82 -- | Size of a machine word.
83 -- This is big enough to hold a pointer.
84 targetWordSize :: Size
85 targetWordSize = intSize wordWidth
87 targetMkVReg :: Unique -> Size -> Reg
88 targetMkVReg = SPARC.mkVReg
90 targetRegDotColor :: Reg -> SDoc
91 targetRegDotColor = SPARC.regDotColor
93 --------------------------------------------------------------------------------
95 #error "RegAlloc.Graph.TargetReg: not defined"