From f86e856ec5e11858bae4ddde742550a6b18a91be Mon Sep 17 00:00:00 2001 From: danglin Date: Sun, 5 Dec 2004 04:05:59 +0000 Subject: [PATCH] PR middle-end/18730 * emit-rtl.c (get_first_nonnote_insn, get_last_nonnote_insn): When the first/last insn is a sequence, return the first/last insn of the sequence. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91742 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/emit-rtl.c | 37 +++++++++++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3e609a37c23..e889dbc82e8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2004-12-04 John David Anglin + PR middle-end/18730 + * emit-rtl.c (get_first_nonnote_insn, get_last_nonnote_insn): When + the first/last insn is a sequence, return the first/last insn of the + sequence. + PR bootstrap/18804 * mklibgcc.in (vis_hide): Use implementation instead of declaration for test function. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 6858f987ad6..793e2df8da4 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -2712,9 +2712,23 @@ get_last_insn_anywhere (void) rtx get_first_nonnote_insn (void) { - rtx insn; + rtx insn = first_insn; + + if (insn) + { + if (NOTE_P (insn)) + for (insn = next_insn (insn); + insn && NOTE_P (insn); + insn = next_insn (insn)) + continue; + else + { + if (GET_CODE (insn) == INSN + && GET_CODE (PATTERN (insn)) == SEQUENCE) + insn = XVECEXP (PATTERN (insn), 0, 0); + } + } - for (insn = first_insn; insn && NOTE_P (insn); insn = next_insn (insn)); return insn; } @@ -2724,9 +2738,24 @@ get_first_nonnote_insn (void) rtx get_last_nonnote_insn (void) { - rtx insn; + rtx insn = last_insn; + + if (insn) + { + if (NOTE_P (insn)) + for (insn = previous_insn (insn); + insn && NOTE_P (insn); + insn = previous_insn (insn)) + continue; + else + { + if (GET_CODE (insn) == INSN + && GET_CODE (PATTERN (insn)) == SEQUENCE) + insn = XVECEXP (PATTERN (insn), 0, + XVECLEN (PATTERN (insn), 0) - 1); + } + } - for (insn = last_insn; insn && NOTE_P (insn); insn = previous_insn (insn)); return insn; } -- 2.11.0