From 9dcf6e7366cda28e32258e576e09337818c8bb05 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Sun, 11 Jul 2004 10:53:06 +0100 Subject: 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 --- gcc/ChangeLog | 22 ++++++++++++++++++++ gcc/ada/ChangeLog | 5 +++++ gcc/ada/misc.c | 8 -------- gcc/c-lang.c | 10 +-------- gcc/cp/ChangeLog | 8 ++++++++ gcc/cp/cp-lang.c | 8 -------- gcc/cp/cp-tree.h | 2 +- gcc/cp/decl.c | 10 --------- gcc/fortran/ChangeLog | 9 +++++++++ gcc/fortran/f95-lang.c | 54 +++++++++++++++---------------------------------- gcc/java/ChangeLog | 10 +++++++++ gcc/java/decl.c | 29 +++----------------------- gcc/java/java-tree.h | 1 - gcc/java/lang.c | 13 ++++++++++++ gcc/langhooks-def.h | 18 ++--------------- gcc/langhooks.c | 9 --------- gcc/langhooks.h | 22 -------------------- gcc/objc/objc-lang.c | 10 +-------- gcc/system.h | 6 +++++- gcc/tree.h | 4 ---- gcc/treelang/ChangeLog | 10 +++++++++ gcc/treelang/treetree.c | 49 ++++++++------------------------------------ 22 files changed, 114 insertions(+), 203 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index efd1f24..e1790dc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,27 @@ 2004-07-11 Joseph S. Myers + * 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. + +2004-07-11 Joseph S. Myers + PR tree-optimization/16437 * c-common.c (shorten_compare): Don't mark result of conversion to narrower signed type as overflowing. diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c4c7c5f..55fc42a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2004-07-11 Joseph S. Myers + + * misc.c (LANG_HOOKS_CLEAR_BINDING_STACK, LANG_HOOKS_PUSHLEVEL, + LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK): Remove. + 2004-07-08 Richard Henderson * trans.c (gnat_to_gnu ): Update diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index 5f2200b..9d0e31e 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -123,14 +123,6 @@ static void gnat_adjust_rli (record_layout_info); #define LANG_HOOKS_HONOR_READONLY true #undef LANG_HOOKS_HASH_TYPES #define LANG_HOOKS_HASH_TYPES false -#undef LANG_HOOKS_CLEAR_BINDING_STACK -#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_do_nothing -#undef LANG_HOOKS_PUSHLEVEL -#define LANG_HOOKS_PUSHLEVEL lhd_do_nothing_i -#undef LANG_HOOKS_POPLEVEL -#define LANG_HOOKS_POPLEVEL lhd_do_nothing_iii_return_null_tree -#undef LANG_HOOKS_SET_BLOCK -#define LANG_HOOKS_SET_BLOCK lhd_do_nothing_t #undef LANG_HOOKS_GETDECLS #define LANG_HOOKS_GETDECLS lhd_return_null_tree_v #undef LANG_HOOKS_PUSHDECL diff --git a/gcc/c-lang.c b/gcc/c-lang.c index 1a3b250..cf516b2 100644 --- a/gcc/c-lang.c +++ b/gcc/c-lang.c @@ -66,8 +66,6 @@ enum c_language_kind c_language = clk_c; #define LANG_HOOKS_MARK_ADDRESSABLE c_mark_addressable #undef LANG_HOOKS_PARSE_FILE #define LANG_HOOKS_PARSE_FILE c_common_parse_file -#undef LANG_HOOKS_CLEAR_BINDING_STACK -#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_do_nothing #undef LANG_HOOKS_TRUTHVALUE_CONVERSION #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_objc_common_truthvalue_conversion #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL @@ -136,15 +134,9 @@ enum c_language_kind c_language = clk_c; /* The C front end's scoping structure is very different from that expected by the language-independent code; it is best - to disable all of pushlevel, poplevel, set_block, and getdecls. + to disable getdecls. This means it must also provide its own write_globals. */ -#undef LANG_HOOKS_PUSHLEVEL -#define LANG_HOOKS_PUSHLEVEL lhd_do_nothing_i -#undef LANG_HOOKS_POPLEVEL -#define LANG_HOOKS_POPLEVEL lhd_do_nothing_iii_return_null_tree -#undef LANG_HOOKS_SET_BLOCK -#define LANG_HOOKS_SET_BLOCK lhd_do_nothing_t #undef LANG_HOOKS_GETDECLS #define LANG_HOOKS_GETDECLS lhd_return_null_tree_v #undef LANG_HOOKS_WRITE_GLOBALS diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2639623..0c0219a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2004-07-11 Joseph S. Myers + + * 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. + 2004-07-10 Mike Stump * decl2.c (import_export_class): Never export/import vtables diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 5e403d8..5f38fbb 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -76,8 +76,6 @@ static void cxx_initialize_diagnostics (diagnostic_context *); #define LANG_HOOKS_PARSE_FILE c_common_parse_file #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL cxx_dup_lang_specific_decl -#undef LANG_HOOKS_MAYBE_BUILD_CLEANUP -#define LANG_HOOKS_MAYBE_BUILD_CLEANUP cxx_maybe_build_cleanup #undef LANG_HOOKS_TRUTHVALUE_CONVERSION #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_common_truthvalue_conversion #undef LANG_HOOKS_UNSAFE_FOR_REEVAL @@ -100,16 +98,10 @@ static void cxx_initialize_diagnostics (diagnostic_context *); #define LANG_HOOKS_DECL_PRINTABLE_NAME cxx_printable_name #undef LANG_HOOKS_PRINT_ERROR_FUNCTION #define LANG_HOOKS_PRINT_ERROR_FUNCTION cxx_print_error_function -#undef LANG_HOOKS_PUSHLEVEL -#define LANG_HOOKS_PUSHLEVEL lhd_do_nothing_i -#undef LANG_HOOKS_POPLEVEL -#define LANG_HOOKS_POPLEVEL lhd_do_nothing_iii_return_null_tree #undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL cxx_warn_unused_global_decl #undef LANG_HOOKS_WRITE_GLOBALS #define LANG_HOOKS_WRITE_GLOBALS lhd_do_nothing -#undef LANG_HOOKS_UPDATE_DECL_AFTER_SAVING -#define LANG_HOOKS_UPDATE_DECL_AFTER_SAVING cp_update_decl_after_saving #undef LANG_HOOKS_FUNCTION_INIT diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 59133c1..415553c 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3672,8 +3672,8 @@ extern void clone_function_decl (tree, int); extern void adjust_clone_args (tree); /* decl.c */ +extern tree poplevel (int, int, int); extern void insert_block (tree); -extern void set_block (tree); extern tree pushdecl (tree); extern void cxx_init_decl_processing (void); enum cp_tree_node_structure_enum cp_tree_node_structure diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f17f91c..6f701ca 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -735,16 +735,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 ATTRIBUTE_UNUSED ) -{ - /* The RTL expansion machinery requires us to provide this callback, - but it is not applicable in function-at-a-time mode. */ -} - /* Returns nonzero if T is a virtual function table. */ int diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 39057f3..f8d176c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2004-07-11 Joseph S. Myers + + * 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. + 2004-07-10 Tobias Schlueter * trans-decl.c (gfc_create_module_variable): Nothing to do if 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 diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 6934f07..c6966eb 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,13 @@ +2004-07-11 Joseph S. Myers + + * 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. + 2004-07-10 Bryce McKinlay * class.c (common_enclosing_context_p): Remove statement with no diff --git a/gcc/java/decl.c b/gcc/java/decl.c index 5f2771d..b028967 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -299,10 +299,6 @@ struct binding_level GTY(()) that were entered and exited one level down. */ tree blocks; - /* The BLOCK node for this level, if one has been preallocated. - If 0, the BLOCK is allocated (if needed) when the level is popped. */ - tree this_block; - /* The binding level which this one is contained in (inherits from). */ struct binding_level *level_chain; @@ -348,7 +344,6 @@ static const struct binding_level clear_binding_level NULL_TREE, /* names */ NULL_TREE, /* shadowed */ NULL_TREE, /* blocks */ - NULL_TREE, /* this_lock */ NULL_BINDING_LEVEL, /* level_chain */ LARGEST_PC, /* end_pc */ 0, /* start_pc */ @@ -1276,7 +1271,6 @@ poplevel (int keep, int reverse, int functionbody) tree block = 0; tree decl; tree bind = 0; - int block_previously_created; #if defined(DEBUG_JAVA_BINDING_LEVELS) binding_depth--; @@ -1319,10 +1313,7 @@ poplevel (int keep, int reverse, int functionbody) create a BLOCK to record them for the life of this function. */ block = 0; - block_previously_created = (current_binding_level->this_block != 0); - if (block_previously_created) - block = current_binding_level->this_block; - else if (keep || functionbody) + if (keep || functionbody) { block = make_node (BLOCK); TREE_TYPE (block) = void_type_node; @@ -1466,9 +1457,8 @@ poplevel (int keep, int reverse, int functionbody) { if (block) { - if (!block_previously_created) - current_binding_level->blocks - = chainon (current_binding_level->blocks, block); + current_binding_level->blocks + = chainon (current_binding_level->blocks, block); } /* If we did not make a block for the level just exited, any blocks made for inner levels @@ -1571,19 +1561,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->this_block = block; - current_binding_level->names = chainon (current_binding_level->names, - BLOCK_VARS (block)); - current_binding_level->blocks = chainon (current_binding_level->blocks, - BLOCK_SUBBLOCKS (block)); -} - /* integrate_decl_tree calls this function. */ void diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index d9e6415..2cf9145 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -1171,7 +1171,6 @@ extern tree getdecls (void); extern void pushlevel (int); extern tree poplevel (int,int, int); extern void insert_block (tree); -extern void set_block (tree); extern tree pushdecl (tree); extern void java_init_decl_processing (void); extern void java_dup_lang_specific_decl (tree); diff --git a/gcc/java/lang.c b/gcc/java/lang.c index b50977e..d3ba372 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -67,6 +67,7 @@ static bool java_dump_tree (void *, tree); static void dump_compound_expr (dump_info_p, tree); static bool java_decl_ok_for_sibcall (tree); static tree java_get_callee_fndecl (tree); +static void java_clear_binding_stack (void); #ifndef TARGET_OBJECT_SUFFIX # define TARGET_OBJECT_SUFFIX ".o" @@ -264,6 +265,9 @@ struct language_function GTY(()) #undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION java_expand_body +#undef LANG_HOOKS_CLEAR_BINDING_STACK +#define LANG_HOOKS_CLEAR_BINDING_STACK java_clear_binding_stack + /* Each front end provides its own. */ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; @@ -1160,4 +1164,13 @@ java_get_callee_fndecl (tree call_expr) return NULL; } + +/* Clear the binding stack. */ +static void +java_clear_binding_stack (void) +{ + while (!global_bindings_p ()) + poplevel (0, 0, 0); +} + #include "gt-java-lang.h" diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index 85c77e5..c57f34a 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -52,7 +52,6 @@ extern tree lhd_do_nothing_iii_return_null_tree (int, int, int); extern int lhd_safe_from_p (rtx, tree); extern int lhd_staticp (tree); extern int lhd_unsafe_for_reeval (tree); -extern void lhd_clear_binding_stack (void); extern void lhd_print_tree_nothing (FILE *, tree, int); extern const char *lhd_decl_printable_name (tree, int); extern int lhd_types_compatible_p (tree, tree); @@ -97,7 +96,7 @@ extern int lhd_gimplify_expr (tree *, tree *, tree *); #define LANG_HOOKS_INIT hook_bool_void_false #define LANG_HOOKS_FINISH lhd_do_nothing #define LANG_HOOKS_PARSE_FILE lhd_do_nothing_i -#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_clear_binding_stack +#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_do_nothing #define LANG_HOOKS_INIT_OPTIONS hook_uint_uint_constcharptrptr_0 #define LANG_HOOKS_INITIALIZE_DIAGNOSTICS lhd_initialize_diagnostics #define LANG_HOOKS_HANDLE_OPTION hook_int_size_t_constcharptr_int_0 @@ -113,7 +112,6 @@ extern int lhd_gimplify_expr (tree *, tree *, tree *); #define LANG_HOOKS_STATICP lhd_staticp #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL lhd_do_nothing_t #define LANG_HOOKS_UNSAVE_EXPR_NOW lhd_unsave_expr_now -#define LANG_HOOKS_MAYBE_BUILD_CLEANUP lhd_return_null_tree #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lhd_set_decl_assembler_name #define LANG_HOOKS_CAN_USE_BIT_FIELDS_P lhd_can_use_bit_fields_p #define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS false @@ -130,7 +128,6 @@ extern int lhd_gimplify_expr (tree *, tree *, tree *); #define LANG_HOOKS_EXPR_SIZE lhd_expr_size #define LANG_HOOKS_TREE_SIZE lhd_tree_size #define LANG_HOOKS_TYPES_COMPATIBLE_P lhd_types_compatible_p -#define LANG_HOOKS_UPDATE_DECL_AFTER_SAVING NULL #define LANG_HOOKS_FUNCTION_INIT lhd_do_nothing_f #define LANG_HOOKS_FUNCTION_FINAL lhd_do_nothing_f @@ -165,8 +162,6 @@ extern int lhd_gimplify_expr (tree *, tree *, tree *); lhd_tree_inlining_end_inlining #define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \ lhd_tree_inlining_convert_parm_for_inlining -#define LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \ - NULL #define LANG_HOOKS_TREE_INLINING_INITIALIZER { \ LANG_HOOKS_TREE_INLINING_WALK_SUBTREES, \ @@ -179,8 +174,7 @@ extern int lhd_gimplify_expr (tree *, tree *, tree *); LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P, \ LANG_HOOKS_TREE_INLINING_START_INLINING, \ LANG_HOOKS_TREE_INLINING_END_INLINING, \ - LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING, \ - LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \ + LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \ } #define LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR lhd_callgraph_analyze_expr @@ -240,11 +234,8 @@ extern tree lhd_make_node (enum tree_code); } /* Declaration hooks. */ -#define LANG_HOOKS_PUSHLEVEL pushlevel -#define LANG_HOOKS_POPLEVEL poplevel #define LANG_HOOKS_GLOBAL_BINDINGS_P global_bindings_p #define LANG_HOOKS_INSERT_BLOCK insert_block -#define LANG_HOOKS_SET_BLOCK set_block #define LANG_HOOKS_PUSHDECL pushdecl #define LANG_HOOKS_GETDECLS getdecls #define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl @@ -253,11 +244,8 @@ extern tree lhd_make_node (enum tree_code); #define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall #define LANG_HOOKS_DECLS { \ - LANG_HOOKS_PUSHLEVEL, \ - LANG_HOOKS_POPLEVEL, \ LANG_HOOKS_GLOBAL_BINDINGS_P, \ LANG_HOOKS_INSERT_BLOCK, \ - LANG_HOOKS_SET_BLOCK, \ LANG_HOOKS_PUSHDECL, \ LANG_HOOKS_GETDECLS, \ LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \ @@ -292,7 +280,6 @@ extern tree lhd_make_node (enum tree_code); LANG_HOOKS_STATICP, \ LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \ LANG_HOOKS_UNSAVE_EXPR_NOW, \ - LANG_HOOKS_MAYBE_BUILD_CLEANUP, \ LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, \ LANG_HOOKS_CAN_USE_BIT_FIELDS_P, \ LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS, \ @@ -308,7 +295,6 @@ extern tree lhd_make_node (enum tree_code); LANG_HOOKS_GET_CALLEE_FNDECL, \ LANG_HOOKS_PRINT_ERROR_FUNCTION, \ LANG_HOOKS_EXPR_SIZE, \ - LANG_HOOKS_UPDATE_DECL_AFTER_SAVING, \ LANG_HOOKS_ATTRIBUTE_TABLE, \ LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, \ LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, \ diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 1400a6c..c5a23f0 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -205,15 +205,6 @@ lhd_can_use_bit_fields_p (void) return true; } -/* Provide a default routine to clear the binding stack. This is used - by languages that don't need to do anything special. */ -void -lhd_clear_binding_stack (void) -{ - while (! lang_hooks.decls.global_bindings_p ()) - lang_hooks.decls.poplevel (0, 0, 0); -} - /* Type promotion for variable arguments. */ tree lhd_type_promotes_to (tree type ATTRIBUTE_UNUSED) diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 4400aa3..1669eb2 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -47,7 +47,6 @@ struct lang_hooks_for_tree_inlining int (*start_inlining) (tree); void (*end_inlining) (tree); tree (*convert_parm_for_inlining) (tree, tree, tree, int); - int (*estimate_num_insns) (tree); }; struct lang_hooks_for_callgraph @@ -155,17 +154,6 @@ struct lang_hooks_for_types struct lang_hooks_for_decls { - /* Enter a new lexical scope. Argument is always zero when called - from outside the front end. */ - void (*pushlevel) (int); - - /* Exit a lexical scope and return a BINDING for that scope. - Takes three arguments: - KEEP -- nonzero if there were declarations in this scope. - REVERSE -- reverse the order of decls before returning them. - FUNCTIONBODY -- nonzero if this level is the body of a function. */ - tree (*poplevel) (int, int, int); - /* Returns nonzero if we are in the global binding level. Ada returns -1 for an undocumented reason used in stor-layout.c. */ int (*global_bindings_p) (void); @@ -175,9 +163,6 @@ struct lang_hooks_for_decls to handle the BLOCK node inside the BIND_EXPR. */ void (*insert_block) (tree); - /* Set the BLOCK node for the current scope level. */ - void (*set_block) (tree); - /* Function to add a decl to the current scope level. Takes one argument, a decl to add. Returns that decl, or, if the same symbol is already declared, may return a different decl for that @@ -332,10 +317,6 @@ struct lang_hooks things are cleared out. */ tree (*unsave_expr_now) (tree); - /* Called by expand_expr to build and return the cleanup-expression - for the passed TARGET_EXPR. Return NULL if there is none. */ - tree (*maybe_build_cleanup) (tree); - /* Set the DECL_ASSEMBLER_NAME for a node. If it is the sort of thing that the assembler should talk about, set DECL_ASSEMBLER_NAME to an appropriate IDENTIFIER_NODE. @@ -398,9 +379,6 @@ struct lang_hooks semantics in cases that it doesn't want to handle specially. */ tree (*expr_size) (tree); - /* Update lang specific fields after duplicating function body. */ - void (*update_decl_after_saving) (tree, void *); - /* Pointers to machine-independent attribute tables, for front ends using attribs.c. If one is NULL, it is ignored. Respectively, a table of attributes specific to the language, a table of diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c index c5d099b..0220073 100644 --- a/gcc/objc/objc-lang.c +++ b/gcc/objc/objc-lang.c @@ -57,8 +57,6 @@ enum c_language_kind c_language = clk_objc; #define LANG_HOOKS_GET_ALIAS_SET c_common_get_alias_set #undef LANG_HOOKS_PARSE_FILE #define LANG_HOOKS_PARSE_FILE c_common_parse_file -#undef LANG_HOOKS_CLEAR_BINDING_STACK -#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_do_nothing #undef LANG_HOOKS_EXPAND_EXPR #define LANG_HOOKS_EXPAND_EXPR c_expand_expr #undef LANG_HOOKS_EXPAND_DECL @@ -135,15 +133,9 @@ enum c_language_kind c_language = clk_objc; /* The C front end's scoping structure is very different from that expected by the language-independent code; it is best - to disable all of pushlevel, poplevel, set_block, and getdecls. + to disable getdecls. This means it must also provide its own write_globals. */ -#undef LANG_HOOKS_PUSHLEVEL -#define LANG_HOOKS_PUSHLEVEL lhd_do_nothing_i -#undef LANG_HOOKS_POPLEVEL -#define LANG_HOOKS_POPLEVEL lhd_do_nothing_iii_return_null_tree -#undef LANG_HOOKS_SET_BLOCK -#define LANG_HOOKS_SET_BLOCK lhd_do_nothing_t #undef LANG_HOOKS_GETDECLS #define LANG_HOOKS_GETDECLS lhd_return_null_tree_v #undef LANG_HOOKS_WRITE_GLOBALS diff --git a/gcc/system.h b/gcc/system.h index c23a349..367c51e 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -626,7 +626,11 @@ extern int snprintf (char *, size_t, const char *, ...); /* Hooks that are no longer used. */ #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \ - LANG_HOOKS_MARK_TREE LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES + LANG_HOOKS_MARK_TREE LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES \ + 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 /* Libiberty macros that are no longer used in GCC. */ #undef ANSI_PROTOTYPES diff --git a/gcc/tree.h b/gcc/tree.h index 5c9c048..2f79ad7 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3311,10 +3311,6 @@ extern GTY(()) tree current_file_decl; extern int all_types_permanent; -/* Exit a binding level. This function is provided by each language - frontend. */ -extern tree poplevel (int, int, int); - /* Declare a predefined function. Return the declaration. This function is provided by each language frontend. */ extern tree builtin_function (const char *, tree, int, enum built_in_class, diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog index fb70e8a..bd6955f 100644 --- a/gcc/treelang/ChangeLog +++ b/gcc/treelang/ChangeLog @@ -1,3 +1,13 @@ +2004-07-11 Joseph S. Myers + + * 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. + 2004-04-07 Richard Henderson * treetree.c (tree_mark_addressable): Don't put_var_into_stack. 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. */ -- cgit v1.1