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
13 targetVirtualRegSqueeze,
24 #include "HsVersions.h"
30 import CmmType (wordWidth)
36 #if i386_TARGET_ARCH || x86_64_TARGET_ARCH
37 import qualified X86.Regs as X86
38 import qualified X86.RegInfo as X86
40 #elif powerpc_TARGET_ARCH
41 import qualified PPC.Regs as PPC
43 #elif sparc_TARGET_ARCH
44 import qualified SPARC.Regs as SPARC
47 #error "RegAlloc.Graph.TargetReg: not defined"
50 targetVirtualRegSqueeze :: RegClass -> VirtualReg -> FastInt
51 targetRealRegSqueeze :: RegClass -> RealReg -> FastInt
52 targetClassOfRealReg :: RealReg -> RegClass
53 targetWordSize :: Size
54 targetMkVirtualReg :: Unique -> Size -> VirtualReg
55 targetRegDotColor :: RealReg -> SDoc
57 -- x86 -------------------------------------------------------------------------
58 #if i386_TARGET_ARCH || x86_64_TARGET_ARCH
59 targetVirtualRegSqueeze = X86.virtualRegSqueeze
60 targetRealRegSqueeze = X86.realRegSqueeze
61 targetClassOfRealReg = X86.classOfRealReg
62 targetWordSize = intSize wordWidth
63 targetMkVirtualReg = X86.mkVirtualReg
64 targetRegDotColor = X86.regDotColor
66 -- ppc -------------------------------------------------------------------------
67 #elif powerpc_TARGET_ARCH
68 targetVirtualRegSqueeze = PPC.virtualRegSqueeze
69 targetRealRegSqueeze = PPC.realRegSqueeze
70 targetClassOfRealReg = PPC.classOfRealReg
71 targetWordSize = intSize wordWidth
72 targetMkVirtualReg = PPC.mkVirtualReg
73 targetRegDotColor = PPC.regDotColor
75 -- sparc -----------------------------------------------------------------------
76 #elif sparc_TARGET_ARCH
77 targetVirtualRegSqueeze = SPARC.virtualRegSqueeze
78 targetRealRegSqueeze = SPARC.realRegSqueeze
79 targetClassOfRealReg = SPARC.classOfRealReg
80 targetWordSize = intSize wordWidth
81 targetMkVirtualReg = SPARC.mkVirtualReg
82 targetRegDotColor = SPARC.regDotColor
84 --------------------------------------------------------------------------------
86 #error "RegAlloc.Graph.TargetReg: not defined"
90 targetClassOfReg :: Reg -> RegClass
93 RegVirtual vr -> classOfVirtualReg vr
94 RegReal rr -> targetClassOfRealReg rr