libFirm
gen_arm_regalloc_if.c
1 
11 #include "gen_arm_regalloc_if.h"
12 
13 #include "arm_bearch_t.h"
14 
15 const arch_register_req_t arm_class_reg_req_flags = {
16  .cls = &arm_reg_classes[CLASS_arm_flags],
17  .width = 1,
18 };
19 static const unsigned arm_limited_flags_fl[] = { (1U << REG_FLAGS_FL) };
20 const arch_register_req_t arm_single_reg_req_flags_fl = {
21  .cls = &arm_reg_classes[CLASS_arm_flags],
22  .limited = arm_limited_flags_fl,
23  .width = 1,
24 };
25 const arch_register_req_t arm_class_reg_req_fpa = {
26  .cls = &arm_reg_classes[CLASS_arm_fpa],
27  .width = 1,
28 };
29 static const unsigned arm_limited_fpa_f0[] = { (1U << REG_FPA_F0) };
30 const arch_register_req_t arm_single_reg_req_fpa_f0 = {
31  .cls = &arm_reg_classes[CLASS_arm_fpa],
32  .limited = arm_limited_fpa_f0,
33  .width = 1,
34 };
35 static const unsigned arm_limited_fpa_f1[] = { (1U << REG_FPA_F1) };
36 const arch_register_req_t arm_single_reg_req_fpa_f1 = {
37  .cls = &arm_reg_classes[CLASS_arm_fpa],
38  .limited = arm_limited_fpa_f1,
39  .width = 1,
40 };
41 static const unsigned arm_limited_fpa_f2[] = { (1U << REG_FPA_F2) };
42 const arch_register_req_t arm_single_reg_req_fpa_f2 = {
43  .cls = &arm_reg_classes[CLASS_arm_fpa],
44  .limited = arm_limited_fpa_f2,
45  .width = 1,
46 };
47 static const unsigned arm_limited_fpa_f3[] = { (1U << REG_FPA_F3) };
48 const arch_register_req_t arm_single_reg_req_fpa_f3 = {
49  .cls = &arm_reg_classes[CLASS_arm_fpa],
50  .limited = arm_limited_fpa_f3,
51  .width = 1,
52 };
53 static const unsigned arm_limited_fpa_f4[] = { (1U << REG_FPA_F4) };
54 const arch_register_req_t arm_single_reg_req_fpa_f4 = {
55  .cls = &arm_reg_classes[CLASS_arm_fpa],
56  .limited = arm_limited_fpa_f4,
57  .width = 1,
58 };
59 static const unsigned arm_limited_fpa_f5[] = { (1U << REG_FPA_F5) };
60 const arch_register_req_t arm_single_reg_req_fpa_f5 = {
61  .cls = &arm_reg_classes[CLASS_arm_fpa],
62  .limited = arm_limited_fpa_f5,
63  .width = 1,
64 };
65 static const unsigned arm_limited_fpa_f6[] = { (1U << REG_FPA_F6) };
66 const arch_register_req_t arm_single_reg_req_fpa_f6 = {
67  .cls = &arm_reg_classes[CLASS_arm_fpa],
68  .limited = arm_limited_fpa_f6,
69  .width = 1,
70 };
71 static const unsigned arm_limited_fpa_f7[] = { (1U << REG_FPA_F7) };
72 const arch_register_req_t arm_single_reg_req_fpa_f7 = {
73  .cls = &arm_reg_classes[CLASS_arm_fpa],
74  .limited = arm_limited_fpa_f7,
75  .width = 1,
76 };
77 const arch_register_req_t arm_class_reg_req_gp = {
78  .cls = &arm_reg_classes[CLASS_arm_gp],
79  .width = 1,
80 };
81 static const unsigned arm_limited_gp_r0[] = { (1U << REG_GP_R0) };
82 const arch_register_req_t arm_single_reg_req_gp_r0 = {
83  .cls = &arm_reg_classes[CLASS_arm_gp],
84  .limited = arm_limited_gp_r0,
85  .width = 1,
86 };
87 static const unsigned arm_limited_gp_r1[] = { (1U << REG_GP_R1) };
88 const arch_register_req_t arm_single_reg_req_gp_r1 = {
89  .cls = &arm_reg_classes[CLASS_arm_gp],
90  .limited = arm_limited_gp_r1,
91  .width = 1,
92 };
93 static const unsigned arm_limited_gp_r2[] = { (1U << REG_GP_R2) };
94 const arch_register_req_t arm_single_reg_req_gp_r2 = {
95  .cls = &arm_reg_classes[CLASS_arm_gp],
96  .limited = arm_limited_gp_r2,
97  .width = 1,
98 };
99 static const unsigned arm_limited_gp_r3[] = { (1U << REG_GP_R3) };
100 const arch_register_req_t arm_single_reg_req_gp_r3 = {
101  .cls = &arm_reg_classes[CLASS_arm_gp],
102  .limited = arm_limited_gp_r3,
103  .width = 1,
104 };
105 static const unsigned arm_limited_gp_r4[] = { (1U << REG_GP_R4) };
106 const arch_register_req_t arm_single_reg_req_gp_r4 = {
107  .cls = &arm_reg_classes[CLASS_arm_gp],
108  .limited = arm_limited_gp_r4,
109  .width = 1,
110 };
111 static const unsigned arm_limited_gp_r5[] = { (1U << REG_GP_R5) };
112 const arch_register_req_t arm_single_reg_req_gp_r5 = {
113  .cls = &arm_reg_classes[CLASS_arm_gp],
114  .limited = arm_limited_gp_r5,
115  .width = 1,
116 };
117 static const unsigned arm_limited_gp_r6[] = { (1U << REG_GP_R6) };
118 const arch_register_req_t arm_single_reg_req_gp_r6 = {
119  .cls = &arm_reg_classes[CLASS_arm_gp],
120  .limited = arm_limited_gp_r6,
121  .width = 1,
122 };
123 static const unsigned arm_limited_gp_r7[] = { (1U << REG_GP_R7) };
124 const arch_register_req_t arm_single_reg_req_gp_r7 = {
125  .cls = &arm_reg_classes[CLASS_arm_gp],
126  .limited = arm_limited_gp_r7,
127  .width = 1,
128 };
129 static const unsigned arm_limited_gp_r8[] = { (1U << REG_GP_R8) };
130 const arch_register_req_t arm_single_reg_req_gp_r8 = {
131  .cls = &arm_reg_classes[CLASS_arm_gp],
132  .limited = arm_limited_gp_r8,
133  .width = 1,
134 };
135 static const unsigned arm_limited_gp_r9[] = { (1U << REG_GP_R9) };
136 const arch_register_req_t arm_single_reg_req_gp_r9 = {
137  .cls = &arm_reg_classes[CLASS_arm_gp],
138  .limited = arm_limited_gp_r9,
139  .width = 1,
140 };
141 static const unsigned arm_limited_gp_r10[] = { (1U << REG_GP_R10) };
142 const arch_register_req_t arm_single_reg_req_gp_r10 = {
143  .cls = &arm_reg_classes[CLASS_arm_gp],
144  .limited = arm_limited_gp_r10,
145  .width = 1,
146 };
147 static const unsigned arm_limited_gp_r11[] = { (1U << REG_GP_R11) };
148 const arch_register_req_t arm_single_reg_req_gp_r11 = {
149  .cls = &arm_reg_classes[CLASS_arm_gp],
150  .limited = arm_limited_gp_r11,
151  .width = 1,
152 };
153 static const unsigned arm_limited_gp_r12[] = { (1U << REG_GP_R12) };
154 const arch_register_req_t arm_single_reg_req_gp_r12 = {
155  .cls = &arm_reg_classes[CLASS_arm_gp],
156  .limited = arm_limited_gp_r12,
157  .width = 1,
158 };
159 static const unsigned arm_limited_gp_sp[] = { (1U << REG_GP_SP) };
160 const arch_register_req_t arm_single_reg_req_gp_sp = {
161  .cls = &arm_reg_classes[CLASS_arm_gp],
162  .limited = arm_limited_gp_sp,
163  .width = 1,
164 };
165 static const unsigned arm_limited_gp_lr[] = { (1U << REG_GP_LR) };
166 const arch_register_req_t arm_single_reg_req_gp_lr = {
167  .cls = &arm_reg_classes[CLASS_arm_gp],
168  .limited = arm_limited_gp_lr,
169  .width = 1,
170 };
171 static const unsigned arm_limited_gp_pc[] = { (1U << REG_GP_PC) };
172 const arch_register_req_t arm_single_reg_req_gp_pc = {
173  .cls = &arm_reg_classes[CLASS_arm_gp],
174  .limited = arm_limited_gp_pc,
175  .width = 1,
176 };
177 
178 
179 arch_register_class_t arm_reg_classes[] = {
180  {
181  .name = "arm_flags",
182  .mode = NULL,
183  .regs = &arm_registers[REG_FL],
184  .class_req = &arm_class_reg_req_flags,
185  .index = CLASS_arm_flags,
186  .n_regs = 1,
187  .manual_ra = true,
188  },
189  {
190  .name = "arm_fpa",
191  .mode = NULL,
192  .regs = &arm_registers[REG_F0],
193  .class_req = &arm_class_reg_req_fpa,
194  .index = CLASS_arm_fpa,
195  .n_regs = 8,
196  .manual_ra = false,
197  },
198  {
199  .name = "arm_gp",
200  .mode = NULL,
201  .regs = &arm_registers[REG_R0],
202  .class_req = &arm_class_reg_req_gp,
203  .index = CLASS_arm_gp,
204  .n_regs = 16,
205  .manual_ra = false,
206  },
207 
208 };
209 
211 const arch_register_t arm_registers[] = {
212  {
213  .name = "fl",
214  .cls = &arm_reg_classes[CLASS_arm_flags],
215  .single_req = &arm_single_reg_req_flags_fl,
216  .index = REG_FLAGS_FL,
217  .global_index = REG_FL,
218  .dwarf_number = 0,
219  .encoding = REG_FLAGS_FL,
220  .is_virtual = false,
221  },
222  {
223  .name = "f0",
224  .cls = &arm_reg_classes[CLASS_arm_fpa],
225  .single_req = &arm_single_reg_req_fpa_f0,
226  .index = REG_FPA_F0,
227  .global_index = REG_F0,
228  .dwarf_number = 96,
229  .encoding = REG_FPA_F0,
230  .is_virtual = false,
231  },
232  {
233  .name = "f1",
234  .cls = &arm_reg_classes[CLASS_arm_fpa],
235  .single_req = &arm_single_reg_req_fpa_f1,
236  .index = REG_FPA_F1,
237  .global_index = REG_F1,
238  .dwarf_number = 97,
239  .encoding = REG_FPA_F1,
240  .is_virtual = false,
241  },
242  {
243  .name = "f2",
244  .cls = &arm_reg_classes[CLASS_arm_fpa],
245  .single_req = &arm_single_reg_req_fpa_f2,
246  .index = REG_FPA_F2,
247  .global_index = REG_F2,
248  .dwarf_number = 98,
249  .encoding = REG_FPA_F2,
250  .is_virtual = false,
251  },
252  {
253  .name = "f3",
254  .cls = &arm_reg_classes[CLASS_arm_fpa],
255  .single_req = &arm_single_reg_req_fpa_f3,
256  .index = REG_FPA_F3,
257  .global_index = REG_F3,
258  .dwarf_number = 99,
259  .encoding = REG_FPA_F3,
260  .is_virtual = false,
261  },
262  {
263  .name = "f4",
264  .cls = &arm_reg_classes[CLASS_arm_fpa],
265  .single_req = &arm_single_reg_req_fpa_f4,
266  .index = REG_FPA_F4,
267  .global_index = REG_F4,
268  .dwarf_number = 100,
269  .encoding = REG_FPA_F4,
270  .is_virtual = false,
271  },
272  {
273  .name = "f5",
274  .cls = &arm_reg_classes[CLASS_arm_fpa],
275  .single_req = &arm_single_reg_req_fpa_f5,
276  .index = REG_FPA_F5,
277  .global_index = REG_F5,
278  .dwarf_number = 101,
279  .encoding = REG_FPA_F5,
280  .is_virtual = false,
281  },
282  {
283  .name = "f6",
284  .cls = &arm_reg_classes[CLASS_arm_fpa],
285  .single_req = &arm_single_reg_req_fpa_f6,
286  .index = REG_FPA_F6,
287  .global_index = REG_F6,
288  .dwarf_number = 102,
289  .encoding = REG_FPA_F6,
290  .is_virtual = false,
291  },
292  {
293  .name = "f7",
294  .cls = &arm_reg_classes[CLASS_arm_fpa],
295  .single_req = &arm_single_reg_req_fpa_f7,
296  .index = REG_FPA_F7,
297  .global_index = REG_F7,
298  .dwarf_number = 103,
299  .encoding = REG_FPA_F7,
300  .is_virtual = false,
301  },
302  {
303  .name = "r0",
304  .cls = &arm_reg_classes[CLASS_arm_gp],
305  .single_req = &arm_single_reg_req_gp_r0,
306  .index = REG_GP_R0,
307  .global_index = REG_R0,
308  .dwarf_number = 0,
309  .encoding = REG_GP_R0,
310  .is_virtual = false,
311  },
312  {
313  .name = "r1",
314  .cls = &arm_reg_classes[CLASS_arm_gp],
315  .single_req = &arm_single_reg_req_gp_r1,
316  .index = REG_GP_R1,
317  .global_index = REG_R1,
318  .dwarf_number = 1,
319  .encoding = REG_GP_R1,
320  .is_virtual = false,
321  },
322  {
323  .name = "r2",
324  .cls = &arm_reg_classes[CLASS_arm_gp],
325  .single_req = &arm_single_reg_req_gp_r2,
326  .index = REG_GP_R2,
327  .global_index = REG_R2,
328  .dwarf_number = 2,
329  .encoding = REG_GP_R2,
330  .is_virtual = false,
331  },
332  {
333  .name = "r3",
334  .cls = &arm_reg_classes[CLASS_arm_gp],
335  .single_req = &arm_single_reg_req_gp_r3,
336  .index = REG_GP_R3,
337  .global_index = REG_R3,
338  .dwarf_number = 3,
339  .encoding = REG_GP_R3,
340  .is_virtual = false,
341  },
342  {
343  .name = "r4",
344  .cls = &arm_reg_classes[CLASS_arm_gp],
345  .single_req = &arm_single_reg_req_gp_r4,
346  .index = REG_GP_R4,
347  .global_index = REG_R4,
348  .dwarf_number = 4,
349  .encoding = REG_GP_R4,
350  .is_virtual = false,
351  },
352  {
353  .name = "r5",
354  .cls = &arm_reg_classes[CLASS_arm_gp],
355  .single_req = &arm_single_reg_req_gp_r5,
356  .index = REG_GP_R5,
357  .global_index = REG_R5,
358  .dwarf_number = 5,
359  .encoding = REG_GP_R5,
360  .is_virtual = false,
361  },
362  {
363  .name = "r6",
364  .cls = &arm_reg_classes[CLASS_arm_gp],
365  .single_req = &arm_single_reg_req_gp_r6,
366  .index = REG_GP_R6,
367  .global_index = REG_R6,
368  .dwarf_number = 6,
369  .encoding = REG_GP_R6,
370  .is_virtual = false,
371  },
372  {
373  .name = "r7",
374  .cls = &arm_reg_classes[CLASS_arm_gp],
375  .single_req = &arm_single_reg_req_gp_r7,
376  .index = REG_GP_R7,
377  .global_index = REG_R7,
378  .dwarf_number = 7,
379  .encoding = REG_GP_R7,
380  .is_virtual = false,
381  },
382  {
383  .name = "r8",
384  .cls = &arm_reg_classes[CLASS_arm_gp],
385  .single_req = &arm_single_reg_req_gp_r8,
386  .index = REG_GP_R8,
387  .global_index = REG_R8,
388  .dwarf_number = 8,
389  .encoding = REG_GP_R8,
390  .is_virtual = false,
391  },
392  {
393  .name = "r9",
394  .cls = &arm_reg_classes[CLASS_arm_gp],
395  .single_req = &arm_single_reg_req_gp_r9,
396  .index = REG_GP_R9,
397  .global_index = REG_R9,
398  .dwarf_number = 9,
399  .encoding = REG_GP_R9,
400  .is_virtual = false,
401  },
402  {
403  .name = "r10",
404  .cls = &arm_reg_classes[CLASS_arm_gp],
405  .single_req = &arm_single_reg_req_gp_r10,
406  .index = REG_GP_R10,
407  .global_index = REG_R10,
408  .dwarf_number = 10,
409  .encoding = REG_GP_R10,
410  .is_virtual = false,
411  },
412  {
413  .name = "r11",
414  .cls = &arm_reg_classes[CLASS_arm_gp],
415  .single_req = &arm_single_reg_req_gp_r11,
416  .index = REG_GP_R11,
417  .global_index = REG_R11,
418  .dwarf_number = 11,
419  .encoding = REG_GP_R11,
420  .is_virtual = false,
421  },
422  {
423  .name = "r12",
424  .cls = &arm_reg_classes[CLASS_arm_gp],
425  .single_req = &arm_single_reg_req_gp_r12,
426  .index = REG_GP_R12,
427  .global_index = REG_R12,
428  .dwarf_number = 12,
429  .encoding = REG_GP_R12,
430  .is_virtual = false,
431  },
432  {
433  .name = "sp",
434  .cls = &arm_reg_classes[CLASS_arm_gp],
435  .single_req = &arm_single_reg_req_gp_sp,
436  .index = REG_GP_SP,
437  .global_index = REG_SP,
438  .dwarf_number = 13,
439  .encoding = REG_GP_SP,
440  .is_virtual = false,
441  },
442  {
443  .name = "lr",
444  .cls = &arm_reg_classes[CLASS_arm_gp],
445  .single_req = &arm_single_reg_req_gp_lr,
446  .index = REG_GP_LR,
447  .global_index = REG_LR,
448  .dwarf_number = 14,
449  .encoding = REG_GP_LR,
450  .is_virtual = false,
451  },
452  {
453  .name = "pc",
454  .cls = &arm_reg_classes[CLASS_arm_gp],
455  .single_req = &arm_single_reg_req_gp_pc,
456  .index = REG_GP_PC,
457  .global_index = REG_PC,
458  .dwarf_number = 15,
459  .encoding = REG_GP_PC,
460  .is_virtual = false,
461  },
462 
463 };
464 
468 void arm_register_init(void)
469 {
470  arm_reg_classes[CLASS_arm_flags].mode = arm_mode_flags;
471  arm_reg_classes[CLASS_arm_fpa].mode = mode_F;
472  arm_reg_classes[CLASS_arm_gp].mode = arm_mode_gp;
473 
474 }
ir_mode * mode_F
ieee754 binary32 float (single precision)
Definition: irmode.h:192