11 #include "gen_ia32_regalloc_if.h" 13 #include "ia32_bearch_t.h" 15 const arch_register_req_t ia32_class_reg_req_flags = {
16 .cls = &ia32_reg_classes[CLASS_ia32_flags],
19 static const unsigned ia32_limited_flags_eflags[] = { (1U << REG_FLAGS_EFLAGS) };
20 const arch_register_req_t ia32_single_reg_req_flags_eflags = {
21 .cls = &ia32_reg_classes[CLASS_ia32_flags],
22 .limited = ia32_limited_flags_eflags,
25 const arch_register_req_t ia32_class_reg_req_fp = {
26 .cls = &ia32_reg_classes[CLASS_ia32_fp],
29 static const unsigned ia32_limited_fp_st0[] = { (1U << REG_FP_ST0) };
30 const arch_register_req_t ia32_single_reg_req_fp_st0 = {
31 .cls = &ia32_reg_classes[CLASS_ia32_fp],
32 .limited = ia32_limited_fp_st0,
35 static const unsigned ia32_limited_fp_st1[] = { (1U << REG_FP_ST1) };
36 const arch_register_req_t ia32_single_reg_req_fp_st1 = {
37 .cls = &ia32_reg_classes[CLASS_ia32_fp],
38 .limited = ia32_limited_fp_st1,
41 static const unsigned ia32_limited_fp_st2[] = { (1U << REG_FP_ST2) };
42 const arch_register_req_t ia32_single_reg_req_fp_st2 = {
43 .cls = &ia32_reg_classes[CLASS_ia32_fp],
44 .limited = ia32_limited_fp_st2,
47 static const unsigned ia32_limited_fp_st3[] = { (1U << REG_FP_ST3) };
48 const arch_register_req_t ia32_single_reg_req_fp_st3 = {
49 .cls = &ia32_reg_classes[CLASS_ia32_fp],
50 .limited = ia32_limited_fp_st3,
53 static const unsigned ia32_limited_fp_st4[] = { (1U << REG_FP_ST4) };
54 const arch_register_req_t ia32_single_reg_req_fp_st4 = {
55 .cls = &ia32_reg_classes[CLASS_ia32_fp],
56 .limited = ia32_limited_fp_st4,
59 static const unsigned ia32_limited_fp_st5[] = { (1U << REG_FP_ST5) };
60 const arch_register_req_t ia32_single_reg_req_fp_st5 = {
61 .cls = &ia32_reg_classes[CLASS_ia32_fp],
62 .limited = ia32_limited_fp_st5,
65 static const unsigned ia32_limited_fp_st6[] = { (1U << REG_FP_ST6) };
66 const arch_register_req_t ia32_single_reg_req_fp_st6 = {
67 .cls = &ia32_reg_classes[CLASS_ia32_fp],
68 .limited = ia32_limited_fp_st6,
71 static const unsigned ia32_limited_fp_st7[] = { (1U << REG_FP_ST7) };
72 const arch_register_req_t ia32_single_reg_req_fp_st7 = {
73 .cls = &ia32_reg_classes[CLASS_ia32_fp],
74 .limited = ia32_limited_fp_st7,
77 static const unsigned ia32_limited_fp_fp_NOREG[] = { (1U << REG_FP_FP_NOREG) };
78 const arch_register_req_t ia32_single_reg_req_fp_fp_NOREG = {
79 .cls = &ia32_reg_classes[CLASS_ia32_fp],
80 .limited = ia32_limited_fp_fp_NOREG,
83 const arch_register_req_t ia32_class_reg_req_fp_cw = {
84 .cls = &ia32_reg_classes[CLASS_ia32_fp_cw],
87 static const unsigned ia32_limited_fp_cw_fpcw[] = { (1U << REG_FP_CW_FPCW) };
88 const arch_register_req_t ia32_single_reg_req_fp_cw_fpcw = {
89 .cls = &ia32_reg_classes[CLASS_ia32_fp_cw],
90 .limited = ia32_limited_fp_cw_fpcw,
93 const arch_register_req_t ia32_class_reg_req_gp = {
94 .cls = &ia32_reg_classes[CLASS_ia32_gp],
97 static const unsigned ia32_limited_gp_edx[] = { (1U << REG_GP_EDX) };
98 const arch_register_req_t ia32_single_reg_req_gp_edx = {
99 .cls = &ia32_reg_classes[CLASS_ia32_gp],
100 .limited = ia32_limited_gp_edx,
103 static const unsigned ia32_limited_gp_ecx[] = { (1U << REG_GP_ECX) };
104 const arch_register_req_t ia32_single_reg_req_gp_ecx = {
105 .cls = &ia32_reg_classes[CLASS_ia32_gp],
106 .limited = ia32_limited_gp_ecx,
109 static const unsigned ia32_limited_gp_eax[] = { (1U << REG_GP_EAX) };
110 const arch_register_req_t ia32_single_reg_req_gp_eax = {
111 .cls = &ia32_reg_classes[CLASS_ia32_gp],
112 .limited = ia32_limited_gp_eax,
115 static const unsigned ia32_limited_gp_ebx[] = { (1U << REG_GP_EBX) };
116 const arch_register_req_t ia32_single_reg_req_gp_ebx = {
117 .cls = &ia32_reg_classes[CLASS_ia32_gp],
118 .limited = ia32_limited_gp_ebx,
121 static const unsigned ia32_limited_gp_esi[] = { (1U << REG_GP_ESI) };
122 const arch_register_req_t ia32_single_reg_req_gp_esi = {
123 .cls = &ia32_reg_classes[CLASS_ia32_gp],
124 .limited = ia32_limited_gp_esi,
127 static const unsigned ia32_limited_gp_edi[] = { (1U << REG_GP_EDI) };
128 const arch_register_req_t ia32_single_reg_req_gp_edi = {
129 .cls = &ia32_reg_classes[CLASS_ia32_gp],
130 .limited = ia32_limited_gp_edi,
133 static const unsigned ia32_limited_gp_ebp[] = { (1U << REG_GP_EBP) };
134 const arch_register_req_t ia32_single_reg_req_gp_ebp = {
135 .cls = &ia32_reg_classes[CLASS_ia32_gp],
136 .limited = ia32_limited_gp_ebp,
139 static const unsigned ia32_limited_gp_esp[] = { (1U << REG_GP_ESP) };
140 const arch_register_req_t ia32_single_reg_req_gp_esp = {
141 .cls = &ia32_reg_classes[CLASS_ia32_gp],
142 .limited = ia32_limited_gp_esp,
145 static const unsigned ia32_limited_gp_gp_NOREG[] = { (1U << REG_GP_GP_NOREG) };
146 const arch_register_req_t ia32_single_reg_req_gp_gp_NOREG = {
147 .cls = &ia32_reg_classes[CLASS_ia32_gp],
148 .limited = ia32_limited_gp_gp_NOREG,
151 const arch_register_req_t ia32_class_reg_req_xmm = {
152 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
155 static const unsigned ia32_limited_xmm_xmm0[] = { (1U << REG_XMM_XMM0) };
156 const arch_register_req_t ia32_single_reg_req_xmm_xmm0 = {
157 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
158 .limited = ia32_limited_xmm_xmm0,
161 static const unsigned ia32_limited_xmm_xmm1[] = { (1U << REG_XMM_XMM1) };
162 const arch_register_req_t ia32_single_reg_req_xmm_xmm1 = {
163 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
164 .limited = ia32_limited_xmm_xmm1,
167 static const unsigned ia32_limited_xmm_xmm2[] = { (1U << REG_XMM_XMM2) };
168 const arch_register_req_t ia32_single_reg_req_xmm_xmm2 = {
169 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
170 .limited = ia32_limited_xmm_xmm2,
173 static const unsigned ia32_limited_xmm_xmm3[] = { (1U << REG_XMM_XMM3) };
174 const arch_register_req_t ia32_single_reg_req_xmm_xmm3 = {
175 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
176 .limited = ia32_limited_xmm_xmm3,
179 static const unsigned ia32_limited_xmm_xmm4[] = { (1U << REG_XMM_XMM4) };
180 const arch_register_req_t ia32_single_reg_req_xmm_xmm4 = {
181 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
182 .limited = ia32_limited_xmm_xmm4,
185 static const unsigned ia32_limited_xmm_xmm5[] = { (1U << REG_XMM_XMM5) };
186 const arch_register_req_t ia32_single_reg_req_xmm_xmm5 = {
187 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
188 .limited = ia32_limited_xmm_xmm5,
191 static const unsigned ia32_limited_xmm_xmm6[] = { (1U << REG_XMM_XMM6) };
192 const arch_register_req_t ia32_single_reg_req_xmm_xmm6 = {
193 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
194 .limited = ia32_limited_xmm_xmm6,
197 static const unsigned ia32_limited_xmm_xmm7[] = { (1U << REG_XMM_XMM7) };
198 const arch_register_req_t ia32_single_reg_req_xmm_xmm7 = {
199 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
200 .limited = ia32_limited_xmm_xmm7,
203 static const unsigned ia32_limited_xmm_xmm_NOREG[] = { (1U << REG_XMM_XMM_NOREG) };
204 const arch_register_req_t ia32_single_reg_req_xmm_xmm_NOREG = {
205 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
206 .limited = ia32_limited_xmm_xmm_NOREG,
211 arch_register_class_t ia32_reg_classes[] = {
213 .name =
"ia32_flags",
215 .regs = &ia32_registers[REG_EFLAGS],
216 .class_req = &ia32_class_reg_req_flags,
217 .index = CLASS_ia32_flags,
224 .regs = &ia32_registers[REG_ST0],
225 .class_req = &ia32_class_reg_req_fp,
226 .index = CLASS_ia32_fp,
231 .name =
"ia32_fp_cw",
233 .regs = &ia32_registers[REG_FPCW],
234 .class_req = &ia32_class_reg_req_fp_cw,
235 .index = CLASS_ia32_fp_cw,
242 .regs = &ia32_registers[REG_EDX],
243 .class_req = &ia32_class_reg_req_gp,
244 .index = CLASS_ia32_gp,
251 .regs = &ia32_registers[REG_XMM0],
252 .class_req = &ia32_class_reg_req_xmm,
253 .index = CLASS_ia32_xmm,
261 const arch_register_t ia32_registers[] = {
264 .cls = &ia32_reg_classes[CLASS_ia32_flags],
265 .single_req = &ia32_single_reg_req_flags_eflags,
266 .index = REG_FLAGS_EFLAGS,
267 .global_index = REG_EFLAGS,
269 .encoding = REG_FLAGS_EFLAGS,
274 .cls = &ia32_reg_classes[CLASS_ia32_fp],
275 .single_req = &ia32_single_reg_req_fp_st0,
277 .global_index = REG_ST0,
284 .cls = &ia32_reg_classes[CLASS_ia32_fp],
285 .single_req = &ia32_single_reg_req_fp_st1,
287 .global_index = REG_ST1,
294 .cls = &ia32_reg_classes[CLASS_ia32_fp],
295 .single_req = &ia32_single_reg_req_fp_st2,
297 .global_index = REG_ST2,
304 .cls = &ia32_reg_classes[CLASS_ia32_fp],
305 .single_req = &ia32_single_reg_req_fp_st3,
307 .global_index = REG_ST3,
314 .cls = &ia32_reg_classes[CLASS_ia32_fp],
315 .single_req = &ia32_single_reg_req_fp_st4,
317 .global_index = REG_ST4,
324 .cls = &ia32_reg_classes[CLASS_ia32_fp],
325 .single_req = &ia32_single_reg_req_fp_st5,
327 .global_index = REG_ST5,
334 .cls = &ia32_reg_classes[CLASS_ia32_fp],
335 .single_req = &ia32_single_reg_req_fp_st6,
337 .global_index = REG_ST6,
344 .cls = &ia32_reg_classes[CLASS_ia32_fp],
345 .single_req = &ia32_single_reg_req_fp_st7,
347 .global_index = REG_ST7,
354 .cls = &ia32_reg_classes[CLASS_ia32_fp],
355 .single_req = &ia32_single_reg_req_fp_fp_NOREG,
356 .index = REG_FP_FP_NOREG,
357 .global_index = REG_FP_NOREG,
359 .encoding = REG_FP_FP_NOREG,
364 .cls = &ia32_reg_classes[CLASS_ia32_fp_cw],
365 .single_req = &ia32_single_reg_req_fp_cw_fpcw,
366 .index = REG_FP_CW_FPCW,
367 .global_index = REG_FPCW,
369 .encoding = REG_FP_CW_FPCW,
374 .cls = &ia32_reg_classes[CLASS_ia32_gp],
375 .single_req = &ia32_single_reg_req_gp_edx,
377 .global_index = REG_EDX,
384 .cls = &ia32_reg_classes[CLASS_ia32_gp],
385 .single_req = &ia32_single_reg_req_gp_ecx,
387 .global_index = REG_ECX,
394 .cls = &ia32_reg_classes[CLASS_ia32_gp],
395 .single_req = &ia32_single_reg_req_gp_eax,
397 .global_index = REG_EAX,
404 .cls = &ia32_reg_classes[CLASS_ia32_gp],
405 .single_req = &ia32_single_reg_req_gp_ebx,
407 .global_index = REG_EBX,
414 .cls = &ia32_reg_classes[CLASS_ia32_gp],
415 .single_req = &ia32_single_reg_req_gp_esi,
417 .global_index = REG_ESI,
424 .cls = &ia32_reg_classes[CLASS_ia32_gp],
425 .single_req = &ia32_single_reg_req_gp_edi,
427 .global_index = REG_EDI,
434 .cls = &ia32_reg_classes[CLASS_ia32_gp],
435 .single_req = &ia32_single_reg_req_gp_ebp,
437 .global_index = REG_EBP,
444 .cls = &ia32_reg_classes[CLASS_ia32_gp],
445 .single_req = &ia32_single_reg_req_gp_esp,
447 .global_index = REG_ESP,
454 .cls = &ia32_reg_classes[CLASS_ia32_gp],
455 .single_req = &ia32_single_reg_req_gp_gp_NOREG,
456 .index = REG_GP_GP_NOREG,
457 .global_index = REG_GP_NOREG,
459 .encoding = REG_GP_GP_NOREG,
464 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
465 .single_req = &ia32_single_reg_req_xmm_xmm0,
466 .index = REG_XMM_XMM0,
467 .global_index = REG_XMM0,
469 .encoding = REG_XMM_XMM0,
474 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
475 .single_req = &ia32_single_reg_req_xmm_xmm1,
476 .index = REG_XMM_XMM1,
477 .global_index = REG_XMM1,
479 .encoding = REG_XMM_XMM1,
484 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
485 .single_req = &ia32_single_reg_req_xmm_xmm2,
486 .index = REG_XMM_XMM2,
487 .global_index = REG_XMM2,
489 .encoding = REG_XMM_XMM2,
494 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
495 .single_req = &ia32_single_reg_req_xmm_xmm3,
496 .index = REG_XMM_XMM3,
497 .global_index = REG_XMM3,
499 .encoding = REG_XMM_XMM3,
504 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
505 .single_req = &ia32_single_reg_req_xmm_xmm4,
506 .index = REG_XMM_XMM4,
507 .global_index = REG_XMM4,
509 .encoding = REG_XMM_XMM4,
514 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
515 .single_req = &ia32_single_reg_req_xmm_xmm5,
516 .index = REG_XMM_XMM5,
517 .global_index = REG_XMM5,
519 .encoding = REG_XMM_XMM5,
524 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
525 .single_req = &ia32_single_reg_req_xmm_xmm6,
526 .index = REG_XMM_XMM6,
527 .global_index = REG_XMM6,
529 .encoding = REG_XMM_XMM6,
534 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
535 .single_req = &ia32_single_reg_req_xmm_xmm7,
536 .index = REG_XMM_XMM7,
537 .global_index = REG_XMM7,
539 .encoding = REG_XMM_XMM7,
544 .cls = &ia32_reg_classes[CLASS_ia32_xmm],
545 .single_req = &ia32_single_reg_req_xmm_xmm_NOREG,
546 .index = REG_XMM_XMM_NOREG,
547 .global_index = REG_XMM_NOREG,
549 .encoding = REG_XMM_XMM_NOREG,
558 void ia32_register_init(
void)
560 ia32_reg_classes[CLASS_ia32_flags].mode = ia32_mode_flags;
561 ia32_reg_classes[CLASS_ia32_fp].mode = x86_mode_E;
562 ia32_reg_classes[CLASS_ia32_fp_cw].mode = ia32_mode_fpcw;
563 ia32_reg_classes[CLASS_ia32_gp].mode = ia32_mode_gp;
564 ia32_reg_classes[CLASS_ia32_xmm].mode = ia32_mode_float64;