+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
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.
-
----------------------------------------------------------------------------*/
}
-/* 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);
-}
-
-
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. */
&& 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))
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);
}
if (insn == BB_HEAD (bb))
break;
- df_simulate_one_insn_backwards (bb, insn, &live);
+ df_simulate_one_insn (bb, insn, &live);
insn = prev;
}
/* 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);
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))
{