aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Zadeck <zadeck@naturalbridge.com>2008-05-16 13:54:34 +0000
committerKenneth Zadeck <zadeck@gcc.gnu.org>2008-05-16 13:54:34 +0000
commit07b5bc83079cda38e48412d1bcdd7f65663607fc (patch)
tree63f780169efa14dd2849b28fc4cf07a474bd689d
parentf1f07a96da3b9d93b6fd2923aea88944a7ad55b5 (diff)
downloadgcc-07b5bc83079cda38e48412d1bcdd7f65663607fc.zip
gcc-07b5bc83079cda38e48412d1bcdd7f65663607fc.tar.gz
gcc-07b5bc83079cda38e48412d1bcdd7f65663607fc.tar.bz2
ifcvt.c (dead_or_predicable): Rename df_simulate_one_insn_backwards to df_simulate_one_insn.
2008-05-16 Kenneth Zadeck <zadeck@naturalbridge.com> * ifcvt.c (dead_or_predicable): Rename df_simulate_one_insn_backwards to df_simulate_one_insn. * recog.c (peephole2_optimize): Ditto. * rtl-factoring.c (collect_pattern_seqs, clear_regs_live_in_seq): Ditto. * df.h: Rename df_simulate_one_insn_backwards to df_simulate_one_insn. and delete df_simulate_one_insn_forwards. * df-problems.c (df_simulate_artificial_refs_at_top) Reversed scanning of defs and uses. (df_simulate_one_insn_backwards): Renamed to df_simulate_one_insn. (df_simulate_one_insn_forwards): Removed. From-SVN: r135422
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/df-problems.c76
-rw-r--r--gcc/df.h5
-rw-r--r--gcc/ifcvt.c2
-rw-r--r--gcc/recog.c4
-rw-r--r--gcc/rtl-factoring.c6
6 files changed, 61 insertions, 47 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4f16907..9f9af8b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+2008-05-16 Kenneth Zadeck <zadeck@naturalbridge.com>
+
+ * ifcvt.c (dead_or_predicable): Rename
+ df_simulate_one_insn_backwards to df_simulate_one_insn.
+ * recog.c (peephole2_optimize): Ditto.
+ * rtl-factoring.c (collect_pattern_seqs, clear_regs_live_in_seq):
+ Ditto.
+ * df.h: Rename df_simulate_one_insn_backwards to
+ df_simulate_one_insn. and delete df_simulate_one_insn_forwards.
+ * df-problems.c (df_simulate_artificial_refs_at_top) Reversed
+ scanning of defs and uses.
+ (df_simulate_one_insn_backwards): Renamed to df_simulate_one_insn.
+ (df_simulate_one_insn_forwards): Removed.
+
+
2008-05-16 Doug Kwan <dougkwan@google.com>
* real.c (real_to_decimal, real_to_hexadecimal): Distinguish
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index f7288c7..682cca8 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -3682,7 +3682,6 @@ df_note_add_problem (void)
DF_LR_IN. If you start at the bottom of the block use one of
DF_LIVE_OUT or DF_LR_OUT. BE SURE TO PASS A COPY OF THESE SETS,
THEY WILL BE DESTROYED.
-
----------------------------------------------------------------------------*/
@@ -3757,87 +3756,88 @@ df_simulate_fixup_sets (basic_block bb, bitmap live)
}
-/* Apply the artificial uses and defs at the top of BB in a forwards
+/*----------------------------------------------------------------------------
+ The following three functions are used only for BACKWARDS scanning:
+ i.e. they process the defs before the uses.
+
+ df_simulate_artificial_refs_at_end should be called first with a
+ bitvector copyied from the DF_LIVE_OUT or DF_LR_OUT. Then
+ df_simulate_one_insn should be called for each insn in the block,
+ starting with the last on. Finally,
+ df_simulate_artificial_refs_at_top can be called to get a new value
+ of the sets at the top of the block (this is rarely used).
+
+ It would be trivial to define a similar set of functions that work
+ in the forwards direction. The only changes would be to process
+ the uses before the defs and properly rename the functions. This
+ has so far not been necessary.
+----------------------------------------------------------------------------*/
+
+/* Apply the artificial uses and defs at the end of BB in a backwards
direction. */
void
-df_simulate_artificial_refs_at_top (basic_block bb, bitmap live)
+df_simulate_artificial_refs_at_end (basic_block bb, bitmap live)
{
struct df_ref **def_rec;
-#ifdef EH_USES
struct df_ref **use_rec;
-#endif
int bb_index = bb->index;
-#ifdef EH_USES
- for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++)
- {
- struct df_ref *use = *use_rec;
- if (DF_REF_FLAGS (use) & DF_REF_AT_TOP)
- bitmap_set_bit (live, DF_REF_REGNO (use));
- }
-#endif
-
for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
{
struct df_ref *def = *def_rec;
- if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
+ if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
bitmap_clear_bit (live, DF_REF_REGNO (def));
}
+
+ for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++)
+ {
+ struct df_ref *use = *use_rec;
+ if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
+ bitmap_set_bit (live, DF_REF_REGNO (use));
+ }
}
-/* Simulate the forwards effects of INSN on the bitmap LIVE. */
+/* Simulate the backwards effects of INSN on the bitmap LIVE. */
void
-df_simulate_one_insn_forwards (basic_block bb, rtx insn, bitmap live)
+df_simulate_one_insn (basic_block bb, rtx insn, bitmap live)
{
if (! INSN_P (insn))
return;
- df_simulate_uses (insn, live);
df_simulate_defs (insn, live);
+ df_simulate_uses (insn, live);
df_simulate_fixup_sets (bb, live);
}
-/* Apply the artificial uses and defs at the end of BB in a backwards
+/* Apply the artificial uses and defs at the top of BB in a backwards
direction. */
void
-df_simulate_artificial_refs_at_end (basic_block bb, bitmap live)
+df_simulate_artificial_refs_at_top (basic_block bb, bitmap live)
{
struct df_ref **def_rec;
+#ifdef EH_USES
struct df_ref **use_rec;
+#endif
int bb_index = bb->index;
for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
{
struct df_ref *def = *def_rec;
- if ((DF_REF_FLAGS (def) & DF_REF_AT_TOP) == 0)
+ if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
bitmap_clear_bit (live, DF_REF_REGNO (def));
}
+#ifdef EH_USES
for (use_rec = df_get_artificial_uses (bb_index); *use_rec; use_rec++)
{
struct df_ref *use = *use_rec;
- if ((DF_REF_FLAGS (use) & DF_REF_AT_TOP) == 0)
+ if (DF_REF_FLAGS (use) & DF_REF_AT_TOP)
bitmap_set_bit (live, DF_REF_REGNO (use));
}
+#endif
}
-
-
-/* Simulate the backwards effects of INSN on the bitmap LIVE. */
-
-void
-df_simulate_one_insn_backwards (basic_block bb, rtx insn, bitmap live)
-{
- if (! INSN_P (insn))
- return;
-
- df_simulate_defs (insn, live);
- df_simulate_uses (insn, live);
- df_simulate_fixup_sets (bb, live);
-}
-
-
diff --git a/gcc/df.h b/gcc/df.h
index 3c08947..6375a70 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -913,10 +913,9 @@ extern void df_note_add_problem (void);
extern void df_simulate_find_defs (rtx, bitmap);
extern void df_simulate_defs (rtx, bitmap);
extern void df_simulate_uses (rtx, bitmap);
-extern void df_simulate_artificial_refs_at_top (basic_block, bitmap);
-extern void df_simulate_one_insn_forwards (basic_block, rtx, bitmap);
extern void df_simulate_artificial_refs_at_end (basic_block, bitmap);
-extern void df_simulate_one_insn_backwards (basic_block, rtx, bitmap);
+extern void df_simulate_one_insn (basic_block, rtx, bitmap);
+extern void df_simulate_artificial_refs_at_top (basic_block, bitmap);
/* Functions defined in df-scan.c. */
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 26ff968..e1601b1 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -3913,7 +3913,7 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb,
if (INSN_P (insn))
{
df_simulate_find_defs (insn, test_set);
- df_simulate_one_insn_backwards (test_bb, insn, test_live);
+ df_simulate_one_insn (test_bb, insn, test_live);
}
prev = PREV_INSN (insn);
if (insn == earliest)
diff --git a/gcc/recog.c b/gcc/recog.c
index ec627a3..9ede30f 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -2953,7 +2953,7 @@ peephole2_optimize (void)
&& peep2_insn_data[peep2_current].insn == NULL_RTX)
peep2_current_count++;
peep2_insn_data[peep2_current].insn = insn;
- df_simulate_one_insn_backwards (bb, insn, live);
+ df_simulate_one_insn (bb, insn, live);
COPY_REG_SET (peep2_insn_data[peep2_current].live_before, live);
if (RTX_FRAME_RELATED_P (insn))
@@ -3115,7 +3115,7 @@ peephole2_optimize (void)
peep2_current_count++;
peep2_insn_data[i].insn = x;
df_insn_rescan (x);
- df_simulate_one_insn_backwards (bb, x, live);
+ df_simulate_one_insn (bb, x, live);
bitmap_copy (peep2_insn_data[i].live_before, live);
}
x = PREV_INSN (x);
diff --git a/gcc/rtl-factoring.c b/gcc/rtl-factoring.c
index c874fa4..128c990 100644
--- a/gcc/rtl-factoring.c
+++ b/gcc/rtl-factoring.c
@@ -486,7 +486,7 @@ collect_pattern_seqs (void)
}
if (insn == BB_HEAD (bb))
break;
- df_simulate_one_insn_backwards (bb, insn, &live);
+ df_simulate_one_insn (bb, insn, &live);
insn = prev;
}
@@ -576,7 +576,7 @@ clear_regs_live_in_seq (HARD_REG_SET * regs, rtx insn, int length)
/* Propagate until INSN if found. */
for (x = BB_END (bb); x != insn; x = PREV_INSN (x))
- df_simulate_one_insn_backwards (bb, x, &live);
+ df_simulate_one_insn (bb, x, &live);
/* Clear registers live after INSN. */
renumbered_reg_set_to_hard_reg_set (&hlive, &live);
@@ -586,7 +586,7 @@ clear_regs_live_in_seq (HARD_REG_SET * regs, rtx insn, int length)
for (i = 0; i < length;)
{
rtx prev = PREV_INSN (x);
- df_simulate_one_insn_backwards (bb, x, &live);
+ df_simulate_one_insn (bb, x, &live);
if (INSN_P (x))
{