aboutsummaryrefslogtreecommitdiff
path: root/gcc/treelang/treetree.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2004-07-11 10:53:06 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2004-07-11 10:53:06 +0100
commit9dcf6e7366cda28e32258e576e09337818c8bb05 (patch)
tree9bfd7630da8e5c58f26e9976e1d534d1c74544c6 /gcc/treelang/treetree.c
parentfae1b38dc82248b70271f42647fa92b82ca6e200 (diff)
downloadgcc-9dcf6e7366cda28e32258e576e09337818c8bb05.zip
gcc-9dcf6e7366cda28e32258e576e09337818c8bb05.tar.gz
gcc-9dcf6e7366cda28e32258e576e09337818c8bb05.tar.bz2
langhooks.h (estimate_num_insns, [...]): Remove hooks.
* langhooks.h (estimate_num_insns, pushlevel, poplevel, set_block, maybe_build_cleanup, update_decl_after_saving): Remove hooks. * langhooks.c (lhd_clear_binding_stack): Remove. * langhooks-def.h (lhd_clear_binding_stack, LANG_HOOKS_MAYBE_BUILD_CLEANUP, LANG_HOOKS_UPDATE_DECL_AFTER_SAVING, LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS, LANG_HOOKS_PUSHLEVEL, LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK): Remove. (LANG_HOOKS_CLEAR_BINDING_STACK): Define to lhd_do_nothing. * system.h (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS, LANG_HOOKS_PUSHLEVEL, LANG_HOOKS_SET_BLOCK, LANG_HOOKS_MAYBE_BUILD_CLEANUP, LANG_HOOKS_UPDATE_DECL_AFTER_SAVING, LANG_HOOKS_POPLEVEL): Poison. * tree.h (poplevel): Don't declare. * c-lang.c (LANG_HOOKS_CLEAR_BINDING_STACK, LANG_HOOKS_PUSHLEVEL, LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK): Remove. * objc/objc-lang.c (LANG_HOOKS_CLEAR_BINDING_STACK, LANG_HOOKS_PUSHLEVEL, LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK): Remove. ada: * misc.c (LANG_HOOKS_CLEAR_BINDING_STACK, LANG_HOOKS_PUSHLEVEL, LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK): Remove. cp: * cp-lang.c (LANG_HOOKS_MAYBE_BUILD_CLEANUP, LANG_HOOKS_PUSHLEVEL, LANG_HOOKS_POPLEVEL, LANG_HOOKS_UPDATE_DECL_AFTER_SAVING): Remove. * cp-tree.h (poplevel): Declare. (set_block): Remove. * decl.c (set_block): Remove. fortran: * f95-lang.c (set_block): Remove. (gfc_clear_binding_stack): New. (LANG_HOOKS_CLEAR_BINDING_STACK): Define. (struct binding_level): Remove block_created_by_back_end. (clear_binding_level): Likewise. (poplevel): Don't handle block_created_by_back_end. java: * java-tree.h (set_block): Remove. * lang.c (java_clear_binding_stack): New. (LANG_HOOKS_CLEAR_BINDING_STACK): Define. * decl.c (struct binding_level): Remove this_block. (clear_binding_level): Likewise. (poplevel): Don't handle this_block. (set_block): Remove. treelang: * treetree.c (set_block): Remove. (struct binding_level): Remove block_created_by_back_end. (clear_binding_level): Likewise. (tree_code_create_function_initial, tree_code_create_function_wrapup): Call pushlevel and poplevel directly rather than through hooks. (poplevel): Don't handle block_created_by_back_end. From-SVN: r84499
Diffstat (limited to 'gcc/treelang/treetree.c')
-rw-r--r--gcc/treelang/treetree.c49
1 files changed, 8 insertions, 41 deletions
diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c
index 1819ad9..2fa6643 100644
--- a/gcc/treelang/treetree.c
+++ b/gcc/treelang/treetree.c
@@ -135,7 +135,6 @@ void pushlevel (int ignore);
tree poplevel (int keep, int reverse, int functionbody);
int global_bindings_p (void);
void insert_block (tree block);
-void set_block (tree block);
tree pushdecl (tree decl);
tree getdecls (void);
int kept_level_p (void);
@@ -451,7 +450,7 @@ tree_code_create_function_initial (tree prev_saved,
/* Function.c requires a push at the start of the function. that
looks like a bug to me but let's make it happy. */
- (*lang_hooks.decls.pushlevel) (0);
+ pushlevel (0);
/* Create rtl for the start of a new scope. */
@@ -482,7 +481,7 @@ tree_code_create_function_initial (tree prev_saved,
/* Add a new level to the debugger symbol table. */
- (*lang_hooks.decls.pushlevel) (0);
+ pushlevel (0);
/* Create rtl for the start of a new scope. */
@@ -504,7 +503,7 @@ tree_code_create_function_wrapup (location_t loc)
/* Get completely built level from debugger symbol table. */
- block = (*lang_hooks.decls.poplevel) (1, 0, 0);
+ block = poplevel (1, 0, 0);
/* Emit rtl for end of scope. */
@@ -516,7 +515,7 @@ tree_code_create_function_wrapup (location_t loc)
/* Pop the level. */
- block = (*lang_hooks.decls.poplevel) (1, 0, 1);
+ block = poplevel (1, 0, 1);
/* And attach it to the function. */
@@ -1057,14 +1056,6 @@ struct binding_level
/* For each level (except the global one), a chain of BLOCK nodes for all
the levels that were entered and exited one level down from this one. */
tree blocks;
- /* The back end may need, for its own internal processing, to create a BLOCK
- node. This field is set aside for this purpose. If this field is non-null
- when the level is popped, i.e. when poplevel is invoked, we will use such
- block instead of creating a new one from the 'names' field, that is the
- ..._DECL nodes accumulated so far. Typically the routine 'pushlevel'
- will be called before setting this field, so that if the front-end had
- inserted ..._DECL nodes in the current block they will not be lost. */
- tree block_created_by_back_end;
/* The binding level containing this one (the enclosing binding level). */
struct binding_level *level_chain;
};
@@ -1077,7 +1068,7 @@ static struct binding_level *current_binding_level = NULL;
static struct binding_level *global_binding_level;
/* Binding level structures are initialized by copying this one. */
-static struct binding_level clear_binding_level = {NULL, NULL, NULL, NULL};
+static struct binding_level clear_binding_level = {NULL, NULL, NULL };
/* Return non-zero if we are currently in the global binding level. */
@@ -1145,7 +1136,6 @@ poplevel (int keep, int reverse, int functionbody)
tree decl_chain;
tree subblock_chain = current_binding_level->blocks;
tree subblock_node;
- tree block_created_by_back_end;
/* Reverse the list of *_DECL nodes if desired. Note that the ..._DECL
nodes chained through the `names' field of current_binding_level are in
@@ -1154,23 +1144,10 @@ poplevel (int keep, int reverse, int functionbody)
decl_chain = (reverse) ? nreverse (current_binding_level->names)
: current_binding_level->names;
- block_created_by_back_end = current_binding_level->block_created_by_back_end;
- if (block_created_by_back_end != 0)
- {
- block_node = block_created_by_back_end;
-
- /* Check if we are about to discard some information that was gathered
- by the front-end. Nameley check if the back-end created a new block
- without calling pushlevel first. To understand why things are lost
- just look at the next case (i.e. no block created by back-end. */
- if ((keep || functionbody) && (decl_chain || subblock_chain))
- abort ();
- }
-
/* If there were any declarations in the current binding level, or if this
binding level is a function body, or if there are any nested blocks then
create a BLOCK node to record them for the life of this function. */
- else if (keep || functionbody)
+ if (keep || functionbody)
block_node = build_block (keep ? decl_chain : 0, 0, subblock_chain, 0, 0);
/* Record the BLOCK node just built as the subblock its enclosing scope. */
@@ -1207,9 +1184,8 @@ poplevel (int keep, int reverse, int functionbody)
}
else if (block_node)
{
- if (block_created_by_back_end == NULL)
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, block_node);
+ current_binding_level->blocks
+ = chainon (current_binding_level->blocks, block_node);
}
/* If we did not make a block for the level just exited, any blocks made for
@@ -1237,15 +1213,6 @@ insert_block (tree block)
= chainon (current_binding_level->blocks, block);
}
-/* Set the BLOCK node for the innermost scope
- (the one we are currently in). */
-
-void
-set_block (tree block)
-{
- current_binding_level->block_created_by_back_end = block;
-}
-
/* Records a ..._DECL node DECL as belonging to the current lexical scope.
Returns the ..._DECL node. */