diff options
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 31 | ||||
-rw-r--r-- | gcc/dwarfout.c | 32 | ||||
-rw-r--r-- | gcc/emit-rtl.c | 14 | ||||
-rw-r--r-- | gcc/final.c | 5 | ||||
-rw-r--r-- | gcc/stmt.c | 30 | ||||
-rw-r--r-- | gcc/tree.h | 2 |
7 files changed, 52 insertions, 71 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 47fd0d2..752fbb9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2000-03-04 Jason Merrill <jason@casey.cygnus.com> + + * stmt.c (is_body_block): Move... + * dwarfout.c, dwarf2out.c: ...from here. + * tree.h: Declare it. + * emit-rtl.c (remove_unncessary_notes): Don't remove the body block. + * final.c (final_start_function): Do call remove_unnecessary_notes + when scheduling. + 2000-03-03 Zack Weinberg <zack@wolery.cumb.org> * config/vax/xm-vms.h: Define OBJECT_SUFFIX and EXECUTABLE_SUFFIX. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index cb8b723..26bb09b 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -2436,7 +2436,6 @@ static void output_pubnames PARAMS ((void)); static void add_arange PARAMS ((tree, dw_die_ref)); static void output_aranges PARAMS ((void)); static void output_line_info PARAMS ((void)); -static int is_body_block PARAMS ((tree)); static dw_die_ref base_type_die PARAMS ((tree)); static tree root_type PARAMS ((tree)); static int is_base_type PARAMS ((tree)); @@ -5924,36 +5923,6 @@ output_line_info () ASM_OUTPUT_LABEL (asm_out_file, ".LTEND"); } -/* Given a pointer to a BLOCK node return non-zero if (and only if) the node - in question represents the outermost pair of curly braces (i.e. the "body - block") of a function or method. - - For any BLOCK node representing a "body block" of a function or method, the - BLOCK_SUPERCONTEXT of the node will point to another BLOCK node which - represents the outermost (function) scope for the function or method (i.e. - the one which includes the formal parameters). The BLOCK_SUPERCONTEXT of - *that* node in turn will point to the relevant FUNCTION_DECL node. */ - -static inline int -is_body_block (stmt) - register tree stmt; -{ - if (TREE_CODE (stmt) == BLOCK) - { - register tree parent = BLOCK_SUPERCONTEXT (stmt); - - if (TREE_CODE (parent) == BLOCK) - { - register tree grandparent = BLOCK_SUPERCONTEXT (parent); - - if (TREE_CODE (grandparent) == FUNCTION_DECL) - return 1; - } - } - - return 0; -} - /* Given a pointer to a tree node for some base type, return a pointer to a DIE that describes the given type. diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index d639eb9..9d41379 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -318,7 +318,6 @@ static tree decl_class_context PARAMS ((tree)); static void output_unsigned_leb128 PARAMS ((unsigned long)); static void output_signed_leb128 PARAMS ((long)); #endif -static inline int is_body_block PARAMS ((tree)); static int fundamental_type_code PARAMS ((tree)); static tree root_type_1 PARAMS ((tree, int)); static tree root_type PARAMS ((tree)); @@ -1282,37 +1281,6 @@ output_signed_leb128 (value) /**************** utility functions for attribute functions ******************/ -/* Given a pointer to a BLOCK node return non-zero if (and only if) the - node in question represents the outermost pair of curly braces (i.e. - the "body block") of a function or method. - - For any BLOCK node representing a "body block" of a function or method, - the BLOCK_SUPERCONTEXT of the node will point to another BLOCK node - which represents the outermost (function) scope for the function or - method (i.e. the one which includes the formal parameters). The - BLOCK_SUPERCONTEXT of *that* node in turn will point to the relevant - FUNCTION_DECL node. -*/ - -static inline int -is_body_block (stmt) - register tree stmt; -{ - if (TREE_CODE (stmt) == BLOCK) - { - register tree parent = BLOCK_SUPERCONTEXT (stmt); - - if (TREE_CODE (parent) == BLOCK) - { - register tree grandparent = BLOCK_SUPERCONTEXT (parent); - - if (TREE_CODE (grandparent) == FUNCTION_DECL) - return 1; - } - } - return 0; -} - /* Given a pointer to a tree node for some type, return a Dwarf fundamental type code for the given type. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index f43a181..27b8374 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -2711,10 +2711,16 @@ remove_unncessary_notes () if (NOTE_BLOCK (prev) != NOTE_BLOCK (insn)) abort (); - debug_ignore_block (NOTE_BLOCK (insn)); - - remove_insn (prev); - remove_insn (insn); + /* Never delete the BLOCK for the outermost scope + of the function; we can refer to names from + that scope even if the block notes are messed up. */ + if (! is_body_block (NOTE_BLOCK (insn))) + { + debug_ignore_block (NOTE_BLOCK (insn)); + + remove_insn (prev); + remove_insn (insn); + } break; } else if (NOTE_LINE_NUMBER (prev) == NOTE_INSN_BLOCK_END) diff --git a/gcc/final.c b/gcc/final.c index d5a1a30..948ecd3 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1644,10 +1644,7 @@ final_start_function (first, file, optimize) if (write_symbols) { number_blocks (current_function_decl); - /* Scheduling packs block notes together at the top of a basic block, - so we can't learn anything from them. */ - if (! flag_schedule_insns && ! flag_schedule_insns_after_reload) - remove_unncessary_notes (); + 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. */ @@ -3310,6 +3310,36 @@ expand_end_target_temps () pop_temp_slots (); } +/* Given a pointer to a BLOCK node return non-zero if (and only if) the node + in question represents the outermost pair of curly braces (i.e. the "body + block") of a function or method. + + For any BLOCK node representing a "body block" of a function or method, the + BLOCK_SUPERCONTEXT of the node will point to another BLOCK node which + represents the outermost (function) scope for the function or method (i.e. + the one which includes the formal parameters). The BLOCK_SUPERCONTEXT of + *that* node in turn will point to the relevant FUNCTION_DECL node. */ + +int +is_body_block (stmt) + register tree stmt; +{ + if (TREE_CODE (stmt) == BLOCK) + { + tree parent = BLOCK_SUPERCONTEXT (stmt); + + if (parent && TREE_CODE (parent) == BLOCK) + { + tree grandparent = BLOCK_SUPERCONTEXT (parent); + + if (grandparent && TREE_CODE (grandparent) == FUNCTION_DECL) + return 1; + } + } + + return 0; +} + /* Mark top block of block_stack as an implicit binding for an exception region. This is used to prevent infinite recursion when ending a binding with expand_end_bindings. It is only ever called @@ -2178,6 +2178,8 @@ extern void expand_end_bindings PARAMS ((tree, int, int)); extern void warn_about_unused_variables PARAMS ((tree)); extern void start_cleanup_deferral PARAMS ((void)); extern void end_cleanup_deferral PARAMS ((void)); +extern int is_body_block PARAMS ((tree)); + extern void mark_block_as_eh_region PARAMS ((void)); extern void mark_block_as_not_eh_region PARAMS ((void)); extern int is_eh_region PARAMS ((void)); |