summaryrefslogtreecommitdiff
path: root/gcc/ira-conflicts.c
diff options
context:
space:
mode:
authorvmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>2009-01-06 03:50:07 +0000
committervmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>2009-01-06 03:50:07 +0000
commit95c83f01dfe88f30b6b4b16dff9765e4e6314257 (patch)
tree3ab87fe84116bf920cb2e70b665eec2ced158fdf /gcc/ira-conflicts.c
parent23a0ce4330926bcd8c2968b92d477122c4831980 (diff)
downloadgcc-95c83f01dfe88f30b6b4b16dff9765e4e6314257.tar.gz
2009-01-05 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/38583 * params.h (IRA_MAX_CONFLICT_TABLE_SIZE): New macro. * params.def (ira-max-conflict-table-size): New. * doc/invoke.texi (ira-max-conflict-table-size): Decribe. * ira.h (ira_conflicts_p): New external definition. * ira-conflicts.c (build_conflict_bit_table): Do not build too big table. Report this. Return result of building. (ira_build_conflicts): Use ira_conflicts_p. Check result of building conflict table. * ira-color.c (fast_allocation): Use num instead of ira_allocnos_num. (ira_color): Use ira_conflicts_p. * global.c: Include ira.h. (pseudo_for_reload_consideration_p, build_insn_chain): Use ira_conflicts_p. * Makefile.in (global.o): Add ira.h. * ira-build.c (mark_all_loops_for_removal, propagate_some_info_from_allocno): New. (remove_unnecessary_allocnos): Call propagate_some_info_from_allocno. (remove_low_level_allocnos): New. (remove_unnecessary_regions): Add parameter. Call mark_all_loops_for_removal and remove_low_level_allocnos. Pass parameter to remove_unnecessary_regions. (ira_build): Remove all regions but root if the conflict table was not built. Update conflict hard regs for allocnos crossing calls. * ira.c (ira_conflicts_p): New global. (ira): Define and use ira_conflicts_p. * reload1.c (compute_use_by_pseudos, reload, count_pseudo, count_spilled_pseudo, find_reg, alter_reg, finish_spills, emit_input_reload_insns, delete_output_reload): Use ira_conflicts_p. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143112 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ira-conflicts.c')
-rw-r--r--gcc/ira-conflicts.c65
1 files changed, 47 insertions, 18 deletions
diff --git a/gcc/ira-conflicts.c b/gcc/ira-conflicts.c
index ff116b5da8a..244d3bc9b3e 100644
--- a/gcc/ira-conflicts.c
+++ b/gcc/ira-conflicts.c
@@ -60,8 +60,10 @@ static IRA_INT_TYPE **conflicts;
-/* Build allocno conflict table by processing allocno live ranges. */
-static void
+/* Build allocno conflict table by processing allocno live ranges.
+ Return true if the table was built. The table is not built if it
+ is too big. */
+static bool
build_conflict_bit_table (void)
{
int i, num, id, allocated_words_num, conflict_bit_vec_words_num;
@@ -74,6 +76,26 @@ build_conflict_bit_table (void)
int allocno_set_words;
allocno_set_words = (ira_allocnos_num + IRA_INT_BITS - 1) / IRA_INT_BITS;
+ allocated_words_num = 0;
+ FOR_EACH_ALLOCNO (allocno, ai)
+ {
+ if (ALLOCNO_MAX (allocno) < ALLOCNO_MIN (allocno))
+ continue;
+ conflict_bit_vec_words_num
+ = ((ALLOCNO_MAX (allocno) - ALLOCNO_MIN (allocno) + IRA_INT_BITS)
+ / IRA_INT_BITS);
+ allocated_words_num += conflict_bit_vec_words_num;
+ if ((unsigned long long) allocated_words_num * sizeof (IRA_INT_TYPE)
+ > (unsigned long long) IRA_MAX_CONFLICT_TABLE_SIZE * 1024 * 1024)
+ {
+ if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL)
+ fprintf
+ (ira_dump_file,
+ "+++Conflict table will be too big(>%dMB) -- don't use it\n",
+ IRA_MAX_CONFLICT_TABLE_SIZE);
+ return false;
+ }
+ }
allocnos_live = sparseset_alloc (ira_allocnos_num);
conflicts = (IRA_INT_TYPE **) ira_allocate (sizeof (IRA_INT_TYPE *)
* ira_allocnos_num);
@@ -134,6 +156,7 @@ build_conflict_bit_table (void)
sparseset_clear_bit (allocnos_live, ALLOCNO_NUM (r->allocno));
}
sparseset_free (allocnos_live);
+ return true;
}
@@ -743,29 +766,34 @@ ira_build_conflicts (void)
ira_allocno_iterator ai;
HARD_REG_SET temp_hard_reg_set;
- if (optimize)
+ if (ira_conflicts_p)
{
- build_conflict_bit_table ();
- build_conflicts ();
- ira_traverse_loop_tree (true, ira_loop_tree_root, NULL, add_copies);
- /* We need finished conflict table for the subsequent call. */
- if (flag_ira_region == IRA_REGION_ALL
- || flag_ira_region == IRA_REGION_MIXED)
- propagate_copies ();
- /* Now we can free memory for the conflict table (see function
- build_allocno_conflicts for details). */
- FOR_EACH_ALLOCNO (a, ai)
+ ira_conflicts_p = build_conflict_bit_table ();
+ if (ira_conflicts_p)
{
- if (ALLOCNO_CONFLICT_ALLOCNO_ARRAY (a) != conflicts[ALLOCNO_NUM (a)])
- ira_free (conflicts[ALLOCNO_NUM (a)]);
+ build_conflicts ();
+ ira_traverse_loop_tree (true, ira_loop_tree_root, NULL, add_copies);
+ /* We need finished conflict table for the subsequent call. */
+ if (flag_ira_region == IRA_REGION_ALL
+ || flag_ira_region == IRA_REGION_MIXED)
+ propagate_copies ();
+ /* Now we can free memory for the conflict table (see function
+ build_allocno_conflicts for details). */
+ FOR_EACH_ALLOCNO (a, ai)
+ {
+ if (ALLOCNO_CONFLICT_ALLOCNO_ARRAY (a)
+ != conflicts[ALLOCNO_NUM (a)])
+ ira_free (conflicts[ALLOCNO_NUM (a)]);
+ }
+ ira_free (conflicts);
}
- ira_free (conflicts);
}
if (! CLASS_LIKELY_SPILLED_P (BASE_REG_CLASS))
CLEAR_HARD_REG_SET (temp_hard_reg_set);
else
{
- COPY_HARD_REG_SET (temp_hard_reg_set, reg_class_contents[BASE_REG_CLASS]);
+ COPY_HARD_REG_SET (temp_hard_reg_set,
+ reg_class_contents[BASE_REG_CLASS]);
AND_COMPL_HARD_REG_SET (temp_hard_reg_set, ira_no_alloc_regs);
AND_HARD_REG_SET (temp_hard_reg_set, call_used_reg_set);
}
@@ -796,6 +824,7 @@ ira_build_conflicts (void)
}
}
}
- if (optimize && internal_flag_ira_verbose > 2 && ira_dump_file != NULL)
+ if (optimize && ira_conflicts_p
+ && internal_flag_ira_verbose > 2 && ira_dump_file != NULL)
print_conflicts (ira_dump_file, false);
}