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