aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/cfgbuild.c2
-rw-r--r--gcc/cfgrtl.c4
-rw-r--r--gcc/emit-rtl.c69
-rw-r--r--gcc/lra.c2
-rw-r--r--gcc/rtl.h4
6 files changed, 58 insertions, 37 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 54df8c0..6d0a64e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2017-12-12 Alexandre Oliva <aoliva@redhat.com>
+
+ * emit-rtl.c (next_nondebug_insn, prev_nondebug_insn): Reorder.
+ (next_nonnote_nondebug_insn, prev_nonnote_nondebug_insn): Reorder.
+ (next_nonnote_nondebug_insn_bb): New.
+ (prev_nonnote_nondebug_insn_bb): New.
+ (prev_nonnote_insn_bb, next_nonnote_insn_bb): Remove.
+ * rtl.h (prev_nonnote_insn_bb, next_nonnote_insn_bb): Remove decls.
+ (prev_nonnote_nondebug_insn_bb): Declare.
+ (next_nonnote_nondebug_insn_bb): Declare.
+ * cfgbuild.c (find_bb_boundaries): Adjust to skip debug insns.
+ * cfgrtl.c (get_last_bb_insn): Likewise.
+ * lra.c (push_insns): Likewise.
+
2017-12-11 David Malcolm <dmalcolm@redhat.com>
PR c/82050
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index a092675..77a221d 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -511,7 +511,7 @@ find_bb_boundaries (basic_block bb)
the middle of a BB. We need to split it in the same manner as
if the barrier were preceded by a control_flow_insn_p insn. */
if (!flow_transfer_insn)
- flow_transfer_insn = prev_nonnote_insn_bb (insn);
+ flow_transfer_insn = prev_nonnote_nondebug_insn_bb (insn);
}
if (control_flow_insn_p (insn))
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index a2ad075..eb673a1 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2285,11 +2285,11 @@ get_last_bb_insn (basic_block bb)
end = table;
/* Include any barriers that may follow the basic block. */
- tmp = next_nonnote_insn_bb (end);
+ tmp = next_nonnote_nondebug_insn_bb (end);
while (tmp && BARRIER_P (tmp))
{
end = tmp;
- tmp = next_nonnote_insn_bb (end);
+ tmp = next_nonnote_nondebug_insn_bb (end);
}
return end;
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 428e474..42de598 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3370,20 +3370,17 @@ next_nonnote_insn (rtx_insn *insn)
return insn;
}
-/* Return the next insn after INSN that is not a NOTE, but stop the
- search before we enter another basic block. This routine does not
- look inside SEQUENCEs. */
+/* Return the next insn after INSN that is not a DEBUG_INSN. This
+ routine does not look inside SEQUENCEs. */
rtx_insn *
-next_nonnote_insn_bb (rtx_insn *insn)
+next_nondebug_insn (rtx_insn *insn)
{
while (insn)
{
insn = NEXT_INSN (insn);
- if (insn == 0 || !NOTE_P (insn))
+ if (insn == 0 || !DEBUG_INSN_P (insn))
break;
- if (NOTE_INSN_BASIC_BLOCK_P (insn))
- return NULL;
}
return insn;
@@ -3405,67 +3402,70 @@ prev_nonnote_insn (rtx_insn *insn)
return insn;
}
-/* Return the previous insn before INSN that is not a NOTE, but stop
- the search before we enter another basic block. This routine does
- not look inside SEQUENCEs. */
+/* Return the previous insn before INSN that is not a DEBUG_INSN.
+ This routine does not look inside SEQUENCEs. */
rtx_insn *
-prev_nonnote_insn_bb (rtx_insn *insn)
+prev_nondebug_insn (rtx_insn *insn)
{
-
while (insn)
{
insn = PREV_INSN (insn);
- if (insn == 0 || !NOTE_P (insn))
+ if (insn == 0 || !DEBUG_INSN_P (insn))
break;
- if (NOTE_INSN_BASIC_BLOCK_P (insn))
- return NULL;
}
return insn;
}
-/* Return the next insn after INSN that is not a DEBUG_INSN. This
- routine does not look inside SEQUENCEs. */
+/* Return the next insn after INSN that is not a NOTE nor DEBUG_INSN.
+ This routine does not look inside SEQUENCEs. */
rtx_insn *
-next_nondebug_insn (rtx_insn *insn)
+next_nonnote_nondebug_insn (rtx_insn *insn)
{
while (insn)
{
insn = NEXT_INSN (insn);
- if (insn == 0 || !DEBUG_INSN_P (insn))
+ if (insn == 0 || (!NOTE_P (insn) && !DEBUG_INSN_P (insn)))
break;
}
return insn;
}
-/* Return the previous insn before INSN that is not a DEBUG_INSN.
- This routine does not look inside SEQUENCEs. */
+/* Return the next insn after INSN that is not a NOTE nor DEBUG_INSN,
+ but stop the search before we enter another basic block. This
+ routine does not look inside SEQUENCEs. */
rtx_insn *
-prev_nondebug_insn (rtx_insn *insn)
+next_nonnote_nondebug_insn_bb (rtx_insn *insn)
{
while (insn)
{
- insn = PREV_INSN (insn);
- if (insn == 0 || !DEBUG_INSN_P (insn))
+ insn = NEXT_INSN (insn);
+ if (insn == 0)
+ break;
+ if (DEBUG_INSN_P (insn))
+ continue;
+ if (!NOTE_P (insn))
break;
+ if (NOTE_INSN_BASIC_BLOCK_P (insn))
+ return NULL;
}
return insn;
}
-/* Return the next insn after INSN that is not a NOTE nor DEBUG_INSN.
+/* Return the previous insn before INSN that is not a NOTE nor DEBUG_INSN.
This routine does not look inside SEQUENCEs. */
rtx_insn *
-next_nonnote_nondebug_insn (rtx_insn *insn)
+prev_nonnote_nondebug_insn (rtx_insn *insn)
{
while (insn)
{
- insn = NEXT_INSN (insn);
+ insn = PREV_INSN (insn);
if (insn == 0 || (!NOTE_P (insn) && !DEBUG_INSN_P (insn)))
break;
}
@@ -3473,17 +3473,24 @@ next_nonnote_nondebug_insn (rtx_insn *insn)
return insn;
}
-/* Return the previous insn before INSN that is not a NOTE nor DEBUG_INSN.
- This routine does not look inside SEQUENCEs. */
+/* Return the previous insn before INSN that is not a NOTE nor
+ DEBUG_INSN, but stop the search before we enter another basic
+ block. This routine does not look inside SEQUENCEs. */
rtx_insn *
-prev_nonnote_nondebug_insn (rtx_insn *insn)
+prev_nonnote_nondebug_insn_bb (rtx_insn *insn)
{
while (insn)
{
insn = PREV_INSN (insn);
- if (insn == 0 || (!NOTE_P (insn) && !DEBUG_INSN_P (insn)))
+ if (insn == 0)
break;
+ if (DEBUG_INSN_P (insn))
+ continue;
+ if (!NOTE_P (insn))
+ break;
+ if (NOTE_INSN_BASIC_BLOCK_P (insn))
+ return NULL;
}
return insn;
diff --git a/gcc/lra.c b/gcc/lra.c
index 3fd15ee..f790904 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -1806,7 +1806,7 @@ push_insns (rtx_insn *from, rtx_insn *to)
static void
setup_sp_offset (rtx_insn *from, rtx_insn *last)
{
- rtx_insn *before = next_nonnote_insn_bb (last);
+ rtx_insn *before = next_nonnote_nondebug_insn_bb (last);
HOST_WIDE_INT offset = (before == NULL_RTX || ! INSN_P (before)
? 0 : lra_get_insn_recog_data (before)->sp_offset);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 8de5a1c..9cc9821 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3085,13 +3085,13 @@ extern rtx_call_insn *last_call_insn (void);
extern rtx_insn *previous_insn (rtx_insn *);
extern rtx_insn *next_insn (rtx_insn *);
extern rtx_insn *prev_nonnote_insn (rtx_insn *);
-extern rtx_insn *prev_nonnote_insn_bb (rtx_insn *);
extern rtx_insn *next_nonnote_insn (rtx_insn *);
-extern rtx_insn *next_nonnote_insn_bb (rtx_insn *);
extern rtx_insn *prev_nondebug_insn (rtx_insn *);
extern rtx_insn *next_nondebug_insn (rtx_insn *);
extern rtx_insn *prev_nonnote_nondebug_insn (rtx_insn *);
+extern rtx_insn *prev_nonnote_nondebug_insn_bb (rtx_insn *);
extern rtx_insn *next_nonnote_nondebug_insn (rtx_insn *);
+extern rtx_insn *next_nonnote_nondebug_insn_bb (rtx_insn *);
extern rtx_insn *prev_real_insn (rtx_insn *);
extern rtx_insn *next_real_insn (rtx);
extern rtx_insn *prev_active_insn (rtx_insn *);