diff options
author | Mark Mitchell <mark@codesourcery.com> | 2000-02-28 09:51:42 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2000-02-28 09:51:42 +0000 |
commit | 18c038b9ca6f4e60c625636506cfe5a3290475a9 (patch) | |
tree | c60c5f52d93613b9b8942daef3cae9ee63895c8b /gcc/final.c | |
parent | 8181bf427b0f5b094bf402e03304d66c64cdaf68 (diff) | |
download | gcc-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/final.c')
-rw-r--r-- | gcc/final.c | 95 |
1 files changed, 30 insertions, 65 deletions
diff --git a/gcc/final.c b/gcc/final.c index fc18f3c..1346b37 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -174,22 +174,6 @@ static rtx last_ignored_compare = 0; static int new_block = 1; -/* All the symbol-blocks (levels of scoping) in the compilation - are assigned sequence numbers in order of appearance of the - beginnings of the symbol-blocks. Both final and dbxout do this, - and assume that they will both give the same number to each block. - Final uses these sequence numbers to generate assembler label names - LBBnnn and LBEnnn for the beginning and end of the symbol-block. - Dbxout uses the sequence numbers to generate references to the same labels - from the dbx debugging information. - - Sdb records this level at the beginning of each function, - in order to find the current level when recursing down declarations. - It outputs the block beginning and endings - at the point in the asm file where the blocks would begin and end. */ - -int next_block_index; - /* Assign a unique number to each insn that is output. This can be used to generate unique local labels. */ @@ -229,18 +213,7 @@ int frame_pointer_needed; int profile_label_no; -/* Length so far allocated in PENDING_BLOCKS. */ - -static int max_block_depth; - -/* Stack of sequence numbers of symbol-blocks of which we have seen the - beginning but not yet the end. Sequence numbers are assigned at - the beginning; this stack allows us to find the sequence number - of a block that is ending. */ - -static int *pending_blocks; - -/* Number of elements currently in use in PENDING_BLOCKS. */ +/* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen. */ static int block_depth; @@ -320,10 +293,7 @@ void init_final (filename) const char *filename ATTRIBUTE_UNUSED; { - next_block_index = 2; app_on = 0; - max_block_depth = 20; - pending_blocks = (int *) xmalloc (20 * sizeof *pending_blocks); final_sequence = 0; #ifdef ASSEMBLER_DIALECT @@ -1667,16 +1637,23 @@ final_start_function (first, file, optimize) dwarf2out_frame_debug (NULL_RTX); #endif + /* If debugging, assign block numbers to all of the blocks in this + function. */ + if (write_symbols) + { + number_blocks (current_function_decl); + remove_unncessary_notes (); + /* We never actually put out begin/end notes for the top-level + block in the function. But, conceptually, that block is + always needed. */ + TREE_ASM_WRITTEN (DECL_INITIAL (current_function_decl)) = 1; + } + #ifdef FUNCTION_PROLOGUE /* First output the function prologue: code to set up the stack frame. */ FUNCTION_PROLOGUE (file, get_frame_size ()); #endif -#if defined (SDB_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO) - if (write_symbols == SDB_DEBUG || write_symbols == XCOFF_DEBUG) - next_block_index = 1; -#endif - /* If the machine represents the prologue as RTL, the profiling code must be emitted when NOTE_INSN_PROLOGUE_END is scanned. */ #ifdef HAVE_prologue @@ -2174,45 +2151,35 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) || write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG)) { - /* Beginning of a symbol-block. Assign it a sequence number - and push the number onto the stack PENDING_BLOCKS. */ - - if (block_depth == max_block_depth) - { - /* PENDING_BLOCKS is full; make it longer. */ - max_block_depth *= 2; - pending_blocks - = (int *) xrealloc (pending_blocks, - max_block_depth * sizeof (int)); - } - pending_blocks[block_depth++] = next_block_index; + int n = BLOCK_NUMBER (NOTE_BLOCK (insn)); + ++block_depth; high_block_linenum = last_linenum; /* Output debugging info about the symbol-block beginning. */ - #ifdef SDB_DEBUGGING_INFO if (write_symbols == SDB_DEBUG) - sdbout_begin_block (file, last_linenum, next_block_index); + sdbout_begin_block (file, last_linenum, n); #endif #ifdef XCOFF_DEBUGGING_INFO if (write_symbols == XCOFF_DEBUG) - xcoffout_begin_block (file, last_linenum, next_block_index); + xcoffout_begin_block (file, last_linenum, n); #endif #ifdef DBX_DEBUGGING_INFO if (write_symbols == DBX_DEBUG) - ASM_OUTPUT_INTERNAL_LABEL (file, "LBB", next_block_index); + ASM_OUTPUT_INTERNAL_LABEL (file, "LBB", n); #endif #ifdef DWARF_DEBUGGING_INFO if (write_symbols == DWARF_DEBUG) - dwarfout_begin_block (next_block_index); + dwarfout_begin_block (n); #endif #ifdef DWARF2_DEBUGGING_INFO if (write_symbols == DWARF2_DEBUG) - dwarf2out_begin_block (next_block_index); + dwarf2out_begin_block (n); #endif - next_block_index++; + /* Mark this block as output. */ + TREE_ASM_WRITTEN (NOTE_BLOCK (insn)) = 1; } else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END && (debug_info_level == DINFO_LEVEL_NORMAL @@ -2220,8 +2187,9 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) || write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG)) { - /* End of a symbol-block. Pop its sequence number off - PENDING_BLOCKS and output debugging info based on that. */ + int n = BLOCK_NUMBER (NOTE_BLOCK (insn)); + + /* End of a symbol-block. */ --block_depth; if (block_depth < 0) @@ -2229,26 +2197,23 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) #ifdef XCOFF_DEBUGGING_INFO if (write_symbols == XCOFF_DEBUG) - xcoffout_end_block (file, high_block_linenum, - pending_blocks[block_depth]); + xcoffout_end_block (file, high_block_linenum, n); #endif #ifdef DBX_DEBUGGING_INFO if (write_symbols == DBX_DEBUG) - ASM_OUTPUT_INTERNAL_LABEL (file, "LBE", - pending_blocks[block_depth]); + ASM_OUTPUT_INTERNAL_LABEL (file, "LBE", n); #endif #ifdef SDB_DEBUGGING_INFO if (write_symbols == SDB_DEBUG) - sdbout_end_block (file, high_block_linenum, - pending_blocks[block_depth]); + sdbout_end_block (file, high_block_linenum, n); #endif #ifdef DWARF_DEBUGGING_INFO if (write_symbols == DWARF_DEBUG) - dwarfout_end_block (pending_blocks[block_depth]); + dwarfout_end_block (n); #endif #ifdef DWARF2_DEBUGGING_INFO if (write_symbols == DWARF2_DEBUG) - dwarf2out_end_block (pending_blocks[block_depth]); + dwarf2out_end_block (n); #endif } else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL |