/* Number of necessary reloads and overall cost reflecting the
previous value and other unpleasantness of the best alternative. */
static int best_losers, best_overall;
-/* Number of small register classes used for operands of the best
- alternative. */
-static int best_small_class_operands_num;
/* Overall number hard registers used for reloads. For example, on
some targets we need 2 general registers to reload DFmode and only
one floating point register. */
process_alt_operands (int only_alternative)
{
bool ok_p = false;
- int nop, small_class_operands_num, overall, nalt;
+ int nop, overall, nalt;
int n_alternatives = curr_static_id->n_alternatives;
int n_operands = curr_static_id->n_operands;
/* LOSERS counts the operands that don't fit this alternative and
if (only_alternative >= 0 && nalt != only_alternative)
continue;
+
overall = losers = reject = reload_nregs = reload_sum = 0;
for (nop = 0; nop < n_operands; nop++)
reject += (curr_static_id
if (! no_regs_p)
reload_nregs
+= ira_reg_class_max_nregs[this_alternative][mode];
+
+ if (SMALL_REGISTER_CLASS_P (this_alternative))
+ reject += LRA_LOSER_COST_FACTOR / 2;
}
/* We are trying to spill pseudo into memory. It is
reloads. */
if (!REG_P (op) || curr_static_id->operand[nop].type != OP_IN)
reject++;
+
}
if (early_clobber_p)
overall += LRA_LOSER_COST_FACTOR - 1;
}
}
- small_class_operands_num = 0;
- for (nop = 0; nop < n_operands; nop++)
- small_class_operands_num
- += SMALL_REGISTER_CLASS_P (curr_alt[nop]) ? 1 : 0;
-
if (lra_dump_file != NULL)
- fprintf (lra_dump_file, " alt=%d,overall=%d,losers=%d,"
- "small_class_ops=%d,rld_nregs=%d\n",
- nalt, overall, losers, small_class_operands_num, reload_nregs);
+ fprintf (lra_dump_file, " alt=%d,overall=%d,losers=%d,rld_nregs=%d\n",
+ nalt, overall, losers, reload_nregs);
/* If this alternative can be made to work by reloading, and it
needs less reloading than the others checked so far, record
|| (best_overall == overall
/* If the cost of the reloads is the same,
prefer alternative which requires minimal
- number of small register classes for the
- operands. This improves chances of reloads
- for insn requiring small register
- classes. */
- && (small_class_operands_num
- < best_small_class_operands_num
- || (small_class_operands_num
- == best_small_class_operands_num
- && (reload_nregs < best_reload_nregs
- || (reload_nregs == best_reload_nregs
- && best_reload_sum < reload_sum))))))))
+ number of reload regs. */
+ && (reload_nregs < best_reload_nregs
+ || (reload_nregs == best_reload_nregs
+ && best_reload_sum < reload_sum))))))
{
for (nop = 0; nop < n_operands; nop++)
{
goal_alt_swapped = curr_swapped;
best_overall = overall;
best_losers = losers;
- best_small_class_operands_num = small_class_operands_num;
best_reload_nregs = reload_nregs;
best_reload_sum = reload_sum;
goal_alt_number = nalt;
operands together against the register constraints. */
best_losers = best_overall = INT_MAX;
- best_small_class_operands_num = best_reload_sum = 0;
+ best_reload_sum = 0;
curr_swapped = false;
goal_alt_swapped = false;
for (; *p != '\0' && *p != ',' && *p != '#'; p++)
fputc (*p, lra_dump_file);
}
- fprintf (lra_dump_file, "\n");
+ if (INSN_CODE (curr_insn) >= 0
+ && (p = get_insn_name (INSN_CODE (curr_insn))) != NULL)
+ fprintf (lra_dump_file, " {%s}", p);
+ fprintf (lra_dump_file, "\n");
}
/* Right now, for any pair of operands I and J that are required to