11 #include "gen_ia32_regalloc_if.h"
12 #include "bearch_ia32_t.h"
14 const arch_register_req_t ia32_class_reg_req_flags = {
15 .cls = &ia32_reg_classes[CLASS_ia32_flags],
18 static const unsigned ia32_limited_flags_eflags[] = { (1U << REG_FLAGS_EFLAGS) };
19 const arch_register_req_t ia32_single_reg_req_flags_eflags = {
20 .cls = &ia32_reg_classes[CLASS_ia32_flags],
21 .limited = ia32_limited_flags_eflags,
24 const arch_register_req_t ia32_class_reg_req_fp = {
25 .cls = &ia32_reg_classes[CLASS_ia32_fp],
28 static const unsigned ia32_limited_fp_st0[] = { (1U << REG_FP_ST0) };
29 const arch_register_req_t ia32_single_reg_req_fp_st0 = {
30 .cls = &ia32_reg_classes[CLASS_ia32_fp],
31 .limited = ia32_limited_fp_st0,
34 static const unsigned ia32_limited_fp_st1[] = { (1U << REG_FP_ST1) };
35 const arch_register_req_t ia32_single_reg_req_fp_st1 = {
36 .cls = &ia32_reg_classes[CLASS_ia32_fp],
37 .limited = ia32_limited_fp_st1,
40 static const unsigned ia32_limited_fp_st2[] = { (1U << REG_FP_ST2) };
41 const arch_register_req_t ia32_single_reg_req_fp_st2 = {
42 .cls = &ia32_reg_classes[CLASS_ia32_fp],
43 .limited = ia32_limited_fp_st2,
46 static const unsigned ia32_limited_fp_st3[] = { (1U << REG_FP_ST3) };
47 const arch_register_req_t ia32_single_reg_req_fp_st3 = {
48 .cls = &ia32_reg_classes[CLASS_ia32_fp],
49 .limited = ia32_limited_fp_st3,
52 static const unsigned ia32_limited_fp_st4[] = { (1U << REG_FP_ST4) };
53 const arch_register_req_t ia32_single_reg_req_fp_st4 = {
54 .cls = &ia32_reg_classes[CLASS_ia32_fp],
55 .limited = ia32_limited_fp_st4,
58 static const unsigned ia32_limited_fp_st5[] = { (1U << REG_FP_ST5) };
59 const arch_register_req_t ia32_single_reg_req_fp_st5 = {
60 .cls = &ia32_reg_classes[CLASS_ia32_fp],
61 .limited = ia32_limited_fp_st5,
64 static const unsigned ia32_limited_fp_st6[] = { (1U << REG_FP_ST6) };
65 const arch_register_req_t ia32_single_reg_req_fp_st6 = {
66 .cls = &ia32_reg_classes[CLASS_ia32_fp],
67 .limited = ia32_limited_fp_st6,
70 static const unsigned ia32_limited_fp_st7[] = { (1U << REG_FP_ST7) };
71 const arch_register_req_t ia32_single_reg_req_fp_st7 = {
72 .cls = &ia32_reg_classes[CLASS_ia32_fp],
73 .limited = ia32_limited_fp_st7,
76 static const unsigned ia32_limited_fp_fp_NOREG[] = { (1U << REG_FP_FP_NOREG) };
77 const arch_register_req_t ia32_single_reg_req_fp_fp_NOREG = {
78 .cls = &ia32_reg_classes[CLASS_ia32_fp],
79 .limited = ia32_limited_fp_fp_NOREG,
82 const arch_register_req_t ia32_class_reg_req_fp_cw = {
83 .cls = &ia32_reg_classes[CLASS_ia32_fp_cw],
86 static const unsigned ia32_limited_fp_cw_fpcw[] = { (1U << REG_FP_CW_FPCW) };
87 const arch_register_req_t ia32_single_reg_req_fp_cw_fpcw = {
88 .cls = &ia32_reg_classes[CLASS_ia32_fp_cw],
89 .limited = ia32_limited_fp_cw_fpcw,
92 const arch_register_req_t ia32_class_reg_req_gp = {
93 .cls = &ia32_reg_classes[CLASS_ia32_gp],
96 static const unsigned ia32_limited_gp_edx[] = { (1U << REG_GP_EDX) };
97 const arch_register_req_t ia32_single_reg_req_gp_edx = {
98 .cls = &ia32_reg_classes[CLASS_ia32_gp],
99 .limited = ia32_limited_gp_edx,
102 static const unsigned ia32_limited_gp_ecx[] = { (1U << REG_GP_ECX) };
103 const arch_register_req_t ia32_single_reg_req_gp_ecx = {
104 .cls = &ia32_reg_classes[CLASS_ia32_gp],
105 .limited = ia32_limited_gp_ecx,
108 static const unsigned ia32_limited_gp_eax[] = { (1U << REG_GP_EAX) };
109 const arch_register_req_t ia32_single_reg_req_gp_eax = {
110 .cls = &ia32_reg_classes[CLASS_ia32_gp],
111 .limited = ia32_limited_gp_eax,
114 static const unsigned ia32_limited_gp_ebx[] = { (1U << REG_GP_EBX) };
115 const arch_register_req_t ia32_single_reg_req_gp_ebx = {
116 .cls = &ia32_reg_classes[CLASS_ia32_gp],
117 .limited = ia32_limited_gp_ebx,
120 static const unsigned ia32_limited_gp_esi[] = { (1U << REG_GP_ESI) };
121 const arch_register_req_t ia32_single_reg_req_gp_esi = {
122 .cls = &ia32_reg_classes[CLASS_ia32_gp],
123 .limited = ia32_limited_gp_esi,
126 static const unsigned ia32_limited_gp_edi[] = { (1U << REG_GP_EDI) };
127 const arch_register_req_t ia32_single_reg_req_gp_edi = {
128 .cls = &ia32_reg_classes[CLASS_ia32_gp],
129 .limited = ia32_limited_gp_edi,
132 static const unsigned ia32_limited_gp_ebp[] = { (1U << REG_GP_EBP) };
133 const arch_register_req_t ia32_single_reg_req_gp_ebp = {
134 .cls = &ia32_reg_classes[CLASS_ia32_gp],
135 .limited = ia32_limited_gp_ebp,
138 static const unsigned ia32_limited_gp_esp[] = { (1U << REG_GP_ESP) };
139 const arch_register_req_t ia32_single_reg_req_gp_esp = {
140 .cls = &ia32_reg_classes[CLASS_ia32_gp],
141 .limited = ia32_limited_gp_esp,
144 static const unsigned ia32_limited_gp_gp_NOREG[] = { (1U << REG_GP_GP_NOREG) };
145 const arch_register_req_t ia32_single_reg_req_gp_gp_NOREG = {
146 .cls = &ia32_reg_classes[CLASS_ia32_gp],
147 .limited = ia32_limited_gp_gp_NOREG,
150 const arch_register_req_t ia32_class_reg_req_xmm = {
151 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
154 static const unsigned ia32_limited_xmm_xmm0[] = { (1U << REG_XMM_XMM0) };
155 const arch_register_req_t ia32_single_reg_req_xmm_xmm0 = {
156 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
157 .limited = ia32_limited_xmm_xmm0,
160 static const unsigned ia32_limited_xmm_xmm1[] = { (1U << REG_XMM_XMM1) };
161 const arch_register_req_t ia32_single_reg_req_xmm_xmm1 = {
162 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
163 .limited = ia32_limited_xmm_xmm1,
166 static const unsigned ia32_limited_xmm_xmm2[] = { (1U << REG_XMM_XMM2) };
167 const arch_register_req_t ia32_single_reg_req_xmm_xmm2 = {
168 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
169 .limited = ia32_limited_xmm_xmm2,
172 static const unsigned ia32_limited_xmm_xmm3[] = { (1U << REG_XMM_XMM3) };
173 const arch_register_req_t ia32_single_reg_req_xmm_xmm3 = {
174 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
175 .limited = ia32_limited_xmm_xmm3,
178 static const unsigned ia32_limited_xmm_xmm4[] = { (1U << REG_XMM_XMM4) };
179 const arch_register_req_t ia32_single_reg_req_xmm_xmm4 = {
180 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
181 .limited = ia32_limited_xmm_xmm4,
184 static const unsigned ia32_limited_xmm_xmm5[] = { (1U << REG_XMM_XMM5) };
185 const arch_register_req_t ia32_single_reg_req_xmm_xmm5 = {
186 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
187 .limited = ia32_limited_xmm_xmm5,
190 static const unsigned ia32_limited_xmm_xmm6[] = { (1U << REG_XMM_XMM6) };
191 const arch_register_req_t ia32_single_reg_req_xmm_xmm6 = {
192 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
193 .limited = ia32_limited_xmm_xmm6,
196 static const unsigned ia32_limited_xmm_xmm7[] = { (1U << REG_XMM_XMM7) };
197 const arch_register_req_t ia32_single_reg_req_xmm_xmm7 = {
198 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
199 .limited = ia32_limited_xmm_xmm7,
202 static const unsigned ia32_limited_xmm_xmm_NOREG[] = { (1U << REG_XMM_XMM_NOREG) };
203 const arch_register_req_t ia32_single_reg_req_xmm_xmm_NOREG = {
204 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
205 .limited = ia32_limited_xmm_xmm_NOREG,
210 arch_register_class_t ia32_reg_classes[] = {
212 .name =
"ia32_flags",
214 .regs = &ia32_registers[REG_EFLAGS],
215 .class_req = &ia32_class_reg_req_flags,
216 .index = CLASS_ia32_flags,
223 .regs = &ia32_registers[REG_ST0],
224 .class_req = &ia32_class_reg_req_fp,
225 .index = CLASS_ia32_fp,
230 .name =
"ia32_fp_cw",
232 .regs = &ia32_registers[REG_FPCW],
233 .class_req = &ia32_class_reg_req_fp_cw,
234 .index = CLASS_ia32_fp_cw,
241 .regs = &ia32_registers[REG_EDX],
242 .class_req = &ia32_class_reg_req_gp,
243 .index = CLASS_ia32_gp,
250 .regs = &ia32_registers[REG_XMM0],
251 .class_req = &ia32_class_reg_req_xmm,
252 .index = CLASS_ia32_xmm,
260 const arch_register_t ia32_registers[] = {
263 .cls = &ia32_reg_classes[CLASS_ia32_flags],
264 .single_req = &ia32_single_reg_req_flags_eflags,
265 .index = REG_FLAGS_EFLAGS,
266 .global_index = REG_EFLAGS,
268 .encoding = REG_FLAGS_EFLAGS,
273 .cls = &ia32_reg_classes[CLASS_ia32_fp],
274 .single_req = &ia32_single_reg_req_fp_st0,
276 .global_index = REG_ST0,
283 .cls = &ia32_reg_classes[CLASS_ia32_fp],
284 .single_req = &ia32_single_reg_req_fp_st1,
286 .global_index = REG_ST1,
293 .cls = &ia32_reg_classes[CLASS_ia32_fp],
294 .single_req = &ia32_single_reg_req_fp_st2,
296 .global_index = REG_ST2,
303 .cls = &ia32_reg_classes[CLASS_ia32_fp],
304 .single_req = &ia32_single_reg_req_fp_st3,
306 .global_index = REG_ST3,
313 .cls = &ia32_reg_classes[CLASS_ia32_fp],
314 .single_req = &ia32_single_reg_req_fp_st4,
316 .global_index = REG_ST4,
323 .cls = &ia32_reg_classes[CLASS_ia32_fp],
324 .single_req = &ia32_single_reg_req_fp_st5,
326 .global_index = REG_ST5,
333 .cls = &ia32_reg_classes[CLASS_ia32_fp],
334 .single_req = &ia32_single_reg_req_fp_st6,
336 .global_index = REG_ST6,
343 .cls = &ia32_reg_classes[CLASS_ia32_fp],
344 .single_req = &ia32_single_reg_req_fp_st7,
346 .global_index = REG_ST7,
353 .cls = &ia32_reg_classes[CLASS_ia32_fp],
354 .single_req = &ia32_single_reg_req_fp_fp_NOREG,
355 .index = REG_FP_FP_NOREG,
356 .global_index = REG_FP_NOREG,
358 .encoding = REG_FP_FP_NOREG,
363 .cls = &ia32_reg_classes[CLASS_ia32_fp_cw],
364 .single_req = &ia32_single_reg_req_fp_cw_fpcw,
365 .index = REG_FP_CW_FPCW,
366 .global_index = REG_FPCW,
368 .encoding = REG_FP_CW_FPCW,
373 .cls = &ia32_reg_classes[CLASS_ia32_gp],
374 .single_req = &ia32_single_reg_req_gp_edx,
376 .global_index = REG_EDX,
383 .cls = &ia32_reg_classes[CLASS_ia32_gp],
384 .single_req = &ia32_single_reg_req_gp_ecx,
386 .global_index = REG_ECX,
393 .cls = &ia32_reg_classes[CLASS_ia32_gp],
394 .single_req = &ia32_single_reg_req_gp_eax,
396 .global_index = REG_EAX,
403 .cls = &ia32_reg_classes[CLASS_ia32_gp],
404 .single_req = &ia32_single_reg_req_gp_ebx,
406 .global_index = REG_EBX,
413 .cls = &ia32_reg_classes[CLASS_ia32_gp],
414 .single_req = &ia32_single_reg_req_gp_esi,
416 .global_index = REG_ESI,
423 .cls = &ia32_reg_classes[CLASS_ia32_gp],
424 .single_req = &ia32_single_reg_req_gp_edi,
426 .global_index = REG_EDI,
433 .cls = &ia32_reg_classes[CLASS_ia32_gp],
434 .single_req = &ia32_single_reg_req_gp_ebp,
436 .global_index = REG_EBP,
443 .cls = &ia32_reg_classes[CLASS_ia32_gp],
444 .single_req = &ia32_single_reg_req_gp_esp,
446 .global_index = REG_ESP,
453 .cls = &ia32_reg_classes[CLASS_ia32_gp],
454 .single_req = &ia32_single_reg_req_gp_gp_NOREG,
455 .index = REG_GP_GP_NOREG,
456 .global_index = REG_GP_NOREG,
458 .encoding = REG_GP_GP_NOREG,
463 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
464 .single_req = &ia32_single_reg_req_xmm_xmm0,
465 .index = REG_XMM_XMM0,
466 .global_index = REG_XMM0,
468 .encoding = REG_XMM_XMM0,
473 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
474 .single_req = &ia32_single_reg_req_xmm_xmm1,
475 .index = REG_XMM_XMM1,
476 .global_index = REG_XMM1,
478 .encoding = REG_XMM_XMM1,
483 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
484 .single_req = &ia32_single_reg_req_xmm_xmm2,
485 .index = REG_XMM_XMM2,
486 .global_index = REG_XMM2,
488 .encoding = REG_XMM_XMM2,
493 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
494 .single_req = &ia32_single_reg_req_xmm_xmm3,
495 .index = REG_XMM_XMM3,
496 .global_index = REG_XMM3,
498 .encoding = REG_XMM_XMM3,
503 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
504 .single_req = &ia32_single_reg_req_xmm_xmm4,
505 .index = REG_XMM_XMM4,
506 .global_index = REG_XMM4,
508 .encoding = REG_XMM_XMM4,
513 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
514 .single_req = &ia32_single_reg_req_xmm_xmm5,
515 .index = REG_XMM_XMM5,
516 .global_index = REG_XMM5,
518 .encoding = REG_XMM_XMM5,
523 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
524 .single_req = &ia32_single_reg_req_xmm_xmm6,
525 .index = REG_XMM_XMM6,
526 .global_index = REG_XMM6,
528 .encoding = REG_XMM_XMM6,
533 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
534 .single_req = &ia32_single_reg_req_xmm_xmm7,
535 .index = REG_XMM_XMM7,
536 .global_index = REG_XMM7,
538 .encoding = REG_XMM_XMM7,
543 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
544 .single_req = &ia32_single_reg_req_xmm_xmm_NOREG,
545 .index = REG_XMM_XMM_NOREG,
546 .global_index = REG_XMM_NOREG,
548 .encoding = REG_XMM_XMM_NOREG,
557 void ia32_register_init(
void)
559 ia32_reg_classes[CLASS_ia32_flags].mode = ia32_mode_flags;
560 ia32_reg_classes[CLASS_ia32_fp].mode = x86_mode_E;
561 ia32_reg_classes[CLASS_ia32_fp_cw].mode = ia32_mode_fpcw;
562 ia32_reg_classes[CLASS_ia32_gp].mode = ia32_mode_gp;
563 ia32_reg_classes[CLASS_ia32_xmm].mode = ia32_mode_float64;