aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-12-05 00:13:53 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-12-05 00:13:53 +0000
commit4ce893648569539981c77058e89108a9461217ab (patch)
tree4c623881730c17325e6c2b7f1279503b27e53cd1
parent12f612289556bf30dd2d25854feec38ab43c7f73 (diff)
downloadgcc-4ce893648569539981c77058e89108a9461217ab.zip
gcc-4ce893648569539981c77058e89108a9461217ab.tar.gz
gcc-4ce893648569539981c77058e89108a9461217ab.tar.bz2
function.h (insert_block_after_note): Declare.
* function.h (insert_block_after_note): Declare. * function.c (insert_block_after_note): Split out from ... (retrofit_block): ... here. From-SVN: r30776
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/function.c57
-rw-r--r--gcc/function.h5
3 files changed, 46 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2aec5f0..8b26d1b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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>
diff --git a/gcc/function.c b/gcc/function.c
index 587fdff..67f5e41 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5482,6 +5482,37 @@ round_trampoline_addr (tramp)
return tramp;
}
+/* 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
diff --git a/gcc/function.h b/gcc/function.h
index 3c912bc..dc0b507 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -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));