Commit c2dbc1be authored by Christoph Mallon's avatar Christoph Mallon
Browse files

beflags, ia32: Use the correct Proj num of the new flags producer.

Also remove the nonsensical parameter pn, which is the Proj num of the old flags producer, from the try_replace callback.
parent e69f71ef
...@@ -58,12 +58,11 @@ static bool default_check_modifies(const ir_node *node) ...@@ -58,12 +58,11 @@ static bool default_check_modifies(const ir_node *node)
return arch_irn_is(node, modify_flags); return arch_irn_is(node, modify_flags);
} }
static bool default_try_replace(ir_node *consumers, ir_node *flags, ir_node *available, unsigned pn) static bool default_try_replace(ir_node *consumers, ir_node *flags, ir_node *available)
{ {
(void)consumers; (void)consumers;
(void)flags; (void)flags;
(void)available; (void)available;
(void)pn;
return false; return false;
} }
...@@ -152,10 +151,8 @@ static bool rematerialize_or_move(ir_node *flags_needed, ir_node *node, ...@@ -152,10 +151,8 @@ static bool rematerialize_or_move(ir_node *flags_needed, ir_node *node,
} }
/* Try to use the flags available at this point. */ /* Try to use the flags available at this point. */
if (available_flags != NULL && if (available_flags && try_replace(flag_consumers, flags_needed, available_flags))
try_replace(flag_consumers, flags_needed, available_flags, pn)) {
return true; return true;
}
changed = true; changed = true;
ir_node *copy = remat(flags_needed, node); ir_node *copy = remat(flags_needed, node);
......
...@@ -27,7 +27,7 @@ typedef bool (*check_modifies_flags) (const ir_node *node); ...@@ -27,7 +27,7 @@ typedef bool (*check_modifies_flags) (const ir_node *node);
* Callback function that checks whether consumers can use the * Callback function that checks whether consumers can use the
* available flags instead of their original ones. * available flags instead of their original ones.
*/ */
typedef bool (*try_replace_flags) (ir_node *consumers, ir_node *flags_needed, ir_node *available_flags, unsigned pn); typedef bool (*try_replace_flags) (ir_node *consumers, ir_node *flags_needed, ir_node *available_flags);
/** /**
* Walks the schedule and ensures that flags aren't destroyed between producer * Walks the schedule and ensures that flags aren't destroyed between producer
......
...@@ -555,13 +555,18 @@ COMPILETIME_ASSERT((int)(n_ia32_Sub_minuend) == (int)(n_ia32_Cmp_left) && ...@@ -555,13 +555,18 @@ COMPILETIME_ASSERT((int)(n_ia32_Sub_minuend) == (int)(n_ia32_Cmp_left) &&
(int)(n_ia32_Sub_subtrahend) == (int)(n_ia32_Cmp_right), (int)(n_ia32_Sub_subtrahend) == (int)(n_ia32_Cmp_right),
Cmp_and_Sub_operand_numbers_equal) Cmp_and_Sub_operand_numbers_equal)
static bool ia32_try_replace_flags(ir_node *consumers, ir_node *flags, ir_node *available, unsigned pn) static bool ia32_try_replace_flags(ir_node *consumers, ir_node *flags, ir_node *available)
{ {
if (!is_ia32_Sub(flags) && !is_ia32_Cmp(flags)) if (!is_ia32_Sub(flags) && !is_ia32_Cmp(flags))
return false; return false;
if (!is_ia32_Sub(available) && !is_ia32_Cmp(available)) unsigned pn;
if (is_ia32_Sub(available)) {
pn = pn_ia32_Sub_flags;
} else if (is_ia32_Cmp(available)) {
pn = pn_ia32_Cmp_eflags;
} else {
return false; return false;
}
/* Assuming CSE would have found the more obvious case */ /* Assuming CSE would have found the more obvious case */
ir_node *const flags_left = get_irn_n(flags, n_ia32_binary_left); ir_node *const flags_left = get_irn_n(flags, n_ia32_binary_left);
ir_node *const avail_right = get_irn_n(available, n_ia32_binary_right); ir_node *const avail_right = get_irn_n(available, n_ia32_binary_right);
......
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