function.h (insert_block_after_note): Declare.
authorMark Mitchell <mark@codesourcery.com>
Sun, 5 Dec 1999 00:13:53 +0000 (00:13 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 5 Dec 1999 00:13:53 +0000 (00:13 +0000)
* function.h (insert_block_after_note): Declare.
* function.c (insert_block_after_note): Split out from ...
(retrofit_block): ... here.

From-SVN: r30776

gcc/ChangeLog
gcc/function.c
gcc/function.h

index 2aec5f0ade2a173bf5636ea34b9afcf22f0bd536..8b26d1bdb08541f28d0840d1d0142db6a7c9a9ec 100644 (file)
@@ -1,5 +1,9 @@
 1999-12-04  Mark Mitchell  <mark@codesourcery.com>
 
+       * function.h (insert_block_after_note): Declare.
+       * function.c (insert_block_after_note): Split out from ...
+       (retrofit_block): ... here.
+
        * stmt.c (expand_fixup): Fix typo in comment.
 
 Sat Dec  4 14:13:38 MET 1999  Jan Hubicka  <hubicka@freesoft.cz>
index 587fdfffe7dfd923055fecf4ba905e0f83d85e31..67f5e4161ef01164f1dd145fc569e949d2fbb548 100644 (file)
@@ -5482,6 +5482,37 @@ round_trampoline_addr (tramp)
   return tramp;
 }
 \f
+/* Insert the BLOCK in the block-tree, knowing that the previous
+   block-note is for OLD_BLOCK.  BEGIN_P is non-zero if the previous
+   block-note was the for the beginning of a BLOCK.  FN is the
+   FUNCTION_DECL into which the BLOCK is being inserted.  */
+
+void 
+insert_block_after_note (block, old_block, begin_p, fn)
+     tree block;
+     tree old_block;
+     int begin_p;
+     tree fn;
+{
+  if (begin_p)
+    {
+      /* If there was no previous block, use the top-level block for
+        the function.  */
+      if (!old_block)
+       old_block = DECL_INITIAL (fn);
+
+      BLOCK_SUPERCONTEXT (block) = old_block;
+      BLOCK_CHAIN (block) = BLOCK_SUBBLOCKS (old_block);
+      BLOCK_SUBBLOCKS (old_block) = block;
+    }
+  else
+    {
+      BLOCK_SUPERCONTEXT (block) = BLOCK_SUPERCONTEXT (old_block);
+      BLOCK_CHAIN (block) = BLOCK_CHAIN (old_block);
+      BLOCK_CHAIN (old_block) = block;
+    }
+}
+
 /* Insert the BLOCK in the block-tree before LAST_INSN.  */
 
 void
@@ -5502,27 +5533,13 @@ retrofit_block (block, last_insn)
        && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG
            || NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END))
       break;
-  if (!insn || NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
-    {
-      tree superblock;
 
-      if (insn)
-       superblock = NOTE_BLOCK (insn);
-      else
-       superblock = DECL_INITIAL (current_function_decl);
-
-      BLOCK_SUPERCONTEXT (block) = superblock;
-      BLOCK_CHAIN (block) = BLOCK_SUBBLOCKS (superblock);
-      BLOCK_SUBBLOCKS (superblock) = block;
-    }
-  else
-    {
-      tree prevblock = NOTE_BLOCK (insn);
-
-      BLOCK_SUPERCONTEXT (block) = BLOCK_SUPERCONTEXT (prevblock);
-      BLOCK_CHAIN (block) = BLOCK_CHAIN (prevblock);
-      BLOCK_CHAIN (prevblock) = block;
-    }
+  insert_block_after_note (block, 
+                          insn ? NOTE_BLOCK (insn) : NULL_TREE,
+                          insn 
+                          ? (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
+                          : 1,
+                          current_function_decl);
 }
 
 /* The functions identify_blocks and reorder_blocks provide a way to
index 3c912bcf7ba5ca9c9c4bb558a13df43f7a80ce16..dc0b507e5d1501d434edaa32f2ceeb54f25579c6 100644 (file)
@@ -541,6 +541,11 @@ extern struct function *outer_function_chain;
    Also store in each NOTE for the beginning or end of a block
    the index of that block in the vector.  */
 extern void identify_blocks PROTO((tree, rtx));
+/* Insert the BLOCK in the block-tree, knowing that the previous
+   block-note is for OLD_BLOCK.  BEGIN_P is non-zero if the previous
+   block-note was the for the beginning of a BLOCK.  FN is the
+   FUNCTION_DECL into which the BLOCK is being inserted.  */
+extern void insert_block_after_note PROTO((tree, tree, int, tree));
 /* Insert a new BLOCK at an appropriate place in the block tree.  */
 extern void retrofit_block PROTO((tree, rtx));