diff options
author | Joseph Myers <jsm@polyomino.org.uk> | 2004-07-11 10:53:06 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2004-07-11 10:53:06 +0100 |
commit | 9dcf6e7366cda28e32258e576e09337818c8bb05 (patch) | |
tree | 9bfd7630da8e5c58f26e9976e1d534d1c74544c6 /gcc/fortran/f95-lang.c | |
parent | fae1b38dc82248b70271f42647fa92b82ca6e200 (diff) | |
download | gcc-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/fortran/f95-lang.c')
-rw-r--r-- | gcc/fortran/f95-lang.c | 54 |
1 files changed, 16 insertions, 38 deletions
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 43eb87d..f867e65 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -103,7 +103,7 @@ static bool gfc_mark_addressable (tree); void do_function_end (void); int global_bindings_p (void); void insert_block (tree); -void set_block (tree); +static void gfc_clear_binding_stack (void); static void gfc_be_parse_file (int); static void gfc_expand_function (tree); @@ -123,6 +123,7 @@ static void gfc_expand_function (tree); #undef LANG_HOOKS_SIGNED_TYPE #undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE #undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION +#undef LANG_HOOKS_CLEAR_BINDING_STACK /* Define lang hooks. */ #define LANG_HOOKS_NAME "GNU F95" @@ -141,6 +142,7 @@ static void gfc_expand_function (tree); #define LANG_HOOKS_SIGNED_TYPE gfc_signed_type #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE gfc_signed_or_unsigned_type #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION gfc_expand_function +#define LANG_HOOKS_CLEAR_BINDING_STACK gfc_clear_binding_stack const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; @@ -334,14 +336,6 @@ GTY(()) /* 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; }; @@ -354,7 +348,7 @@ static GTY(()) struct binding_level *current_binding_level = NULL; static GTY(()) 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. */ @@ -412,7 +406,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 XXXX_DECL nodes if desired. Note that the ..._DECL nodes chained through the `names' field of current_binding_level are in @@ -421,24 +414,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. */ @@ -475,9 +454,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 @@ -505,15 +483,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. */ @@ -562,6 +531,15 @@ pushdecl_top_level (tree x) } +/* Clear the binding stack. */ +static void +gfc_clear_binding_stack (void) +{ + while (!global_bindings_p ()) + poplevel (0, 0, 0); +} + + #ifndef CHAR_TYPE_SIZE #define CHAR_TYPE_SIZE BITS_PER_UNIT #endif |