summaryrefslogtreecommitdiff
path: root/gcc/df-problems.c
diff options
context:
space:
mode:
authorzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-22 13:57:01 +0000
committerzadeck <zadeck@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-22 13:57:01 +0000
commitf437e46d0c8b9f30bb5cbacee71e2a23bc41b420 (patch)
treeebfe2c3b0f60689e131c3a7a378e9b4a90660f8e /gcc/df-problems.c
parentc7871c82a2877b1eeb17aadbd2780996e82677d0 (diff)
downloadgcc-f437e46d0c8b9f30bb5cbacee71e2a23bc41b420.tar.gz
2008-01-22 Kenneth Zadeck <zadeck@naturalbridge.com>
PR rtl-optimization/26854 PR rtl-optimization/34400 PR rtl-optimization/34884 * ddg.c (create_ddg_dep_from_intra_loop_link): Use DF_RD->gen. * df.h (df_changeable_flags.DF_RD_NO_TRIM): Deleted (df_rd_bb_info.expanded_lr_out): Deleted * loop_invariant.c (find_defs): Deleted DF_RD_NO_TRIM flag. * loop_iv.c (iv_analysis_loop_init): Ditto. * df-problems.c (df_rd_free_bb_info, df_rd_alloc, df_rd_confluence_n, df_rd_bb_local_compute, df_rd_transfer_function, df_rd_free): Removed code to allocate, initialize or free expanded_lr_out. (df_rd_bb_local_compute_process_def): Restructured to make more understandable. (df_rd_confluence_n): Removed code to no apply invalidate_by_call sets if the sets are being trimmed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131719 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/df-problems.c')
-rw-r--r--gcc/df-problems.c125
1 files changed, 49 insertions, 76 deletions
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index f45c6d2ff36..46aa9e03f4c 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -245,8 +245,6 @@ df_rd_free_bb_info (basic_block bb ATTRIBUTE_UNUSED,
struct df_rd_bb_info *bb_info = (struct df_rd_bb_info *) vbb_info;
if (bb_info)
{
- if (bb_info->expanded_lr_out)
- BITMAP_FREE (bb_info->expanded_lr_out);
BITMAP_FREE (bb_info->kill);
BITMAP_FREE (bb_info->sparse_kill);
BITMAP_FREE (bb_info->gen);
@@ -300,8 +298,6 @@ df_rd_alloc (bitmap all_blocks)
struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
if (bb_info)
{
- if (bb_info->expanded_lr_out)
- bitmap_clear (bb_info->expanded_lr_out);
bitmap_clear (bb_info->kill);
bitmap_clear (bb_info->sparse_kill);
bitmap_clear (bb_info->gen);
@@ -310,10 +306,6 @@ df_rd_alloc (bitmap all_blocks)
{
bb_info = (struct df_rd_bb_info *) pool_alloc (df_rd->block_pool);
df_rd_set_bb_info (bb_index, bb_info);
- if (df->changeable_flags & DF_RD_NO_TRIM)
- bb_info->expanded_lr_out = NULL;
- else
- bb_info->expanded_lr_out = BITMAP_ALLOC (&problem_data->rd_bitmaps);
bb_info->kill = BITMAP_ALLOC (&problem_data->rd_bitmaps);
bb_info->sparse_kill = BITMAP_ALLOC (&problem_data->rd_bitmaps);
bb_info->gen = BITMAP_ALLOC (&problem_data->rd_bitmaps);
@@ -328,53 +320,56 @@ df_rd_alloc (bitmap all_blocks)
/* Process a list of DEFs for df_rd_bb_local_compute. */
static void
-df_rd_bb_local_compute_process_def (struct df_rd_bb_info *bb_info,
+df_rd_bb_local_compute_process_def (struct df_rd_bb_info *bb_info,
struct df_ref **def_rec,
enum df_ref_flags top_flag)
{
- for (; *def_rec; def_rec++)
+ while (*def_rec)
{
struct df_ref *def = *def_rec;
- unsigned int regno = DF_REF_REGNO (def);
-
- /* This makes sure we do the artificial defs in the right order
- since they are all in the same list. */
- if (top_flag != (DF_REF_FLAGS (def) & DF_REF_AT_TOP))
- continue;
-
- /* Skip over the hard regs if we do not care about them. */
- if ((df->changeable_flags & DF_NO_HARD_REGS) &&
- (regno < FIRST_PSEUDO_REGISTER))
- continue;
-
- /* Only the last def(s) for a regno in the block has any
- effect. */
- if (bitmap_bit_p (seen_in_block, regno))
- continue;
-
- /* The first def for regno in insn gets to knock out the
- defs from other instructions. */
- if ((!bitmap_bit_p (seen_in_insn, regno))
- /* If the def is to only part of the reg, it does
- not kill the other defs that reach here. */
- && (!(DF_REF_FLAGS (def) &
- (DF_REF_PARTIAL | DF_REF_CONDITIONAL | DF_REF_MAY_CLOBBER))))
+ if (top_flag == (DF_REF_FLAGS (def) & DF_REF_AT_TOP))
{
+ unsigned int regno = DF_REF_REGNO (def);
unsigned int begin = DF_DEFS_BEGIN (regno);
unsigned int n_defs = DF_DEFS_COUNT (regno);
- if (n_defs > DF_SPARSE_THRESHOLD)
- bitmap_set_bit (bb_info->sparse_kill, regno);
- else
- bitmap_set_range (bb_info->kill, begin, n_defs);
- bitmap_clear_range(bb_info->gen, begin, n_defs);
+
+ if ((!(df->changeable_flags & DF_NO_HARD_REGS))
+ || (regno >= FIRST_PSEUDO_REGISTER))
+ {
+ /* Only the last def(s) for a regno in the block has any
+ effect. */
+ if (!bitmap_bit_p (seen_in_block, regno))
+ {
+ /* The first def for regno in insn gets to knock out the
+ defs from other instructions. */
+ if ((!bitmap_bit_p (seen_in_insn, regno))
+ /* If the def is to only part of the reg, it does
+ not kill the other defs that reach here. */
+ && (!(DF_REF_FLAGS (def) &
+ (DF_REF_PARTIAL | DF_REF_CONDITIONAL | DF_REF_MAY_CLOBBER))))
+ {
+ if (n_defs > DF_SPARSE_THRESHOLD)
+ {
+ bitmap_set_bit (bb_info->sparse_kill, regno);
+ bitmap_clear_range(bb_info->gen, begin, n_defs);
+ }
+ else
+ {
+ bitmap_set_range (bb_info->kill, begin, n_defs);
+ bitmap_clear_range (bb_info->gen, begin, n_defs);
+ }
+ }
+
+ bitmap_set_bit (seen_in_insn, regno);
+ /* All defs for regno in the instruction may be put into
+ the gen set. */
+ if (!(DF_REF_FLAGS (def)
+ & (DF_REF_MUST_CLOBBER | DF_REF_MAY_CLOBBER)))
+ bitmap_set_bit (bb_info->gen, DF_REF_ID (def));
+ }
+ }
}
-
- bitmap_set_bit (seen_in_insn, regno);
- /* All defs for regno in the instruction may be put into
- the gen set. */
- if (!(DF_REF_FLAGS (def)
- & (DF_REF_MUST_CLOBBER | DF_REF_MAY_CLOBBER)))
- bitmap_set_bit (bb_info->gen, DF_REF_ID (def));
+ def_rec++;
}
}
@@ -385,28 +380,14 @@ df_rd_bb_local_compute (unsigned int bb_index)
{
basic_block bb = BASIC_BLOCK (bb_index);
struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
- struct df_lr_bb_info *lr_bb_info = df_lr_get_bb_info (bb_index);
rtx insn;
bitmap_clear (seen_in_block);
bitmap_clear (seen_in_insn);
- if (!(df->changeable_flags & DF_RD_NO_TRIM))
- {
- unsigned int regno;
- bitmap_iterator bi;
- int first_reg = (df->changeable_flags & DF_NO_HARD_REGS) ? FIRST_PSEUDO_REGISTER : 0;
- EXECUTE_IF_SET_IN_BITMAP (lr_bb_info->out, first_reg, regno, bi)
- {
- unsigned int begin = DF_DEFS_BEGIN (regno);
- unsigned int n_defs = DF_DEFS_COUNT (regno);
- bitmap_set_range (bb_info->expanded_lr_out, begin, n_defs);
- }
- }
-
/* Artificials are only hard regs. */
if (!(df->changeable_flags & DF_NO_HARD_REGS))
- df_rd_bb_local_compute_process_def (bb_info,
+ df_rd_bb_local_compute_process_def (bb_info,
df_get_artificial_defs (bb_index),
0);
@@ -504,10 +485,7 @@ df_rd_confluence_n (edge e)
if (e->flags & EDGE_FAKE)
return;
- /* If we are trimming the solution, the invalidated_by_call code in
- the lr problem makes this unnecessary. However, if we do not
- trim, we must take this into account. */
- if ((df->changeable_flags & DF_RD_NO_TRIM) && e->flags & EDGE_EH)
+ if (e->flags & EDGE_EH)
{
struct df_rd_problem_data *problem_data
= (struct df_rd_problem_data *) df_rd->problem_data;
@@ -515,7 +493,7 @@ df_rd_confluence_n (edge e)
bitmap dense_invalidated = problem_data->dense_invalidated_by_call;
bitmap_iterator bi;
unsigned int regno;
- bitmap tmp = BITMAP_ALLOC (&problem_data->rd_bitmaps);
+ bitmap tmp = BITMAP_ALLOC (&df_bitmap_obstack);
bitmap_copy (tmp, op2);
bitmap_and_compl_into (tmp, dense_invalidated);
@@ -547,13 +525,13 @@ df_rd_transfer_function (int bb_index)
bitmap gen = bb_info->gen;
bitmap kill = bb_info->kill;
bitmap sparse_kill = bb_info->sparse_kill;
- bool changed = false;
- if ((df->changeable_flags & DF_RD_NO_TRIM) && bitmap_empty_p (sparse_kill))
- changed = bitmap_ior_and_compl (out, gen, in, kill);
+ if (bitmap_empty_p (sparse_kill))
+ return bitmap_ior_and_compl (out, gen, in, kill);
else
{
struct df_rd_problem_data *problem_data;
+ bool changed = false;
bitmap tmp;
/* Note that TMP is _not_ a temporary bitmap if we end up replacing
@@ -570,8 +548,6 @@ df_rd_transfer_function (int bb_index)
}
bitmap_and_compl_into (tmp, kill);
bitmap_ior_into (tmp, gen);
- if (!(df->changeable_flags & DF_RD_NO_TRIM))
- bitmap_and_into (tmp, bb_info->expanded_lr_out);
changed = !bitmap_equal_p (tmp, out);
if (changed)
{
@@ -579,10 +555,9 @@ df_rd_transfer_function (int bb_index)
bb_info->out = tmp;
}
else
- BITMAP_FREE (tmp);
+ BITMAP_FREE (tmp);
+ return changed;
}
-
- return changed;
}
@@ -602,8 +577,6 @@ df_rd_free (void)
struct df_rd_bb_info *bb_info = df_rd_get_bb_info (i);
if (bb_info)
{
- if (bb_info->expanded_lr_out)
- BITMAP_FREE (bb_info->expanded_lr_out);
BITMAP_FREE (bb_info->kill);
BITMAP_FREE (bb_info->sparse_kill);
BITMAP_FREE (bb_info->gen);