+2012-11-09 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR tree-optimization/55154
+ * lra-int.h (LRA_LOSER_COST_FACTOR, LRA_MAX_REJECT): New macros.
+ * lra.c (setup_operand_alternative): Use them.
+ * lra-constraints.c (LOSER_COST_FACTOR, MAX_OVERALL_COST_BOUND):
+ Remove.
+ (process_alt_operands): Use LRA_LOSER_COST_FACTOR and
+ LRA_MAX_REJECT. Accumulate reject instead of setting for
+ non-const.
+ (curr_insn_transform): Initialize best_losers and best_overall by
+ INT_MAX.
+
2012-11-09 Christian Bruel <christian.bruel@st.com>
* config/sh/sh.c (sh_can_use_simple_return_p): Enable with
* config/i386/i386.c (release_scratch_register_on_entry): Also adjust
sp_offset manually.
->>>>>>> .r193360
2012-11-08 Christian Bruel <christian.bruel@st.com>
* tree-ssa-tail-merge.c (replace_block_by): Update bb2 profile count.
return CONSTANT_P (x) && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (x));
}
-/* Cost factor for each additional reload and maximal cost bound for
- insn reloads. One might ask about such strange numbers. Their
- values occurred historically from former reload pass. */
-#define LOSER_COST_FACTOR 6
-#define MAX_OVERALL_COST_BOUND 600
-
/* Major function to choose the current insn alternative and what
operands should be reloaded and how. If ONLY_ALTERNATIVE is not
negative we should consider only this alternative. Return false if
badop = false;
this_alternative = curr_alt[m];
COPY_HARD_REG_SET (this_alternative_set, curr_alt_set[m]);
+ winreg = this_alternative != NO_REGS;
break;
}
might cost something but probably less than old
reload pass believes. */
if (lra_former_scratch_p (REGNO (operand_reg[nop])))
- reject += LOSER_COST_FACTOR;
+ reject += LRA_LOSER_COST_FACTOR;
}
}
else if (did_match)
&& no_input_reloads_p && ! const_to_mem))
goto fail;
- /* If we can't reload this value at all, reject this
- alternative. Note that we could also lose due to
- LIMIT_RELOAD_CLASS, but we don't check that here. */
- if (! CONSTANT_P (op) && ! no_regs_p)
- {
- if (targetm.preferred_reload_class
- (op, this_alternative) == NO_REGS)
- reject = MAX_OVERALL_COST_BOUND;
-
- if (curr_static_id->operand[nop].type == OP_OUT
- && (targetm.preferred_output_reload_class
- (op, this_alternative) == NO_REGS))
- reject = MAX_OVERALL_COST_BOUND;
- }
+ /* Check strong discouragement of reload of non-constant
+ into class THIS_ALTERNATIVE. */
+ if (! CONSTANT_P (op) && ! no_regs_p
+ && (targetm.preferred_reload_class
+ (op, this_alternative) == NO_REGS
+ || (curr_static_id->operand[nop].type == OP_OUT
+ && (targetm.preferred_output_reload_class
+ (op, this_alternative) == NO_REGS))))
+ reject += LRA_MAX_REJECT;
if (! ((const_to_mem && constmemok)
|| (MEM_P (op) && offmemok)))
Should we update the cost (may be approximately) here
because of early clobber register reloads or it is a rare
or non-important thing to be worth to do it. */
- overall = losers * LOSER_COST_FACTOR + reject;
+ overall = losers * LRA_LOSER_COST_FACTOR + reject;
if ((best_losers == 0 || losers != 0) && best_overall < overall)
goto fail;
{
curr_alt_match_win[j] = false;
losers++;
- overall += LOSER_COST_FACTOR;
+ overall += LRA_LOSER_COST_FACTOR;
}
if (! curr_alt_match_win[i])
curr_alt_dont_inherit_ops[curr_alt_dont_inherit_ops_num++] = i;
}
curr_alt_win[i] = curr_alt_match_win[i] = false;
losers++;
- overall += LOSER_COST_FACTOR;
+ overall += LRA_LOSER_COST_FACTOR;
}
small_class_operands_num = 0;
for (nop = 0; nop < n_operands; nop++)
the wrong kind of hard reg. For this, we must consider all the
operands together against the register constraints. */
- best_losers = best_overall = MAX_RECOG_OPERANDS * 2 + MAX_OVERALL_COST_BOUND;
+ best_losers = best_overall = INT_MAX;
best_small_class_operands_num = best_reload_sum = 0;
curr_swapped = false;