Move activeStgRegs into CodeGen.Platform
[ghc.git] / includes / CodeGen.Platform.hs
1
2 #include <stg/MachRegs.h>
3
4 callerSaves :: GlobalReg -> Bool
5 #ifdef CALLER_SAVES_Base
6 callerSaves BaseReg = True
7 #endif
8 #ifdef CALLER_SAVES_R1
9 callerSaves (VanillaReg 1 _) = True
10 #endif
11 #ifdef CALLER_SAVES_R2
12 callerSaves (VanillaReg 2 _) = True
13 #endif
14 #ifdef CALLER_SAVES_R3
15 callerSaves (VanillaReg 3 _) = True
16 #endif
17 #ifdef CALLER_SAVES_R4
18 callerSaves (VanillaReg 4 _) = True
19 #endif
20 #ifdef CALLER_SAVES_R5
21 callerSaves (VanillaReg 5 _) = True
22 #endif
23 #ifdef CALLER_SAVES_R6
24 callerSaves (VanillaReg 6 _) = True
25 #endif
26 #ifdef CALLER_SAVES_R7
27 callerSaves (VanillaReg 7 _) = True
28 #endif
29 #ifdef CALLER_SAVES_R8
30 callerSaves (VanillaReg 8 _) = True
31 #endif
32 #ifdef CALLER_SAVES_R9
33 callerSaves (VanillaReg 9 _) = True
34 #endif
35 #ifdef CALLER_SAVES_R10
36 callerSaves (VanillaReg 10 _) = True
37 #endif
38 #ifdef CALLER_SAVES_F1
39 callerSaves (FloatReg 1) = True
40 #endif
41 #ifdef CALLER_SAVES_F2
42 callerSaves (FloatReg 2) = True
43 #endif
44 #ifdef CALLER_SAVES_F3
45 callerSaves (FloatReg 3) = True
46 #endif
47 #ifdef CALLER_SAVES_F4
48 callerSaves (FloatReg 4) = True
49 #endif
50 #ifdef CALLER_SAVES_D1
51 callerSaves (DoubleReg 1) = True
52 #endif
53 #ifdef CALLER_SAVES_D2
54 callerSaves (DoubleReg 2) = True
55 #endif
56 #ifdef CALLER_SAVES_L1
57 callerSaves (LongReg 1) = True
58 #endif
59 #ifdef CALLER_SAVES_Sp
60 callerSaves Sp = True
61 #endif
62 #ifdef CALLER_SAVES_SpLim
63 callerSaves SpLim = True
64 #endif
65 #ifdef CALLER_SAVES_Hp
66 callerSaves Hp = True
67 #endif
68 #ifdef CALLER_SAVES_HpLim
69 callerSaves HpLim = True
70 #endif
71 #ifdef CALLER_SAVES_CCCS
72 callerSaves CCCS = True
73 #endif
74 #ifdef CALLER_SAVES_CurrentTSO
75 callerSaves CurrentTSO = True
76 #endif
77 #ifdef CALLER_SAVES_CurrentNursery
78 callerSaves CurrentNursery = True
79 #endif
80 callerSaves _ = False
81
82 activeStgRegs :: [GlobalReg]
83 activeStgRegs = [
84 #ifdef REG_Base
85 BaseReg
86 #endif
87 #ifdef REG_Sp
88 ,Sp
89 #endif
90 #ifdef REG_Hp
91 ,Hp
92 #endif
93 #ifdef REG_R1
94 ,VanillaReg 1 VGcPtr
95 #endif
96 #ifdef REG_R2
97 ,VanillaReg 2 VGcPtr
98 #endif
99 #ifdef REG_R3
100 ,VanillaReg 3 VGcPtr
101 #endif
102 #ifdef REG_R4
103 ,VanillaReg 4 VGcPtr
104 #endif
105 #ifdef REG_R5
106 ,VanillaReg 5 VGcPtr
107 #endif
108 #ifdef REG_R6
109 ,VanillaReg 6 VGcPtr
110 #endif
111 #ifdef REG_R7
112 ,VanillaReg 7 VGcPtr
113 #endif
114 #ifdef REG_R8
115 ,VanillaReg 8 VGcPtr
116 #endif
117 #ifdef REG_R9
118 ,VanillaReg 9 VGcPtr
119 #endif
120 #ifdef REG_R10
121 ,VanillaReg 10 VGcPtr
122 #endif
123 #ifdef REG_SpLim
124 ,SpLim
125 #endif
126 #ifdef REG_F1
127 ,FloatReg 1
128 #endif
129 #ifdef REG_F2
130 ,FloatReg 2
131 #endif
132 #ifdef REG_F3
133 ,FloatReg 3
134 #endif
135 #ifdef REG_F4
136 ,FloatReg 4
137 #endif
138 #ifdef REG_D1
139 ,DoubleReg 1
140 #endif
141 #ifdef REG_D2
142 ,DoubleReg 2
143 #endif
144 ]
145