if (arch_irn_consider_in_reg_alloc(arch_env, cls, irn)) {
const arch_register_t *reg = arch_get_irn_register(arch_env, irn);
- live &= ~(1 << reg->index);
+ live &= ~(1 << arch_register_get_index(reg));
}
for (i = 0, n = get_irn_arity(irn); i < n; ++i) {
if (mode_is_float(get_irn_mode(op)) && arch_irn_consider_in_reg_alloc(arch_env, cls, op)) {
const arch_register_t *reg = arch_get_irn_register(arch_env, op);
- live |= 1 << reg->index;
+ live |= 1 << arch_register_get_index(reg);
}
}
return live;
ir_node *irn = be_lv_get_irn(lv, bl, i);
if (arch_irn_consider_in_reg_alloc(env, cls, irn)) {
const arch_register_t *reg = arch_get_irn_register(env, irn);
- live |= 1 << reg->index;
+ live |= 1 << arch_register_get_index(reg);
}
}
} /* vfp_liveness_end_of_block */
/** get the register mask from an arch_register */
-#define REGMASK(reg) (1 << (reg)->index)
+#define REGMASK(reg) (1 << (arch_register_get_index(reg)))
/**
* Return a bitset of argument registers which are live at the end of a node.
op1_idx = x87_on_stack(state, arch_register_get_index(op1));
op2_idx = x87_on_stack(state, arch_register_get_index(op2));
- if (op2->index != REG_VFP_NOREG) {
+ if (arch_register_get_index(op2) != REG_VFP_NOREG) {
/* second operand is a vfp register */
- if (is_vfp_live(op2->index, live)) {
+ if (is_vfp_live(arch_register_get_index(op2), live)) {
/* Second operand is live. */
- if (is_vfp_live(op1->index, live)) {
+ if (is_vfp_live(arch_register_get_index(op1), live)) {
/* Both operands are live: push the first one.
This works even for op1 == op2. */
x87_create_fpush(env, state, n, op2_idx, BINOP_IDX_2);
}
else {
/* Second operand is dead. */
- if (is_vfp_live(op1->index, live)) {
+ if (is_vfp_live(arch_register_get_index(op1), live)) {
/* First operand is live: bring second to tos. */
if (op2_idx != 0) {
x87_create_fxch(state, n, op2_idx, BINOP_IDX_2);
}
else {
/* second operand is an address mode */
- if (is_vfp_live(op1->index, live)) {
+ if (is_vfp_live(arch_register_get_index(op1), live)) {
/* first operand is live: push it here */
x87_create_fpush(env, state, n, op1_idx, BINOP_IDX_1);
}
do_pop = 0;
}
- x87_set_st(state, out->index, x87_patch_insn(n, dst), out_idx);
+ x87_set_st(state, arch_register_get_index(out), x87_patch_insn(n, dst), out_idx);
if (do_pop)
x87_pop(state);
op1_idx = x87_on_stack(state, arch_register_get_index(op1));
- if (is_vfp_live(op1->index, live)) {
+ if (is_vfp_live(arch_register_get_index(op1), live)) {
/* push the operand here */
x87_create_fpush(env, state, n, op1_idx, UNOP_IDX);
}
if (! (mode == mode_E && depth < N_x87_REGS) && op2_idx != 0)
x87_create_fxch(state, n, op2_idx, STORE_VAL_IDX);
- if (is_vfp_live(op2->index, live)) {
+ if (is_vfp_live(arch_register_get_index(op2), live)) {
/*
Problem: fst doesn't support mode_E (spills), only fstp does
Solution:
arch_register_get_name(op1), arch_register_get_name(op2)));
DEBUG_ONLY(vfp_dump_live(live));
- op1_idx = x87_on_stack(state, op1->index);
- op2_idx = x87_on_stack(state, op2->index);
+ op1_idx = x87_on_stack(state, arch_register_get_index(op1));
+ op2_idx = x87_on_stack(state, arch_register_get_index(op2));
/* BEWARE: check for comp a,a cases, they might happen */
- if (op2->index != REG_VFP_NOREG) {
+ if (arch_register_get_index(op2) != REG_VFP_NOREG) {
/* second operand is a vfp register */
- if (is_vfp_live(op2->index, live)) {
+ if (is_vfp_live(arch_register_get_index(op2), live)) {
/* second operand is live */
- if (is_vfp_live(op1->index, live)) {
+ if (is_vfp_live(arch_register_get_index(op1), live)) {
/* both operands are live: move one of them to tos */
if (op2_idx == 0) {
XCHG(op2_idx, op1_idx);
}
else {
/* second operand is dead */
- if (is_vfp_live(op1->index, live)) {
+ if (is_vfp_live(arch_register_get_index(op1), live)) {
/* first operand is live: bring second to tos.
This means further, op1_idx != op2_idx. */
if (op2_idx != 0) {
}
else {
/* second operand is an address mode */
- if (is_vfp_live(op1->index, live)) {
+ if (is_vfp_live(arch_register_get_index(op1), live)) {
/* first operand is live: bring it to TOS */
if (op1_idx != 0) {
x87_create_fxch(state, n, op1_idx, BINOP_IDX_1);
ir_mode *mode = get_irn_mode(n);
if (mode_is_float(mode)) {
- const arch_register_t *op1 = arch_get_irn_register(env, get_irn_n(n, 0));
+ ir_node *pred = get_irn_n(n, 0);
+ ir_op *op = get_irn_op(pred);
const arch_register_t *out = arch_get_irn_register(env, n);
- ir_node *node, *next;
- ia32_attr_t *attr;
- int op1_idx, out_idx;
- unsigned live = vfp_live_args_after(state->sim, n, REGMASK(out));
+ const arch_register_t *op1 = arch_get_irn_register(env, pred);
+ ir_node *node, *next;
+ ia32_attr_t *attr;
+ int op1_idx, out_idx;
+ unsigned live = vfp_live_args_after(state->sim, n, REGMASK(out));
+
+ DB((dbg, LEVEL_1, ">>> %+F %s -> %s\n", n,
+ arch_register_get_name(op1), arch_register_get_name(out)));
+ DEBUG_ONLY(vfp_dump_live(live));
+
+ /* FIXME: check here for all possible constants */
+ if (op == op_ia32_fldz || op == op_ia32_fld1) {
+ /* copy a constant */
+ node = new_rd_ia32_fldz(get_irn_dbg_info(n), get_irn_irg(n), get_nodes_block(n), mode);
+ set_irn_op(node, op);
+ arch_set_irn_register(env, node, out);
+
+ x87_push(state, arch_register_get_index(out), node);
+
+ attr = get_ia32_attr(node);
+ attr->x87[2] = out = &ia32_st_regs[0];
+
+ next = sched_next(n);
+ sched_remove(n);
+ exchange(n, node);
+ sched_add_before(next, node);
+ DB((dbg, LEVEL_1, ">>> %+F -> %s\n", node, arch_register_get_name(out)));
+ return 0;
+ }
/* handle the infamous unknown value */
- if (op1->index == REG_VFP_UKNWN) {
+ if (arch_register_get_index(op1) == REG_VFP_UKNWN) {
/* This happens before Phi nodes */
if (x87_state_is_empty(state)) {
/* create some value */
x87_patch_insn(n, op_ia32_fldz);
attr = get_ia32_attr(n);
attr->x87[2] = out = &ia32_st_regs[0];
- DB((dbg, LEVEL_1, ">>> %+F -> %s\n", n, out->name));
+ DB((dbg, LEVEL_1, "<<< %+F -> %s\n", n,
+ arch_register_get_name(out)));
} else {
/* just copy one */
node = new_rd_ia32_fpush(get_irn_dbg_info(n), get_irn_irg(n), get_nodes_block(n), get_irn_n(n, 0), mode);
sched_remove(n);
exchange(n, node);
sched_add_before(next, node);
- DB((dbg, LEVEL_1, ">>> %+F %s -> %s\n", node, op1->name, out->name));
+ DB((dbg, LEVEL_1, "<<< %+F %s -> %s\n", node,
+ arch_register_get_name(op1),
+ arch_register_get_name(out)));
}
return 0;
}
op1_idx = x87_on_stack(state, arch_register_get_index(op1));
- DB((dbg, LEVEL_1, ">>> %+F %s -> %s\n", n,
- arch_register_get_name(op1), arch_register_get_name(out)));
- DEBUG_ONLY(vfp_dump_live(live));
-
- if (is_vfp_live(op1->index, live)) {
+ if (is_vfp_live(arch_register_get_index(op1), live)) {
/* operand is still live,a real copy */
node = new_rd_ia32_fpush(get_irn_dbg_info(n), get_irn_irg(n), get_nodes_block(n), get_irn_n(n, 0), mode);
arch_set_irn_register(env, node, out);
/* collect old stack positions */
for (i = 0; i < n; ++i) {
const arch_register_t *inreg = arch_get_irn_register(env, get_irn_n(irn, i));
- int idx = x87_on_stack(state, inreg->index);
+ int idx = x87_on_stack(state, arch_register_get_index(inreg));
assert(idx >= 0 && "Perm argument not on x87 stack");
long num = get_Proj_proj(proj);
assert(0 <= num && num < n && "More Proj's than Perm inputs");
- x87_set_st(state, out->index, proj, stack_pos[(unsigned)num]);
+ x87_set_st(state, arch_register_get_index(out), proj, stack_pos[(unsigned)num]);
}
DB((dbg, LEVEL_1, "<<< %+F\n", irn));
ASSOC_IA32(fsub);
ASSOC_IA32(fmul);
ASSOC_IA32(fdiv);
- ASSOC_IA32(fldz);
ASSOC_IA32(fabs);
ASSOC_IA32(fchs);
ASSOC_IA32(fsin);