aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAnthony Green <green@cygnus.com>2000-02-26 02:54:36 +0000
committerJeff Law <law@gcc.gnu.org>2000-02-25 19:54:36 -0700
commit44a76fc8563b63bbd0ce06e607136746841f4d8f (patch)
treea130b6dc3441ac75d72a58d539e738978bf10bb6 /gcc
parent0e9137bb1ffffa72428077af6678e11e440c6e4b (diff)
downloadgcc-44a76fc8563b63bbd0ce06e607136746841f4d8f.zip
gcc-44a76fc8563b63bbd0ce06e607136746841f4d8f.tar.gz
gcc-44a76fc8563b63bbd0ce06e607136746841f4d8f.tar.bz2
toplev.c (rest_of_compilation): Rebuild jump labels if combine_instructions has created a new direct jump.
* toplev.c (rest_of_compilation): Rebuild jump labels if combine_instructions has created a new direct jump. * combine.c (try_combine): Add new_direct_jump_p argument. Set it when appropriate. (combine_instructions): Call try_combine with new argument. Return non-null value when new direct jump instruction is created. * rtl.h: combine_instructions returns an int. From-SVN: r32162
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/combine.c61
-rw-r--r--gcc/rtl.h2
-rw-r--r--gcc/toplev.c16
4 files changed, 69 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e3f100c..0823934 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2000-02-25 Anthony Green <green@cygnus.com>
+
+ * toplev.c (rest_of_compilation): Rebuild jump labels if
+ combine_instructions has created a new direct jump.
+ * combine.c (try_combine): Add new_direct_jump_p argument. Set it
+ when appropriate.
+ (combine_instructions): Call try_combine with new argument.
+ Return non-null value when new direct jump instruction is created.
+ * rtl.h: combine_instructions returns an int.
+
Fri Feb 25 19:49:08 2000 Jeffrey A Law (law@cygnus.com)
* cse.c (cse_insn): Replace the PATTERN of the insn with an new
diff --git a/gcc/combine.c b/gcc/combine.c
index fd07574..d24ef18 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -359,7 +359,7 @@ static int can_combine_p PARAMS ((rtx, rtx, rtx, rtx, rtx *, rtx *));
static int sets_function_arg_p PARAMS ((rtx));
static int combinable_i3pat PARAMS ((rtx, rtx *, rtx, rtx, int, rtx *));
static int contains_muldiv PARAMS ((rtx));
-static rtx try_combine PARAMS ((rtx, rtx, rtx));
+static rtx try_combine PARAMS ((rtx, rtx, rtx, int *));
static void undo_all PARAMS ((void));
static void undo_commit PARAMS ((void));
static rtx *find_split_point PARAMS ((rtx *, rtx));
@@ -480,9 +480,11 @@ do_SUBST_INT(into, newval)
#define SUBST_INT(INTO, NEWVAL) do_SUBST_INT(&(INTO), (NEWVAL))
/* Main entry point for combiner. F is the first insn of the function.
- NREGS is the first unused pseudo-reg number. */
+ NREGS is the first unused pseudo-reg number.
-void
+ Return non-zero if the combiner has turned an indirect jump
+ instruction into a direct jump. */
+int
combine_instructions (f, nregs)
rtx f;
int nregs;
@@ -494,6 +496,8 @@ combine_instructions (f, nregs)
register int i;
register rtx links, nextlinks;
+ int new_direct_jump_p = 0;
+
combine_attempts = 0;
combine_merges = 0;
combine_extras = 0;
@@ -617,7 +621,8 @@ combine_instructions (f, nregs)
/* Try this insn with each insn it links back to. */
for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
- if ((next = try_combine (insn, XEXP (links, 0), NULL_RTX)) != 0)
+ if ((next = try_combine (insn, XEXP (links, 0),
+ NULL_RTX, &new_direct_jump_p)) != 0)
goto retry;
/* Try each sequence of three linked insns ending with this one. */
@@ -626,7 +631,8 @@ combine_instructions (f, nregs)
for (nextlinks = LOG_LINKS (XEXP (links, 0)); nextlinks;
nextlinks = XEXP (nextlinks, 1))
if ((next = try_combine (insn, XEXP (links, 0),
- XEXP (nextlinks, 0))) != 0)
+ XEXP (nextlinks, 0),
+ &new_direct_jump_p)) != 0)
goto retry;
#ifdef HAVE_cc0
@@ -642,13 +648,15 @@ combine_instructions (f, nregs)
&& GET_CODE (prev) == INSN
&& sets_cc0_p (PATTERN (prev)))
{
- if ((next = try_combine (insn, prev, NULL_RTX)) != 0)
+ if ((next = try_combine (insn, prev,
+ NULL_RTX, &new_direct_jump_p)) != 0)
goto retry;
for (nextlinks = LOG_LINKS (prev); nextlinks;
nextlinks = XEXP (nextlinks, 1))
if ((next = try_combine (insn, prev,
- XEXP (nextlinks, 0))) != 0)
+ XEXP (nextlinks, 0),
+ &new_direct_jump_p)) != 0)
goto retry;
}
@@ -660,13 +668,15 @@ combine_instructions (f, nregs)
&& GET_CODE (PATTERN (insn)) == SET
&& reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (insn))))
{
- if ((next = try_combine (insn, prev, NULL_RTX)) != 0)
+ if ((next = try_combine (insn, prev,
+ NULL_RTX, &new_direct_jump_p)) != 0)
goto retry;
for (nextlinks = LOG_LINKS (prev); nextlinks;
nextlinks = XEXP (nextlinks, 1))
if ((next = try_combine (insn, prev,
- XEXP (nextlinks, 0))) != 0)
+ XEXP (nextlinks, 0),
+ &new_direct_jump_p)) != 0)
goto retry;
}
@@ -680,7 +690,8 @@ combine_instructions (f, nregs)
&& (prev = prev_nonnote_insn (XEXP (links, 0))) != 0
&& GET_CODE (prev) == INSN
&& sets_cc0_p (PATTERN (prev))
- && (next = try_combine (insn, XEXP (links, 0), prev)) != 0)
+ && (next = try_combine (insn, XEXP (links, 0),
+ prev, &new_direct_jump_p)) != 0)
goto retry;
#endif
@@ -690,7 +701,8 @@ combine_instructions (f, nregs)
for (nextlinks = XEXP (links, 1); nextlinks;
nextlinks = XEXP (nextlinks, 1))
if ((next = try_combine (insn, XEXP (links, 0),
- XEXP (nextlinks, 0))) != 0)
+ XEXP (nextlinks, 0),
+ &new_direct_jump_p)) != 0)
goto retry;
if (GET_CODE (insn) != NOTE)
@@ -742,6 +754,8 @@ combine_instructions (f, nregs)
/* Make recognizer allow volatile MEMs again. */
init_recog ();
+
+ return new_direct_jump_p;
}
/* Wipe the reg_last_xxx arrays in preparation for another pass. */
@@ -1426,11 +1440,15 @@ contains_muldiv (x)
Return 0 if the combination does not work. Then nothing is changed.
If we did the combination, return the insn at which combine should
- resume scanning. */
+ resume scanning.
+
+ Set NEW_DIRECT_JUMP_P to a non-zero value if try_combine creates a
+ new direct jump instruction. */
static rtx
-try_combine (i3, i2, i1)
+try_combine (i3, i2, i1, new_direct_jump_p)
register rtx i3, i2, i1;
+ register int *new_direct_jump_p;
{
/* New patterns for I3 and I3, respectively. */
rtx newpat, newi2pat = 0;
@@ -2684,14 +2702,21 @@ try_combine (i3, i2, i1)
if (newi2pat)
note_stores (newi2pat, set_nonzero_bits_and_sign_copies, NULL);
- /* If I3 is now an unconditional jump, ensure that it has a
+ /* Set new_direct_jump_p if a new return or simple jump instruction
+ has been created.
+
+ If I3 is now an unconditional jump, ensure that it has a
BARRIER following it since it may have initially been a
conditional jump. It may also be the last nonnote insn. */
+
+ if (GET_CODE (newpat) == RETURN || simplejump_p (i3))
+ {
+ *new_direct_jump_p = 1;
- if ((GET_CODE (newpat) == RETURN || simplejump_p (i3))
- && ((temp = next_nonnote_insn (i3)) == NULL_RTX
- || GET_CODE (temp) != BARRIER))
- emit_barrier_after (i3);
+ if ((temp = next_nonnote_insn (i3)) == NULL_RTX
+ || GET_CODE (temp) != BARRIER)
+ emit_barrier_after (i3);
+ }
}
combine_successes++;
diff --git a/gcc/rtl.h b/gcc/rtl.h
index d3ca9b0..af67efb 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1470,7 +1470,7 @@ extern void remove_unncessary_notes PARAMS ((void));
extern void add_clobbers PARAMS ((rtx, int));
/* In combine.c */
-extern void combine_instructions PARAMS ((rtx, int));
+extern int combine_instructions PARAMS ((rtx, int));
extern int extended_count PARAMS ((rtx, enum machine_mode, int));
extern rtx remove_death PARAMS ((int, rtx));
#ifdef BUFSIZ
diff --git a/gcc/toplev.c b/gcc/toplev.c
index ada79f9..058ccfa 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -3311,7 +3311,21 @@ rest_of_compilation (decl)
if (optimize > 0)
{
- TIMEVAR (combine_time, combine_instructions (insns, max_reg_num ()));
+ int rebuild_jump_labels_after_combine = 0;
+
+ TIMEVAR (combine_time,
+ {
+ rebuild_jump_labels_after_combine =
+ combine_instructions (insns, max_reg_num ());
+ });
+
+ /* Combining insns may have turned an indirect jump into a
+ direct jump. Rebuid the JUMP_LABEL fields of jumping
+ instructions. */
+ if (rebuild_jump_labels_after_combine)
+ {
+ TIMEVAR (jump_time, rebuild_jump_labels (insns));
+ }
/* Dump rtl code after insn combination. */