Commit dab67d2c by Richard Sandiford Committed by Richard Sandiford

PR rtl-optimization/63340 (part 2)

gcc/
	PR rtl-optimization/63340 (part 2)
	* rtl.h (invalid_mode_change_p): Delete.
	(valid_mode_changes_for_regno): New function.
	* reginfo.c (invalid_mode_change_p): Delete.
	(valid_mode_changes_for_regno): New function.
	* ira-costs.c (setup_regno_cost_classes_by_aclass): Restrict the
	classes to registers that are allowed by valid_mode_changes_for_regno.
	(setup_regno_cost_classes_by_mode): Likewise.
	(print_allocno_costs): Remove invalid_mode_change_p test.
	(print_pseudo_costs, find_costs_and_classes): Likewise.

From-SVN: r216829
parent cbfb1548
2014-10-29 Richard Sandiford <richard.sandiford@arm.com> 2014-10-29 Richard Sandiford <richard.sandiford@arm.com>
PR rtl-optimization/63340 (part 2)
* rtl.h (invalid_mode_change_p): Delete.
(valid_mode_changes_for_regno): New function.
* reginfo.c (invalid_mode_change_p): Delete.
(valid_mode_changes_for_regno): New function.
* ira-costs.c (setup_regno_cost_classes_by_aclass): Restrict the
classes to registers that are allowed by valid_mode_changes_for_regno.
(setup_regno_cost_classes_by_mode): Likewise.
(print_allocno_costs): Remove invalid_mode_change_p test.
(print_pseudo_costs, find_costs_and_classes): Likewise.
2014-10-29 Richard Sandiford <richard.sandiford@arm.com>
PR rtl-optimization/63340 (part 1) PR rtl-optimization/63340 (part 1)
* ira-costs.c (all_cost_classes): New variable. * ira-costs.c (all_cost_classes): New variable.
(complete_cost_classes): New function, split out from... (complete_cost_classes): New function, split out from...
...@@ -387,12 +387,18 @@ setup_regno_cost_classes_by_aclass (int regno, enum reg_class aclass) ...@@ -387,12 +387,18 @@ setup_regno_cost_classes_by_aclass (int regno, enum reg_class aclass)
classes_ptr = cost_classes_aclass_cache[aclass] = (cost_classes_t) *slot; classes_ptr = cost_classes_aclass_cache[aclass] = (cost_classes_t) *slot;
} }
if (regno_reg_rtx[regno] != NULL_RTX) if (regno_reg_rtx[regno] != NULL_RTX)
/* Restrict the classes to those that are valid for REGNO's mode {
(which might for example exclude singleton classes if the mode requires /* Restrict the classes to those that are valid for REGNO's mode
two registers). */ (which might for example exclude singleton classes if the mode
classes_ptr = restrict_cost_classes (classes_ptr, requires two registers). Also restrict the classes to those that
PSEUDO_REGNO_MODE (regno), are valid for subregs of REGNO. */
reg_class_contents[ALL_REGS]); const HARD_REG_SET *valid_regs = valid_mode_changes_for_regno (regno);
if (!valid_regs)
valid_regs = &reg_class_contents[ALL_REGS];
classes_ptr = restrict_cost_classes (classes_ptr,
PSEUDO_REGNO_MODE (regno),
*valid_regs);
}
regno_cost_classes[regno] = classes_ptr; regno_cost_classes[regno] = classes_ptr;
} }
...@@ -405,11 +411,17 @@ setup_regno_cost_classes_by_aclass (int regno, enum reg_class aclass) ...@@ -405,11 +411,17 @@ setup_regno_cost_classes_by_aclass (int regno, enum reg_class aclass)
static void static void
setup_regno_cost_classes_by_mode (int regno, enum machine_mode mode) setup_regno_cost_classes_by_mode (int regno, enum machine_mode mode)
{ {
if (cost_classes_mode_cache[mode] == NULL) if (const HARD_REG_SET *valid_regs = valid_mode_changes_for_regno (regno))
cost_classes_mode_cache[mode] regno_cost_classes[regno] = restrict_cost_classes (&all_cost_classes,
= restrict_cost_classes (&all_cost_classes, mode, mode, *valid_regs);
reg_class_contents[ALL_REGS]); else
regno_cost_classes[regno] = cost_classes_mode_cache[mode]; {
if (cost_classes_mode_cache[mode] == NULL)
cost_classes_mode_cache[mode]
= restrict_cost_classes (&all_cost_classes, mode,
reg_class_contents[ALL_REGS]);
regno_cost_classes[regno] = cost_classes_mode_cache[mode];
}
} }
/* Finalize info about the cost classes for each pseudo. */ /* Finalize info about the cost classes for each pseudo. */
...@@ -1536,14 +1548,11 @@ print_allocno_costs (FILE *f) ...@@ -1536,14 +1548,11 @@ print_allocno_costs (FILE *f)
for (k = 0; k < cost_classes_ptr->num; k++) for (k = 0; k < cost_classes_ptr->num; k++)
{ {
rclass = cost_classes[k]; rclass = cost_classes[k];
if (! invalid_mode_change_p (regno, (enum reg_class) rclass)) fprintf (f, " %s:%d", reg_class_names[rclass],
{ COSTS (costs, i)->cost[k]);
fprintf (f, " %s:%d", reg_class_names[rclass], if (flag_ira_region == IRA_REGION_ALL
COSTS (costs, i)->cost[k]); || flag_ira_region == IRA_REGION_MIXED)
if (flag_ira_region == IRA_REGION_ALL fprintf (f, ",%d", COSTS (total_allocno_costs, i)->cost[k]);
|| flag_ira_region == IRA_REGION_MIXED)
fprintf (f, ",%d", COSTS (total_allocno_costs, i)->cost[k]);
}
} }
fprintf (f, " MEM:%i", COSTS (costs, i)->mem_cost); fprintf (f, " MEM:%i", COSTS (costs, i)->mem_cost);
if (flag_ira_region == IRA_REGION_ALL if (flag_ira_region == IRA_REGION_ALL
...@@ -1574,9 +1583,8 @@ print_pseudo_costs (FILE *f) ...@@ -1574,9 +1583,8 @@ print_pseudo_costs (FILE *f)
for (k = 0; k < cost_classes_ptr->num; k++) for (k = 0; k < cost_classes_ptr->num; k++)
{ {
rclass = cost_classes[k]; rclass = cost_classes[k];
if (! invalid_mode_change_p (regno, (enum reg_class) rclass)) fprintf (f, " %s:%d", reg_class_names[rclass],
fprintf (f, " %s:%d", reg_class_names[rclass], COSTS (costs, regno)->cost[k]);
COSTS (costs, regno)->cost[k]);
} }
fprintf (f, " MEM:%i\n", COSTS (costs, regno)->mem_cost); fprintf (f, " MEM:%i\n", COSTS (costs, regno)->mem_cost);
} }
...@@ -1813,10 +1821,6 @@ find_costs_and_classes (FILE *dump_file) ...@@ -1813,10 +1821,6 @@ find_costs_and_classes (FILE *dump_file)
for (k = 0; k < cost_classes_ptr->num; k++) for (k = 0; k < cost_classes_ptr->num; k++)
{ {
rclass = cost_classes[k]; rclass = cost_classes[k];
/* Ignore classes that are too small or invalid for this
operand. */
if (invalid_mode_change_p (i, (enum reg_class) rclass))
continue;
if (i_costs[k] < best_cost) if (i_costs[k] < best_cost)
{ {
best_cost = i_costs[k]; best_cost = i_costs[k];
...@@ -1906,11 +1910,7 @@ find_costs_and_classes (FILE *dump_file) ...@@ -1906,11 +1910,7 @@ find_costs_and_classes (FILE *dump_file)
rclass = cost_classes[k]; rclass = cost_classes[k];
if (! ira_class_subset_p[rclass][aclass]) if (! ira_class_subset_p[rclass][aclass])
continue; continue;
/* Ignore classes that are too small or invalid if (total_a_costs[k] < best_cost)
for this operand. */
if (invalid_mode_change_p (i, (enum reg_class) rclass))
;
else if (total_a_costs[k] < best_cost)
{ {
best_cost = total_a_costs[k]; best_cost = total_a_costs[k];
allocno_cost = a_costs[k]; allocno_cost = a_costs[k];
......
...@@ -1333,14 +1333,10 @@ init_subregs_of_mode (void) ...@@ -1333,14 +1333,10 @@ init_subregs_of_mode (void)
find_subregs_of_mode (PATTERN (insn)); find_subregs_of_mode (PATTERN (insn));
} }
/* Return 1 if REGNO has had an invalid mode change in CLASS from FROM const HARD_REG_SET *
mode. */ valid_mode_changes_for_regno (unsigned int regno)
bool
invalid_mode_change_p (unsigned int regno, enum reg_class rclass)
{ {
return (valid_mode_changes[regno] return valid_mode_changes[regno];
&& !hard_reg_set_intersect_p (reg_class_contents[rclass],
*valid_mode_changes[regno]));
} }
void void
......
...@@ -3468,7 +3468,9 @@ extern void init_reg_sets (void); ...@@ -3468,7 +3468,9 @@ extern void init_reg_sets (void);
extern void regclass (rtx, int); extern void regclass (rtx, int);
extern void reg_scan (rtx_insn *, unsigned int); extern void reg_scan (rtx_insn *, unsigned int);
extern void fix_register (const char *, int, int); extern void fix_register (const char *, int, int);
extern bool invalid_mode_change_p (unsigned int, enum reg_class); #ifdef HARD_CONST
extern const HARD_REG_SET *valid_mode_changes_for_regno (unsigned int);
#endif
/* In reload1.c */ /* In reload1.c */
extern int function_invariant_p (const_rtx); extern int function_invariant_p (const_rtx);
......
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