summaryrefslogtreecommitdiff
path: root/gcc/ira-costs.c
diff options
context:
space:
mode:
authorvmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-09 21:25:11 +0000
committervmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-09 21:25:11 +0000
commit14792f4e09135749d6631d113f0e73185ba50226 (patch)
tree42be312c545d91eee361dc8d399923279541e6a2 /gcc/ira-costs.c
parent58d657fa30f9a8f4c020bae68bf141867aa5ef55 (diff)
downloadgcc-14792f4e09135749d6631d113f0e73185ba50226.tar.gz
2008-12-09 Vladimir Makarov <vmakarov@redhat.com>
* doc/tm.texi (TARGET_IRA_COVER_CLASSES): Modify description. * doc/invoke.texi (-fira-region): Describe new option. (-fira-algorithm): Change the values. * ira-conflicts.c (build_conflict_bit_table, build_allocno_conflicts): Use ira_reg_classes_intersect_p. (ira_build_conflicts): Use flag flag_ira_region instead of flag_ira_algorithm. Prohibit usage of callee-saved likely spilled base registers for allocnos crossing calls. * flags.h (enum ira_algorithm): Redefine. (enum ira_region): New. (flag_ira_region): New. * cfgloopanal.c (estimate_reg_pressure_cost): Use flag_ira_region instead of flag_ira_algorithm. * toplev.c (flag_ira_algorithm): Change the initial value. (flag_ira_region): New. * ira-int.h (ira_reg_classes_intersect_p, ira_reg_class_super_classes): New. * ira-color.c (update_copy_costs): Use ira_reg_classes_intersect_p. Use right class to find hard reg index. (update_conflict_hard_regno_costs): Ditto. Add a new parameter. (assign_hard_reg): Ditto. Pass additional argument to update_conflict_hard_regno_costs. Do not uncoalesce for priority coloring. (allocno_priorities, setup_allocno_priorities, allocno_priority_compare_func): Move before color_allocnos. (color_allocnos): Add priority coloring. Use flag flag_ira_region instead of flag_ira_algorithm. (move_spill_restore): Check classes of the same reg allocno from different regions. (update_curr_costs): Use ira_reg_classes_intersect_p. (ira_reassign_conflict_allocnos): Ditto. * opts.c (decode_options): Always set up flag_ira. Set up flag_ira_algorithm. Warn CB can not be used for architecture. (common_handle_option): Modify code for -fira-algorithm. Add code to process -fira-region. * ira-lives.c (update_allocno_pressure_excess_length): Process superclasses too. (set_allocno_live, clear_allocno_live, mark_reg_live, mark_reg_dead, process_bb_node_lives): Ditto. * ira-emit.c (ira_emit): Fix insn codes. * ira-build.c (propagate_allocno_info): Use flag flag_ira_region instead of flag_ira_algorithm. (allocno_range_compare_func): Ignore classes for priority coloring. (setup_min_max_conflict_allocno_ids): Ditto. (ira_flattening): Use ira_reg_classes_intersect_p. * genpreds.c (write_enum_constraint_num): Output CONSTRAINT__LIMIT. * common.opt (fira-algorithm): Modify. (fira-region): New. * ira.c (setup_class_hard_regs): Initialize. (setup_cover_and_important_classes): Modify code setting class related info for priority coloring. (setup_class_translate): Ditto. (ira_reg_classes_intersect_p, ira_reg_class_super_classes): New. (setup_reg_class_intersect_union): Rename to setup_reg_class_relations. Add code for setting up new variables. (find_reg_class_closure): Do not check targetm.ira_cover_classes. (ira): Use flag flag_ira_region instead of flag_ira_algorithm. * ira-costs.c (common_classes): New. (print_costs): Use flag flag_ira_region instead of flag_ira_algorithm. (find_allocno_class_costs): Ditto. Use common_classes. Translate alt_class. (ira_costs): Allocate/deallocate common_classes. * config/m32c/m32.h (REG_ALLOC_ORDER): Add reg 19. (REG_CLASS_CONTENTS, reg_class, REG_CLASS_NAMES): New entries for R02A_REGS. * reload1.c (choose_reload_regs): Use MODE_INT for partial ints in smallest_mode_for_size. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142610 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ira-costs.c')
-rw-r--r--gcc/ira-costs.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 3daeb075d34..a2df9bde9ae 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -105,6 +105,9 @@ static enum reg_class *allocno_pref;
/* Allocated buffers for allocno_pref. */
static enum reg_class *allocno_pref_buffer;
+/* Record register class of each allocno with the same regno. */
+static enum reg_class *common_classes;
+
/* Execution frequency of the current insn. */
static int frequency;
@@ -1082,8 +1085,8 @@ print_costs (FILE *f)
{
fprintf (f, " %s:%d", reg_class_names[rclass],
COSTS_OF_ALLOCNO (allocno_costs, i)->cost[k]);
- if (flag_ira_algorithm == IRA_ALGORITHM_REGIONAL
- || flag_ira_algorithm == IRA_ALGORITHM_MIXED)
+ if (flag_ira_region == IRA_REGION_ALL
+ || flag_ira_region == IRA_REGION_MIXED)
fprintf (f, ",%d", COSTS_OF_ALLOCNO (total_costs, i)->cost[k]);
}
}
@@ -1173,7 +1176,7 @@ find_allocno_class_costs (void)
int rclass, a_num, parent_a_num;
ira_loop_tree_node_t parent;
int best_cost, allocno_cost;
- enum reg_class best, alt_class, common_class;
+ enum reg_class best, alt_class;
#ifdef FORBIDDEN_INC_DEC_CLASSES
int inc_dec_p = false;
#endif
@@ -1187,8 +1190,8 @@ find_allocno_class_costs (void)
a = ALLOCNO_NEXT_REGNO_ALLOCNO (a))
{
a_num = ALLOCNO_NUM (a);
- if ((flag_ira_algorithm == IRA_ALGORITHM_REGIONAL
- || flag_ira_algorithm == IRA_ALGORITHM_MIXED)
+ if ((flag_ira_region == IRA_REGION_ALL
+ || flag_ira_region == IRA_REGION_MIXED)
&& (parent = ALLOCNO_LOOP_TREE_NODE (a)->parent) != NULL
&& (parent_a = parent->regno_allocno_map[i]) != NULL
/* There are no caps yet. */
@@ -1247,6 +1250,7 @@ find_allocno_class_costs (void)
> reg_class_size[alt_class]))
alt_class = reg_class_subunion[alt_class][rclass];
}
+ alt_class = ira_class_translate[alt_class];
if (pass == flag_expensive_optimizations)
{
if (best_cost > temp_costs->mem_cost)
@@ -1260,18 +1264,22 @@ find_allocno_class_costs (void)
i, reg_class_names[best], reg_class_names[alt_class]);
}
if (best_cost > temp_costs->mem_cost)
- common_class = NO_REGS;
+ common_classes[i] = NO_REGS;
+ else if (flag_ira_algorithm == IRA_ALGORITHM_PRIORITY)
+ /* Make the common class the biggest class of best and
+ alt_class. */
+ common_classes[i] = alt_class == NO_REGS ? best : alt_class;
else
/* Make the common class a cover class. Remember all
allocnos with the same regno should have the same cover
class. */
- common_class = ira_class_translate[best];
+ common_classes[i] = ira_class_translate[best];
for (a = ira_regno_allocno_map[i];
a != NULL;
a = ALLOCNO_NEXT_REGNO_ALLOCNO (a))
{
a_num = ALLOCNO_NUM (a);
- if (common_class == NO_REGS)
+ if (common_classes[i] == NO_REGS)
best = NO_REGS;
else
{
@@ -1283,7 +1291,7 @@ find_allocno_class_costs (void)
for (k = 0; k < cost_classes_num; k++)
{
rclass = cost_classes[k];
- if (! ira_class_subset_p[rclass][common_class])
+ if (! ira_class_subset_p[rclass][common_classes[i]])
continue;
/* Ignore classes that are too small for this
operand or invalid for an operand that was
@@ -1319,6 +1327,8 @@ find_allocno_class_costs (void)
}
ALLOCNO_COVER_CLASS_COST (a) = allocno_cost;
}
+ ira_assert (flag_ira_algorithm == IRA_ALGORITHM_PRIORITY
+ || ira_class_translate[best] == common_classes[i]);
if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL
&& (pass == 0 || allocno_pref[a_num] != best))
{
@@ -1330,7 +1340,7 @@ find_allocno_class_costs (void)
ALLOCNO_LOOP_TREE_NODE (a)->loop->num);
fprintf (ira_dump_file, ") best %s, cover %s\n",
reg_class_names[best],
- reg_class_names[ira_class_translate[best]]);
+ reg_class_names[common_classes[i]]);
}
allocno_pref[a_num] = best;
}
@@ -1439,7 +1449,7 @@ setup_allocno_cover_class_and_costs (void)
{
i = ALLOCNO_NUM (a);
mode = ALLOCNO_MODE (a);
- cover_class = ira_class_translate[allocno_pref[i]];
+ cover_class = common_classes[ALLOCNO_REGNO (a)];
ira_assert (allocno_pref[i] == NO_REGS || cover_class != NO_REGS);
ALLOCNO_MEMORY_COST (a) = COSTS_OF_ALLOCNO (allocno_costs, i)->mem_cost;
ira_set_allocno_cover_class (a, cover_class);
@@ -1572,6 +1582,9 @@ ira_costs (void)
allocno_pref_buffer
= (enum reg_class *) ira_allocate (sizeof (enum reg_class)
* ira_allocnos_num);
+ common_classes
+ = (enum reg_class *) ira_allocate (sizeof (enum reg_class)
+ * max_reg_num ());
find_allocno_class_costs ();
setup_allocno_cover_class_and_costs ();
/* Because we could process operands only as subregs, check mode of
@@ -1580,6 +1593,7 @@ ira_costs (void)
if (ira_register_move_cost[ALLOCNO_MODE (a)] == NULL
&& have_regs_of_mode[ALLOCNO_MODE (a)])
ira_init_register_move_cost (ALLOCNO_MODE (a));
+ ira_free (common_classes);
ira_free (allocno_pref_buffer);
ira_free (total_costs);
ira_free (allocno_costs);