re PR middle-end/18730 (cppexp.c:1076: error: unrecognizable insn)
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Sun, 5 Dec 2004 04:05:59 +0000 (04:05 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sun, 5 Dec 2004 04:05:59 +0000 (04:05 +0000)
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.

From-SVN: r91742

gcc/ChangeLog
gcc/emit-rtl.c

index 3e609a37c2357e24f3b0f22e5418d2be46016c11..e889dbc82e89c305aa0a1ba38becaea6f573d1cc 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 6858f987ad6ea9251a46d14a9a5b4b963954ddaa..793e2df8da466a3bbd87e463f20429af74994ad3 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;
 }