+2004-07-11 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * 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 <jsm@polyomino.org.uk>
PR tree-optimization/16437
+2004-07-11 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * misc.c (LANG_HOOKS_CLEAR_BINDING_STACK, LANG_HOOKS_PUSHLEVEL,
+ LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK): Remove.
+
2004-07-08 Richard Henderson <rth@redhat.com>
* trans.c (gnat_to_gnu <N_Handled_Sequence_Of_Statements>): Update
#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
#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
/* 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
+2004-07-11 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * 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 <mrs@apple.com>
* decl2.c (import_export_class): Never export/import vtables
#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
#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
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
= 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
+2004-07-11 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * 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 <tobias.schlueter@physik.uni-muenchen.de>
* trans-decl.c (gfc_create_module_variable): Nothing to do if
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);
#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"
#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;
/* 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;
};
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 };
\f
/* Return non-zero if we are currently in the global binding level. */
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
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. */
}
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
= 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. */
}
+/* 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
+2004-07-11 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * 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 <mckinlay@redhat.com>
* class.c (common_enclosing_context_p): Remove statement with no
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;
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 */
tree block = 0;
tree decl;
tree bind = 0;
- int block_previously_created;
#if defined(DEBUG_JAVA_BINDING_LEVELS)
binding_depth--;
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;
{
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
= 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
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);
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"
#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;
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"
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);
#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
#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
#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
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, \
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
}
/* 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
#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, \
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, \
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, \
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)
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
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);
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
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.
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
#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
/* 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
/* 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
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,
+2004-07-11 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * 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 <rth@redhat.com>
* treetree.c (tree_mark_addressable): Don't put_var_into_stack.
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);
/* 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. */
/* 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. */
/* 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. */
/* Pop the level. */
- block = (*lang_hooks.decls.poplevel) (1, 0, 1);
+ block = poplevel (1, 0, 1);
/* And attach it to the function. */
/* 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;
};
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 };
\f
/* Return non-zero if we are currently in the global binding level. */
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
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. */
}
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
= 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. */