summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-25 21:23:27 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-25 21:23:27 +0000
commitbbe0b6d7be80a09b5623612dc9b67dee6ad6ba3c (patch)
tree4555801976230422922dfb334952ad6333bda406
parent8706d7a37f5e3a761ff6e6498fd123e62522f7bf (diff)
downloadgcc-bbe0b6d7be80a09b5623612dc9b67dee6ad6ba3c.tar.gz
* cse.c (cse_altered): Remove.
(record_jump_equiv): Make true/false argument a bool instead of an int. (cse_insn): Don't set cse_altered. Use delete_insn_and_edges where appropriate. Emit a new jump before the existing one instead of after so that delete_insn_and_edges removes the dead edges properly. Check any_condjump_p before calling record_jump_equiv. (cse_basic_block): Check any_condjump_p before calling record_jump_equiv. (cse_main): Don't set/check cse_altered. Remove USE_C_ALLOCA. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119209 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/cse.c43
2 files changed, 28 insertions, 29 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9d6addcb274..81328c39ad8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2006-11-25 Steven Bosscher <steven@gcc.gnu.org>
+
+ * cse.c (cse_altered): Remove.
+ (record_jump_equiv): Make true/false argument a bool instead
+ of an int.
+ (cse_insn): Don't set cse_altered. Use delete_insn_and_edges
+ where appropriate. Emit a new jump before the existing one
+ instead of after so that delete_insn_and_edges removes the
+ dead edges properly. Check any_condjump_p before calling
+ record_jump_equiv.
+ (cse_basic_block): Check any_condjump_p before calling
+ record_jump_equiv.
+ (cse_main): Don't set/check cse_altered. Remove USE_C_ALLOCA.
+
2006-11-25 Brooks Moses <brooks.moses@codesourcery.com>
* c.opt: Remove -ffixed-form, -ffixed-line-length-none, and
diff --git a/gcc/cse.c b/gcc/cse.c
index 15cc2d6a902..452757a3e47 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -371,11 +371,6 @@ static int max_uid;
#define INSN_CUID(INSN) (uid_cuid[INSN_UID (INSN)])
-/* Nonzero if this pass has made changes, and therefore it's
- worthwhile to run the garbage collector. */
-
-static int cse_altered;
-
/* Nonzero if cse has altered conditional jump insns
in such a way that jump optimization should be redone. */
@@ -603,7 +598,7 @@ static enum rtx_code find_comparison_args (enum rtx_code, rtx *, rtx *,
enum machine_mode *);
static rtx fold_rtx (rtx, rtx);
static rtx equiv_constant (rtx);
-static void record_jump_equiv (rtx, int);
+static void record_jump_equiv (rtx, bool);
static void record_jump_cond (enum rtx_code, enum machine_mode, rtx, rtx,
int);
static void cse_insn (rtx, rtx);
@@ -3694,8 +3689,8 @@ equiv_constant (rtx x)
return 0;
}
-/* Given INSN, a jump insn, PATH_TAKEN indicates if we are following the "taken"
- branch. It will be zero if not.
+/* Given INSN, a jump insn, TAKEN indicates if we are following the
+ "taken" branch.
In certain cases, this can cause us to add an equivalence. For example,
if we are following the taken case of
@@ -3706,7 +3701,7 @@ equiv_constant (rtx x)
comparison is seen later, we will know its value. */
static void
-record_jump_equiv (rtx insn, int taken)
+record_jump_equiv (rtx insn, bool taken)
{
int cond_known_true;
rtx op0, op1;
@@ -3716,8 +3711,8 @@ record_jump_equiv (rtx insn, int taken)
enum rtx_code code;
/* Ensure this is the right kind of insn. */
- if (! any_condjump_p (insn))
- return;
+ gcc_assert (any_condjump_p (insn));
+
set = pc_set (insn);
/* See if this jump condition is known true or false. */
@@ -4942,7 +4937,6 @@ cse_insn (rtx insn, rtx libcall_insn)
/* If we made a change, recompute SRC values. */
if (src != sets[i].src)
{
- cse_altered = 1;
do_not_record = 0;
hash_arg_in_memory = 0;
sets[i].src = src;
@@ -5044,7 +5038,7 @@ cse_insn (rtx insn, rtx libcall_insn)
else if (n_sets == 1 && dest == pc_rtx && src == pc_rtx)
{
/* One less use of the label this insn used to jump to. */
- delete_insn (insn);
+ delete_insn_and_edges (insn);
cse_jumps_altered = 1;
/* No more processing for this set. */
sets[i].rtl = 0;
@@ -5071,7 +5065,7 @@ cse_insn (rtx insn, rtx libcall_insn)
{
rtx new, note;
- new = emit_jump_insn_after (gen_jump (XEXP (src, 0)), insn);
+ new = emit_jump_insn_before (gen_jump (XEXP (src, 0)), insn);
JUMP_LABEL (new) = XEXP (src, 0);
LABEL_NUSES (XEXP (src, 0))++;
@@ -5083,7 +5077,7 @@ cse_insn (rtx insn, rtx libcall_insn)
REG_NOTES (new) = note;
}
- delete_insn (insn);
+ delete_insn_and_edges (insn);
insn = new;
/* Now emit a BARRIER after the unconditional jump. */
@@ -5636,10 +5630,8 @@ cse_insn (rtx insn, rtx libcall_insn)
/* If this is a conditional jump insn, record any known equivalences due to
the condition being tested. */
- if (JUMP_P (insn)
- && n_sets == 1 && GET_CODE (x) == SET
- && GET_CODE (SET_SRC (x)) == IF_THEN_ELSE)
- record_jump_equiv (insn, 0);
+ if (n_sets == 1 && any_condjump_p (insn))
+ record_jump_equiv (insn, false);
#ifdef HAVE_cc0
/* If the previous insn set CC0 and this insn no longer references CC0,
@@ -5649,7 +5641,7 @@ cse_insn (rtx insn, rtx libcall_insn)
&& (tem = single_set (prev_insn)) != 0
&& SET_DEST (tem) == cc0_rtx
&& ! reg_mentioned_p (cc0_rtx, x))
- delete_insn (prev_insn);
+ delete_insn_and_edges (prev_insn);
prev_insn_cc0 = this_insn_cc0;
prev_insn_cc0_mode = this_insn_cc0_mode;
@@ -6016,7 +6008,6 @@ cse_main (rtx f, int nregs)
insn = f;
while (insn)
{
- cse_altered = 0;
cse_end_of_basic_block (insn, &val, flag_cse_follow_jumps);
/* If this basic block was already processed or has no sets, skip it. */
@@ -6062,13 +6053,6 @@ cse_main (rtx f, int nregs)
cse_jumps_altered |= old_cse_jumps_altered;
}
-
- if (cse_altered)
- ggc_collect ();
-
-#ifdef USE_C_ALLOCA
- alloca (0);
-#endif
}
/* Clean up. */
@@ -6130,7 +6114,8 @@ cse_basic_block (rtx from, rtx to, struct branch_path *next_branch)
if (status != PATH_NOT_TAKEN)
{
gcc_assert (status == PATH_TAKEN);
- record_jump_equiv (insn, 1);
+ if (any_condjump_p (insn))
+ record_jump_equiv (insn, true);
/* Set the last insn as the jump insn; it doesn't affect cc0.
Then follow this branch. */