(adjust_copied_decl_tree): New function.
authorRichard Stallman <rms@gnu.org>
Sat, 29 Aug 1992 03:21:11 +0000 (03:21 +0000)
committerRichard Stallman <rms@gnu.org>
Sat, 29 Aug 1992 03:21:11 +0000 (03:21 +0000)
(save_for_inline_copying):  When making copies of NOTE_INSN_BLOCK_END
notes, stash a "forwarding" pointer in the original to point to the
copy.  Also, when all BLOCKs & insns for a function have been copied,
call `adjust_copied_decl_tree' to fixup the end_note pointers in the
copied BLOCKs.

From-SVN: r1991

gcc/integrate.c

index ba03ecf5c49cc94bc954af18603ddd4d2aad843a..ca915434a630e74ea104cfa42ae84ceada235187 100644 (file)
@@ -331,6 +331,30 @@ finish_inline (fndecl, head)
   DECL_INLINE (fndecl) = 1;
 }
 
+/* Adjust the BLOCK_END_NOTE pointers in a given copied DECL tree so that
+   they all point to the new (copied) rtxs.  */
+
+static void
+adjust_copied_decl_tree (block)
+     register tree block;
+{
+  register tree subblock;
+  register rtx original_end;
+
+  original_end = BLOCK_END_NOTE (block);
+  if (original_end)
+    {
+      BLOCK_END_NOTE (block) = (rtx) NOTE_SOURCE_FILE (original_end);
+      NOTE_SOURCE_FILE (original_end) = 0;
+    }
+
+  /* Process all subblocks.  */
+  for (subblock = BLOCK_SUBBLOCKS (block);
+       subblock;
+       subblock = TREE_CHAIN (subblock))
+    adjust_copied_decl_tree (subblock);
+}
+
 /* Make the insns and PARM_DECLs of the current function permanent
    and record other information in DECL_SAVED_INSNS to allow inlining
    of this function in subsequent calls.
@@ -509,8 +533,14 @@ save_for_inline_copying (fndecl)
            continue;
 
          copy = rtx_alloc (NOTE);
-         NOTE_SOURCE_FILE (copy) = NOTE_SOURCE_FILE (insn);
          NOTE_LINE_NUMBER (copy) = NOTE_LINE_NUMBER (insn);
+         if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_BLOCK_END)
+           NOTE_SOURCE_FILE (copy) = NOTE_SOURCE_FILE (insn);
+         else
+           {
+             NOTE_SOURCE_FILE (insn) = (char *) copy;
+             NOTE_SOURCE_FILE (copy) = 0;
+           }
          break;
 
        case INSN:
@@ -542,6 +572,8 @@ save_for_inline_copying (fndecl)
       last_insn = copy;
     }
 
+  adjust_copied_decl_tree (DECL_INITIAL (fndecl));
+
   /* Now copy the REG_NOTES.  */
   for (insn = NEXT_INSN (get_insns ()); insn; insn = NEXT_INSN (insn))
     if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'