#include "../belive_t.h"
#include "../besched.h"
-#include "../benode_t.h"
+#include "../benode.h"
#include "bearch_ia32_t.h"
#include "ia32_new_nodes.h"
#include "gen_ia32_new_nodes.h"
int op2_idx = -1;
ia32_x87_attr_t *attr = get_ia32_x87_attr(n);
ir_op *dst;
- x87_simulator *sim = state->sim;
- ir_node *op1_node = get_irn_n(n, n_ia32_vFucomFnstsw_left);
- ir_node *op2_node = get_irn_n(n, n_ia32_vFucomFnstsw_right);
- const arch_register_t *op1 = x87_get_irn_register(op1_node);
- const arch_register_t *op2 = x87_get_irn_register(op2_node);
+ x87_simulator *sim = state->sim;
+ ir_node *op1_node = get_irn_n(n, n_ia32_vFucomFnstsw_left);
+ ir_node *op2_node = get_irn_n(n, n_ia32_vFucomFnstsw_right);
+ const arch_register_t *op1 = x87_get_irn_register(op1_node);
+ const arch_register_t *op2 = x87_get_irn_register(op2_node);
int reg_index_1 = arch_register_get_index(op1);
- int reg_index_2 = arch_register_get_index(op2);
- unsigned live = vfp_live_args_after(sim, n, 0);
- int permuted = attr->attr.data.ins_permuted;
- int xchg = 0;
- int pops = 0;
+ int reg_index_2 = arch_register_get_index(op2);
+ unsigned live = vfp_live_args_after(sim, n, 0);
+ bool permuted = attr->attr.data.ins_permuted;
+ bool xchg = false;
+ int pops = 0;
DB((dbg, LEVEL_1, ">>> %+F %s, %s\n", n,
arch_register_get_name(op1), arch_register_get_name(op2)));
} else if (op2_idx == 0) {
/* res = op X tos */
permuted = !permuted;
- xchg = 1;
+ xchg = true;
} else {
/* bring the first one to tos */
x87_create_fxch(state, n, op1_idx);
- if (op2_idx == 0)
+ if (op1_idx == op2_idx) {
+ op2_idx = 0;
+ } else if (op2_idx == 0) {
op2_idx = op1_idx;
+ }
op1_idx = 0;
/* res = tos X op */
}
op2_idx = 0;
}
/* res = op X tos, pop */
- pops = 1;
+ pops = 1;
permuted = !permuted;
- xchg = 1;
+ xchg = true;
} else {
/* both operands are dead here, check first for identity. */
if (op1_idx == op2_idx) {
}
/* res = op X tos, pop, pop */
permuted = !permuted;
- xchg = 1;
- pops = 2;
+ xchg = true;
+ pops = 2;
} else {
/* if one is already the TOS, we need two fxch */
if (op1_idx == 0) {
x87_create_fxch(state, n, op2_idx);
op2_idx = 0;
/* res = op X tos, pop, pop */
- pops = 2;
+ pops = 2;
permuted = !permuted;
- xchg = 1;
+ xchg = true;
} else if (op2_idx == 0) {
/* second one is TOS, move to st(1) */
x87_create_fxch(state, n, 1);
*/
static void keep_float_node_alive(ir_node *node)
{
- ir_node *block = get_nodes_block(node);
- const arch_register_class_t *cls = arch_get_irn_reg_class_out(node);
- ir_node *keep;
-
- keep = be_new_Keep(cls, block, 1, &node);
+ ir_node *block = get_nodes_block(node);
+ ir_node *keep = be_new_Keep(block, 1, &node);
assert(sched_is_scheduled(node));
sched_add_after(node, keep);
-} /* keep_float_node_alive */
+}
/**
* Create a copy of a node. Recreate the node if it's a constant.