OSDN Git Service

PR middle-end/18730
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 5 Dec 2004 04:05:59 +0000 (04:05 +0000)
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 5 Dec 2004 04:05:59 +0000 (04:05 +0000)
* 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
gcc/emit-rtl.c

index 3e609a3..e889dbc 100644 (file)
@@ -1,5 +1,10 @@
 2004-12-04  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
+       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.
index 6858f98..793e2df 100644 (file)
@@ -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;
 }