diff options
author | Jason Merrill <jason@casey.cygnus.com> | 2000-03-04 09:32:35 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2000-03-04 04:32:35 -0500 |
commit | deb5e2801f7c307c0c0d225fd244741c7635deeb (patch) | |
tree | 7dbe32baf99950bdd8c71c770cc96d2bfec358e9 /gcc/stmt.c | |
parent | e8965a187162a2da95e059a6ef3d16a68258d046 (diff) | |
download | gcc-deb5e2801f7c307c0c0d225fd244741c7635deeb.zip gcc-deb5e2801f7c307c0c0d225fd244741c7635deeb.tar.gz gcc-deb5e2801f7c307c0c0d225fd244741c7635deeb.tar.bz2 |
stmt.c (is_body_block): Move...
* 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.
From-SVN: r32324
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r-- | gcc/stmt.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -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 |