Commit ba1458da authored by Matthias Braun's avatar Matthias Braun
Browse files

fix cmov AM bug, avoid some verify warning in beflags code

[r16025]
parent 0759b47f
......@@ -57,6 +57,7 @@ static const arch_env_t *arch_env = NULL;
static const arch_register_class_t *flag_class = NULL;
static const arch_register_t *flags_reg = NULL;
static func_rematerialize remat = NULL;
static int changed;
static ir_node *default_remat(ir_node *node, ir_node *after)
{
......@@ -141,7 +142,8 @@ static void rematerialize_or_move(ir_node *flags_needed, ir_node *node,
return;
}
copy = remat(flags_needed, node);
changed = 1;
copy = remat(flags_needed, node);
if(get_irn_mode(copy) == mode_T) {
ir_node *block = get_nodes_block(copy);
......@@ -284,10 +286,15 @@ void be_sched_fix_flags(be_irg_t *birg, const arch_register_class_t *flag_cls,
flag_class = flag_cls;
flags_reg = & flag_class->regs[0];
remat = remat_func;
changed = 0;
if(remat == NULL)
remat = &default_remat;
set_using_irn_link(irg);
irg_block_walk_graph(irg, fix_flags_walker, NULL, NULL);
clear_using_irn_link(irg);
if(changed) {
be_remove_dead_nodes_from_schedule(birg);
}
}
......@@ -285,7 +285,9 @@ void ia32_emit_mode_suffix(const ir_node *node)
void ia32_emit_x87_mode_suffix(const ir_node *node)
{
ir_mode *mode = get_ia32_ls_mode(node);
if(mode != NULL)
assert(mode != NULL);
/* we only need to emit the mode on address mode */
if(get_ia32_op_type(node) != ia32_Normal)
ia32_emit_mode_suffix_mode(mode);
}
......
......@@ -585,7 +585,8 @@ typedef enum {
match_no_am = 1 << 2,
match_8_bit_am = 1 << 3,
match_16_bit_am = 1 << 4,
match_no_immediate = 1 << 5
match_no_immediate = 1 << 5,
match_force_32bit_op = 1 << 6
} match_flags_t;
static void match_arguments(ia32_address_mode_t *am, ir_node *block,
......@@ -652,7 +653,11 @@ static void match_arguments(ia32_address_mode_t *am, ir_node *block,
if(new_op2 == NULL)
new_op2 = be_transform_node(op2);
am->op_type = ia32_Normal;
am->ls_mode = get_irn_mode(op2);
if(flags & match_force_32bit_op) {
am->ls_mode = mode_Iu;
} else {
am->ls_mode = get_irn_mode(op2);
}
}
if(addr->base == NULL)
addr->base = noreg_gp;
......@@ -708,7 +713,7 @@ static ir_node *gen_binop(ir_node *node, ir_node *op1, ir_node *op2,
ir_node *new_node;
ia32_address_mode_t am;
ia32_address_t *addr = &am.addr;
match_flags_t flags = 0;
match_flags_t flags = match_force_32bit_op;
if(commutative)
flags |= match_commutative;
......@@ -2340,7 +2345,8 @@ static ir_node *create_CMov(ir_node *node, ir_node *new_flags, pn_Cmp pnc)
ia32_address_mode_t am;
ia32_address_t *addr = &am.addr;
match_flags = match_commutative | match_no_immediate | match_16_bit_am;
match_flags = match_commutative | match_no_immediate | match_16_bit_am
| match_force_32bit_op;
match_arguments(&am, block, val_false, val_true, match_flags);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment