aboutsummaryrefslogtreecommitdiff
path: root/gcc/emit-rtl.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2000-02-28 09:51:42 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2000-02-28 09:51:42 +0000
commit18c038b9ca6f4e60c625636506cfe5a3290475a9 (patch)
treec60c5f52d93613b9b8942daef3cae9ee63895c8b /gcc/emit-rtl.c
parent8181bf427b0f5b094bf402e03304d66c64cdaf68 (diff)
downloadgcc-18c038b9ca6f4e60c625636506cfe5a3290475a9.zip
gcc-18c038b9ca6f4e60c625636506cfe5a3290475a9.tar.gz
gcc-18c038b9ca6f4e60c625636506cfe5a3290475a9.tar.bz2
emit-rtl.c (remove_unncessary_notes): Remove notes for empty blocks.
* emit-rtl.c (remove_unncessary_notes): Remove notes for empty blocks. * final.c (next_block_index): Remove. (max_block_depth): Likewise. (pending_blocks): Likewise. (init_final): Don't initialize them. (final_start_function): Don't set next_block_index. Set up BLOCK_NUMBER. (final_scan_insn): Use BLOCK_NUMBER, not next_block_index. * function.h (number_blocks): New function. * function.c (get_block_vector): New function. (identify_blocks): Use it. (reorder_blocks): Set NOTE_BLOCK. (number_blocks): New function. * tree.def (BLOCK): Add documentation for TREE_ASM_WRITTEN flag. * tree.h (BLOCK_NUMBER): New macro. (tree_block): Add block_num field. * dbxout.c (next_block_number): Remove. (dbxout_init): Don't set it. (dbxout_block): Only output blocks that have TREE_ASM_WRITTEN set. Use BLOCK_NUMBER, rather than next_block_num, to determine block numbers. * toplev.c (rest_of_compilation): Always call find_loop_tree_blocks. Fix indentation. * dwarf2out.c (next_block_number): Remove. (gen_lexical_block_die): Use BLOCK_NUMBER, not next_block_number, to determine block numbers. (gen_inlined_subroutine_die): Likewise. (gen_block_die): Only output blocks that have TREE_ASM_WRITTEN set. (decls_for_scope): Don't increment next_block_number. * dwarfout.c (next_block_number): Remove. (output_lexical_block_die): Use BLOCK_NUMBER, not next_block_number, to determine block numbers. (output_inlined_subroutine_die): Likewise. (output_block): Only output blocks that have TREE_ASM_WRITTEN set. (output_decls_for_scope): Don't increment next_block_number. * sdbout.c (next_block_number): Remove. (sdbout_block): Use BLOCK_NUMBER. (sdbout_begin_block): Simplify. * xcoffout.c (next_block_number): Remove. (xcoffout_block): Use BLOCK_NUMBER, not next_block_number. (xcoffout_begin_block): Don't set next_block_number. (xcoffout_begin_function): Likewise. Use BLOCK_NUMBER, not next_block_number. From-SVN: r32228
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r--gcc/emit-rtl.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index d6f736e..c6e5cb1 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -2681,6 +2681,48 @@ remove_unncessary_notes ()
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED)
remove_insn (insn);
+ else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END)
+ {
+ /* Scan back to see if there are any non-note instructions
+ between INSN and the beginning of this block. If not,
+ then there is no PC range in the generated code that will
+ actually be in this block, so there's no point in
+ remembering the existence of the block. */
+ rtx prev;
+
+ for (prev = PREV_INSN (insn); prev; prev = PREV_INSN (prev))
+ {
+ /* This block contains a real instruction. Note that we
+ don't include labels; if the only thing in the block
+ is a label, then there are still no PC values that
+ lie within the block. */
+ if (GET_RTX_CLASS (GET_CODE (prev)) == 'i')
+ break;
+
+ /* We're only interested in NOTEs. */
+ if (GET_CODE (prev) != NOTE)
+ continue;
+
+ if (NOTE_LINE_NUMBER (prev) == NOTE_INSN_BLOCK_BEG)
+ {
+ /* If the BLOCKs referred to by these notes don't
+ match, then something is wrong with our BLOCK
+ nesting structure. */
+ if (NOTE_BLOCK (prev) != NOTE_BLOCK (insn))
+ abort ();
+
+ remove_insn (prev);
+ remove_insn (insn);
+ break;
+ }
+ else if (NOTE_LINE_NUMBER (prev) == NOTE_INSN_BLOCK_END)
+ /* There's a nested block. We need to leave the
+ current block in place since otherwise the debugger
+ wouldn't be able to show symbols from our block in
+ the nested block. */
+ break;
+ }
+ }
}
}