From 4ce893648569539981c77058e89108a9461217ab Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sun, 5 Dec 1999 00:13:53 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 4 ++++ gcc/function.c | 57 ++++++++++++++++++++++++++++++++------------------ gcc/function.h | 5 +++++ 3 files changed, 46 insertions(+), 20 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2aec5f0ade2..8b26d1bdb08 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 1999-12-04 Mark Mitchell + * 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 diff --git a/gcc/function.c b/gcc/function.c index 587fdfffe7d..67f5e4161ef 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 3c912bcf7ba..dc0b507e5d1 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));