Makefile.in (fold-const.o, [...]): Update.

* Makefile.in (fold-const.o, stor-layout.o, stmt.o,
	sdbout.o, profile.o): Update.
	* c-common.c (c_common_nodes_and_builtins): Use pushdecl
	langhook.
	* c-common.h (gettags): Move here from tree.h.
	* c-tree.h (pushdecl, pushlevel, poplevel, set_block,
	insert_block, getdecls, kept_level_p, global_bindings_p): New.
	* dbxout.c (dbxout_init): Use getdecls langhook.
	* expr.c (expand_expr): Use insert_block langhook.
	* fold-const.c: Include langhooks.h.
	(fold_range_test, fold_binary_op_with_conditional_arg,
	fold): Use global_bindings_p langhook.
	* integrate.c (expand_inline_function): Use insert_block langhook.
	* langhooks-def.h (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): New.
	(LANG_HOOKS_INITIALIZER): Update.
	* langhooks.c (lhd_clear_binding_stack): Use global_bindings_p
	langhook.
	* langhooks.h (struct lang_hooks_for_decls): New.
	(struct lang_hooks): Update.
	* profile.c: Include langhooks.h.
	(output_func_start_profiler): Use new langhooks.
	* sdbout.c: Include langhooks.h.
	(sdbout_init, sdbout_finish): Use getdecls langhook.
	* stmt.c: Include langhooks.h.
	(expand_fixup, fixup_gotos): Use new langhooks.
	* stor-layout.c: Include langhooks.h.
	(variable_size): Use global_bindings_p langhook.
	* toplev.c (compile_file): Use getdecls langhook.
	* tree-inline.c (remap_block): Use insert_block langhook.
	* tree.h (pushdecl, pushlevel, poplevel, set_block, gettags,
	insert_block, getdecls, kept_level_p, global_bindings_p): Remove.
cp:
	* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
	insert_block, getdecls, global_bindings_p): New.
java:
	* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
	insert_block, getdecls, kept_level_p, global_bindings_p): New.
f:
	* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
	insert_block, getdecls, global_bindings_p): New.

From-SVN: r51136
This commit is contained in:
Neil Booth 2002-03-21 18:39:29 +00:00 committed by Neil Booth
parent 5b19b10c6b
commit 43577e6bd7
25 changed files with 236 additions and 94 deletions

View File

@ -1,3 +1,40 @@
2002-03-21 Neil Booth <neil@daikokuya.demon.co.uk>
* Makefile.in (fold-const.o, stor-layout.o, stmt.o,
sdbout.o, profile.o): Update.
* c-common.c (c_common_nodes_and_builtins): Use pushdecl
langhook.
* c-common.h (gettags): Move here from tree.h.
* c-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, kept_level_p, global_bindings_p): New.
* dbxout.c (dbxout_init): Use getdecls langhook.
* expr.c (expand_expr): Use insert_block langhook.
* fold-const.c: Include langhooks.h.
(fold_range_test, fold_binary_op_with_conditional_arg,
fold): Use global_bindings_p langhook.
* integrate.c (expand_inline_function): Use insert_block langhook.
* langhooks-def.h (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): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.c (lhd_clear_binding_stack): Use global_bindings_p
langhook.
* langhooks.h (struct lang_hooks_for_decls): New.
(struct lang_hooks): Update.
* profile.c: Include langhooks.h.
(output_func_start_profiler): Use new langhooks.
* sdbout.c: Include langhooks.h.
(sdbout_init, sdbout_finish): Use getdecls langhook.
* stmt.c: Include langhooks.h.
(expand_fixup, fixup_gotos): Use new langhooks.
* stor-layout.c: Include langhooks.h.
(variable_size): Use global_bindings_p langhook.
* toplev.c (compile_file): Use getdecls langhook.
* tree-inline.c (remap_block): Use insert_block langhook.
* tree.h (pushdecl, pushlevel, poplevel, set_block, gettags,
insert_block, getdecls, kept_level_p, global_bindings_p): Remove.
2002-03-21 Richard Henderson <rth@redhat.com>
* config/rs6000/rs6000.c (rs6000_select_rtx_section): Put symbolic

View File

@ -1335,9 +1335,10 @@ tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) \
print-tree.o : print-tree.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(GGC_H) \
langhooks.h
stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h \
function.h $(EXPR_H) $(RTL_H) toplev.h $(GGC_H) $(TM_P_H) $(TARGET_H)
function.h $(EXPR_H) $(RTL_H) toplev.h $(GGC_H) $(TM_P_H) $(TARGET_H) \
langhooks.h
fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h \
toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) $(GGC_H) $(TM_P_H)
toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) $(GGC_H) $(TM_P_H) langhooks.h
diagnostic.o : diagnostic.c diagnostic.h real.h diagnostic.def \
$(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_P_H) flags.h $(GGC_H) \
input.h toplev.h intl.h langhooks.h
@ -1379,7 +1380,8 @@ function.o : function.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
$(TM_P_H) langhooks.h
stmt.o : stmt.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h function.h \
insn-config.h hard-reg-set.h $(EXPR_H) libfuncs.h except.h \
$(LOOP_H) $(RECOG_H) toplev.h output.h varray.h $(GGC_H) $(TM_P_H)
$(LOOP_H) $(RECOG_H) toplev.h output.h varray.h $(GGC_H) $(TM_P_H) \
langhooks.h
except.o : except.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
except.h function.h $(EXPR_H) libfuncs.h integrate.h \
insn-config.h hard-reg-set.h $(BASIC_BLOCK_H) output.h \
@ -1410,7 +1412,7 @@ debug.o : debug.c debug.h $(CONFIG_H) $(SYSTEM_H)
sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \
function.h $(EXPR_H) output.h hard-reg-set.h $(REGS_H) real.h \
insn-config.h $(OBSTACK_H) xcoffout.h c-pragma.h ggc.h \
sdbout.h toplev.h $(TM_P_H) except.h debug.h
sdbout.h toplev.h $(TM_P_H) except.h debug.h langhooks.h
dwarfout.o : dwarfout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) dwarf.h \
flags.h insn-config.h reload.h output.h toplev.h $(TM_P_H) \
debug.h langhooks.h
@ -1472,7 +1474,8 @@ conflict.o : conflict.c $(CONFIG_H) $(SYSTEM_H) $(OBSTACK_H) $(HASHTAB_H) \
$(RTL_H) hard-reg-set.h $(BASIC_BLOCK_H)
profile.o : profile.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
insn-config.h output.h $(REGS_H) $(EXPR_H) function.h \
gcov-io.h toplev.h $(GGC_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TARGET_H)
gcov-io.h toplev.h $(GGC_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TARGET_H) \
langhooks.h
loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) flags.h $(LOOP_H) \
insn-config.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) \
real.h $(PREDICT_H) $(BASIC_BLOCK_H) function.h \

View File

@ -2575,31 +2575,43 @@ c_common_nodes_and_builtins ()
record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node);
/* These are types that type_for_size and type_for_mode use. */
pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node));
pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node));
pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node));
pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
intQI_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
intHI_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
intSI_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
intDI_type_node));
#if HOST_BITS_PER_WIDE_INT >= 64
pushdecl (build_decl (TYPE_DECL, get_identifier ("__int128_t"), intTI_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
get_identifier ("__int128_t"),
intTI_type_node));
#endif
pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node));
pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node));
pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node));
pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
unsigned_intQI_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
unsigned_intHI_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
unsigned_intSI_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
unsigned_intDI_type_node));
#if HOST_BITS_PER_WIDE_INT >= 64
pushdecl (build_decl (TYPE_DECL, get_identifier ("__uint128_t"), unsigned_intTI_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
get_identifier ("__uint128_t"),
unsigned_intTI_type_node));
#endif
/* Create the widest literal types. */
widest_integer_literal_type_node
= make_signed_type (HOST_BITS_PER_WIDE_INT * 2);
pushdecl (build_decl (TYPE_DECL, NULL_TREE,
widest_integer_literal_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
widest_integer_literal_type_node));
widest_unsigned_literal_type_node
= make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2);
pushdecl (build_decl (TYPE_DECL, NULL_TREE,
widest_unsigned_literal_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL, NULL_TREE,
widest_unsigned_literal_type_node));
/* `unsigned long' is the standard type for sizeof.
Note that stddef.h uses `unsigned long',
@ -2615,14 +2627,18 @@ c_common_nodes_and_builtins ()
record_builtin_type (RID_DOUBLE, NULL, double_type_node);
record_builtin_type (RID_MAX, "long double", long_double_type_node);
pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"),
complex_integer_type_node));
pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"),
complex_float_type_node));
pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"),
complex_double_type_node));
pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"),
complex_long_double_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
get_identifier ("complex int"),
complex_integer_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
get_identifier ("complex float"),
complex_float_type_node));
(*lang_hooks.decls.pushdecl) (build_decl (TYPE_DECL,
get_identifier ("complex double"),
complex_double_type_node));
(*lang_hooks.decls.pushdecl)
(build_decl (TYPE_DECL, get_identifier ("complex long double"),
complex_long_double_type_node));
record_builtin_type (RID_VOID, NULL, void_type_node);
@ -2692,14 +2708,17 @@ c_common_nodes_and_builtins ()
= TREE_TYPE (identifier_global_value (get_identifier (PTRDIFF_TYPE)));
unsigned_ptrdiff_type_node = unsigned_type (ptrdiff_type_node);
pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
va_list_type_node));
(*lang_hooks.decls.pushdecl)
(build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
va_list_type_node));
pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_ptrdiff_t"),
ptrdiff_type_node));
(*lang_hooks.decls.pushdecl)
(build_decl (TYPE_DECL, get_identifier ("__builtin_ptrdiff_t"),
ptrdiff_type_node));
pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_size_t"),
sizetype));
(*lang_hooks.decls.pushdecl)
(build_decl (TYPE_DECL, get_identifier ("__builtin_size_t"),
sizetype));
if (TREE_CODE (va_list_type_node) == ARRAY_TYPE)
{

View File

@ -320,6 +320,7 @@ extern int (*lang_statement_code_p) PARAMS ((enum tree_code));
extern void (*lang_expand_stmt) PARAMS ((tree));
extern void (*lang_expand_decl_stmt) PARAMS ((tree));
extern void (*lang_expand_function_end) PARAMS ((void));
extern tree gettags PARAMS ((void));
/* Callback that determines if it's ok for a function to have no
noreturn attribute. */

View File

@ -166,6 +166,15 @@ extern void c_set_yydebug PARAMS ((int));
extern void gen_aux_info_record PARAMS ((tree, int, int, int));
/* in c-decl.c */
extern int global_bindings_p PARAMS ((void));
extern int kept_level_p PARAMS ((void));
extern tree getdecls PARAMS ((void));
extern void pushlevel PARAMS ((int));
extern tree poplevel PARAMS ((int,int, int));
extern void insert_block PARAMS ((tree));
extern void set_block PARAMS ((tree));
extern tree pushdecl PARAMS ((tree));
extern void c_init_decl_processing PARAMS ((void));
extern void c_dup_lang_specific_decl PARAMS ((tree));
extern void c_print_identifier PARAMS ((FILE *, tree, int));
@ -191,7 +200,6 @@ extern tree implicitly_declare PARAMS ((tree));
extern void implicit_decl_warning PARAMS ((tree));
extern int in_parm_level_p PARAMS ((void));
extern void keep_next_level PARAMS ((void));
extern int kept_level_p PARAMS ((void));
extern tree lookup_name PARAMS ((tree));
extern tree lookup_name_current_level PARAMS ((tree));
extern void parmlist_tags_warning PARAMS ((void));

View File

@ -1,3 +1,8 @@
2002-03-21 Neil Booth <neil@daikokuya.demon.co.uk>
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, global_bindings_p): New.
2002-03-20 Nathan Sidwell <nathan@codesourcery.com>
PR c++/4361

View File

@ -3659,12 +3659,18 @@ extern void clone_function_decl PARAMS ((tree, int));
extern void adjust_clone_args PARAMS ((tree));
/* decl.c */
/* resume_binding_level */
extern int global_bindings_p PARAMS ((void));
extern int kept_level_p PARAMS ((void));
extern tree getdecls PARAMS ((void));
extern void pushlevel PARAMS ((int));
extern tree poplevel PARAMS ((int,int, int));
extern void insert_block PARAMS ((tree));
extern void set_block PARAMS ((tree));
extern tree pushdecl PARAMS ((tree));
extern void cxx_init_decl_processing PARAMS ((void));
extern int toplevel_bindings_p PARAMS ((void));
extern int namespace_bindings_p PARAMS ((void));
extern void keep_next_level PARAMS ((int));
extern int kept_level_p PARAMS ((void));
extern int template_parm_scope_p PARAMS ((void));
extern void set_class_shadows PARAMS ((tree));
extern void maybe_push_cleanup_level PARAMS ((tree));

View File

@ -412,7 +412,7 @@ dbxout_init (input_file_name)
const char *input_file_name;
{
char ltext_label_name[100];
tree syms = getdecls ();
tree syms = (*lang_hooks.decls.getdecls) ();
asmfile = asm_out_file;

View File

@ -6526,7 +6526,7 @@ expand_expr (exp, target, tmode, modifier)
/* Mark the corresponding BLOCK for output in its proper place. */
if (TREE_OPERAND (exp, 2) != 0
&& ! TREE_USED (TREE_OPERAND (exp, 2)))
insert_block (TREE_OPERAND (exp, 2));
(*lang_hooks.decls.insert_block) (TREE_OPERAND (exp, 2));
/* If VARS have not yet been expanded, expand them now. */
while (vars)

View File

@ -1,3 +1,8 @@
Thu Mar 21 18:55:41 2002 Neil Booth <neil@daikokuya.demon.co.uk>
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, global_bindings_p): New.
Wed Mar 20 08:03:42 2002 Neil Booth <neil@daikokuya.demon.co.uk>
* com.c (lang_printable_name): Rename.

View File

@ -157,8 +157,13 @@ struct _ffecom_symbol_
#include "storag.h"
#include "symbol.h"
/* Structure definitions. */
extern int global_bindings_p PARAMS ((void));
extern tree getdecls PARAMS ((void));
extern void pushlevel PARAMS ((int));
extern tree poplevel PARAMS ((int,int, int));
extern void insert_block PARAMS ((tree));
extern void set_block PARAMS ((tree));
extern tree pushdecl PARAMS ((tree));
/* Global objects accessed by users of this module. */

View File

@ -52,6 +52,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "toplev.h"
#include "ggc.h"
#include "hashtab.h"
#include "langhooks.h"
static void encode PARAMS ((HOST_WIDE_INT *,
unsigned HOST_WIDE_INT,
@ -3336,7 +3337,7 @@ fold_range_test (exp)
TREE_TYPE (exp), TREE_OPERAND (exp, 0),
TREE_OPERAND (exp, 1));
else if (global_bindings_p () == 0
else if ((*lang_hooks.decls.global_bindings_p) () == 0
&& ! contains_placeholder_p (lhs))
{
tree common = save_expr (lhs);
@ -4341,7 +4342,7 @@ fold_binary_op_with_conditional_arg (code, type, cond, arg, cond_first_p)
in that case. */
if (TREE_CODE (arg) != SAVE_EXPR && ! TREE_CONSTANT (arg)
&& global_bindings_p () == 0
&& (*lang_hooks.decls.global_bindings_p) () == 0
&& ((TREE_CODE (arg) != VAR_DECL
&& TREE_CODE (arg) != PARM_DECL)
|| TREE_SIDE_EFFECTS (arg)))
@ -4623,7 +4624,7 @@ fold (expr)
&& (TREE_CODE (arg0) != COND_EXPR
|| count_cond (arg0, 25) + count_cond (arg1, 25) <= 25)
&& (! TREE_SIDE_EFFECTS (arg0)
|| (global_bindings_p () == 0
|| ((*lang_hooks.decls.global_bindings_p) () == 0
&& ! contains_placeholder_p (arg0))))
return
fold_binary_op_with_conditional_arg (code, type, arg1, arg0,
@ -4637,7 +4638,7 @@ fold (expr)
&& (TREE_CODE (arg1) != COND_EXPR
|| count_cond (arg0, 25) + count_cond (arg1, 25) <= 25)
&& (! TREE_SIDE_EFFECTS (arg1)
|| (global_bindings_p () == 0
|| ((*lang_hooks.decls.global_bindings_p) () == 0
&& ! contains_placeholder_p (arg1))))
return
fold_binary_op_with_conditional_arg (code, type, arg0, arg1,
@ -5249,7 +5250,8 @@ fold (expr)
if (real_onep (arg1))
return non_lvalue (convert (type, arg0));
/* x*2 is x+x */
if (! wins && real_twop (arg1) && global_bindings_p () == 0
if (! wins && real_twop (arg1)
&& (*lang_hooks.decls.global_bindings_p) () == 0
&& ! contains_placeholder_p (arg0))
{
tree arg = save_expr (arg0);

View File

@ -1240,7 +1240,7 @@ expand_inline_function (fndecl, parms, target, ignore, type,
this block to the list of blocks at this binding level. We
can't do it the way it's done for function-at-a-time mode the
superblocks have not been created yet. */
insert_block (block);
(*lang_hooks.decls.insert_block) (block);
else
{
BLOCK_CHAIN (block)

View File

@ -1,3 +1,8 @@
2002-03-21 Neil Booth <neil@daikokuya.demon.co.uk>
* cp-tree.h (pushdecl, pushlevel, poplevel, set_block,
insert_block, getdecls, kept_level_p, global_bindings_p): New.
2002-03-20 Nic Ferrier <nferrier@tapsellferrier.co.uk>
* gcj.texi: @code{gcj} becomes @command{gcj}.

View File

@ -1072,6 +1072,14 @@ extern tree ident_subst PARAMS ((const char*, int,
const char*, int, int, const char*));
extern tree identifier_subst PARAMS ((const tree,
const char *, int, int, const char *));
extern int global_bindings_p PARAMS ((void));
extern int kept_level_p PARAMS ((void));
extern tree getdecls PARAMS ((void));
extern void pushlevel PARAMS ((int));
extern tree poplevel PARAMS ((int,int, int));
extern void insert_block PARAMS ((tree));
extern void set_block PARAMS ((tree));
extern tree pushdecl PARAMS ((tree));
extern void java_init_decl_processing PARAMS ((void));
extern void java_dup_lang_specific_decl PARAMS ((tree));
extern tree build_java_signature PARAMS ((tree));

View File

@ -1,5 +1,5 @@
/* Default macros to initialize the lang_hooks data structure.
Copyright 2001 Free Software Foundation, Inc.
Copyright 2001, 2002 Free Software Foundation, Inc.
Contributed by Alexandre Oliva <aoliva@redhat.com>
This file is part of GNU CC.
@ -137,7 +137,26 @@ int lhd_tree_dump_type_quals PARAMS ((tree));
#define LANG_HOOKS_TREE_DUMP_INITIALIZER { \
LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN, \
LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN \
} \
}
/* 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_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 \
}
/* The whole thing. The structure is defined in langhooks.h. */
#define LANG_HOOKS_INITIALIZER { \
@ -165,7 +184,8 @@ int lhd_tree_dump_type_quals PARAMS ((tree));
LANG_HOOKS_DECL_PRINTABLE_NAME, \
LANG_HOOKS_SET_YYDEBUG, \
LANG_HOOKS_TREE_INLINING_INITIALIZER, \
LANG_HOOKS_TREE_DUMP_INITIALIZER \
LANG_HOOKS_TREE_DUMP_INITIALIZER, \
LANG_HOOKS_DECLS \
}
#endif /* GCC_LANG_HOOKS_DEF_H */

View File

@ -1,5 +1,5 @@
/* Default language-specific hooks.
Copyright 2001 Free Software Foundation, Inc.
Copyright 2001, 2002 Free Software Foundation, Inc.
Contributed by Alexandre Oliva <aoliva@redhat.com>
This file is part of GNU CC.
@ -110,7 +110,7 @@ lhd_set_yydebug (value)
void
lhd_clear_binding_stack ()
{
while (! global_bindings_p ())
while (! (*lang_hooks.decls.global_bindings_p) ())
poplevel (0, 0, 0);
}

View File

@ -1,5 +1,5 @@
/* The lang_hooks data structure.
Copyright 2001 Free Software Foundation, Inc.
Copyright 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -65,6 +65,43 @@ struct lang_hooks_for_tree_dump
int (*type_quals) PARAMS ((tree));
};
/* Language hooks related to decls and the symbol table. */
struct lang_hooks_for_decls
{
/* Enter a new lexical scope. Argument is always zero when called
from outside the front end. */
void (*pushlevel) PARAMS ((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) PARAMS ((int, int, int));
/* Returns non-zero if we are in the global binding level. Ada
returns -1 for an undocumented reason used in stor-layout.c. */
int (*global_bindings_p) PARAMS ((void));
/* Insert BLOCK at the end of the list of subblocks of the
current binding level. This is used when a BIND_EXPR is expanded,
to handle the BLOCK node inside the BIND_EXPR. */
void (*insert_block) PARAMS ((tree));
/* Set the BLOCK node for the current scope level. */
void (*set_block) PARAMS ((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
name. */
tree (*pushdecl) PARAMS ((tree));
/* Returns the chain of decls so far in the current scope level. */
tree (*getdecls) PARAMS ((void));
};
/* Language-specific hooks. See langhooks-def.h for defaults. */
struct lang_hooks
@ -177,6 +214,8 @@ struct lang_hooks
struct lang_hooks_for_tree_dump tree_dump;
struct lang_hooks_for_decls decls;
/* Whenever you add entries here, make sure you adjust langhooks-def.h
and langhooks.c accordingly. */
};

View File

@ -49,6 +49,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "basic-block.h"
#include "gcov-io.h"
#include "target.h"
#include "langhooks.h"
/* Additional information about the edges we need. */
struct edge_info
@ -1153,14 +1154,14 @@ output_func_start_profiler ()
DECL_RESULT (fndecl) = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
fndecl = pushdecl (fndecl);
fndecl = (*lang_hooks.decls.pushdecl) (fndecl);
rest_of_decl_compilation (fndecl, 0, 1, 0);
announce_function (fndecl);
current_function_decl = fndecl;
DECL_INITIAL (fndecl) = error_mark_node;
make_decl_rtl (fndecl, NULL);
init_function_start (fndecl, input_filename, lineno);
pushlevel (0);
(*lang_hooks.decls.pushlevel) (0);
expand_function_start (fndecl, 0);
/* Actually generate the code to call __bb_init_func. */
@ -1171,7 +1172,7 @@ output_func_start_profiler ()
mode, 1, table_address, Pmode);
expand_function_end (input_filename, lineno, 0);
poplevel (1, 0, 1);
(*lang_hooks.decls.poplevel) (1, 0, 1);
/* Since fndecl isn't in the list of globals, it would never be emitted
when it's considered to be 'safe' for inlining, so turn off

View File

@ -58,6 +58,7 @@ AT&T C compiler. From the example below I would conclude the following:
#include "tm_p.h"
#include "gsyms.h"
#include "debug.h"
#include "langhooks.h"
/* 1 if PARM is passed to this function in memory. */
@ -1516,7 +1517,7 @@ static void
sdbout_finish (main_filename)
const char *main_filename ATTRIBUTE_UNUSED;
{
tree decl = getdecls ();
tree decl = (*lang_hooks.decls.getdecls) ();
unsigned int len = list_length (decl);
tree *vec = (tree *) xmalloc (sizeof (tree) * len);
unsigned int i;
@ -1754,7 +1755,7 @@ sdbout_init (input_file_name)
#ifdef RMS_QUICK_HACK_1
tree t;
for (t = getdecls (); t; t = TREE_CHAIN (t))
for (t = (*lang_hooks.decls.getdecls) (); t; t = TREE_CHAIN (t))
if (DECL_NAME (t) && IDENTIFIER_POINTER (DECL_NAME (t)) != 0
&& !strcmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__vtbl_ptr_type"))
sdbout_symbol (t, 0);

View File

@ -53,6 +53,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "toplev.h"
#include "output.h"
#include "ggc.h"
#include "langhooks.h"
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
@ -1054,7 +1055,7 @@ expand_fixup (tree_label, rtl_label, last_insn)
TREE_USED (block) = 1;
if (!cfun->x_whole_function_mode_p)
insert_block (block);
(*lang_hooks.decls.insert_block) (block);
else
{
BLOCK_CHAIN (block)
@ -1175,8 +1176,8 @@ fixup_gotos (thisblock, stack_level, cleanup_list, first_insn, dont_jump_in)
logically be inserting the fixup code. We do this for the
sake of getting the debugging information right. */
pushlevel (0);
set_block (f->context);
(*lang_hooks.decls.pushlevel) (0);
(*lang_hooks.decls.set_block) (f->context);
/* Expand the cleanups for blocks this jump exits. */
if (f->cleanup_list_list)
@ -1215,7 +1216,7 @@ fixup_gotos (thisblock, stack_level, cleanup_list, first_insn, dont_jump_in)
destructed are still "in scope". */
cleanup_insns = get_insns ();
poplevel (1, 0, 0);
(*lang_hooks.decls.poplevel) (1, 0, 0);
end_sequence ();
emit_insns_after (cleanup_insns, f->before_jump);
@ -1249,12 +1250,12 @@ fixup_gotos (thisblock, stack_level, cleanup_list, first_insn, dont_jump_in)
if (TREE_CHAIN (lists) == thisblock->data.block.outer_cleanups)
{
start_sequence ();
pushlevel (0);
set_block (f->context);
(*lang_hooks.decls.pushlevel) (0);
(*lang_hooks.decls.set_block) (f->context);
expand_cleanups (TREE_VALUE (lists), NULL_TREE, 1, 1);
do_pending_stack_adjust ();
cleanup_insns = get_insns ();
poplevel (1, 0, 0);
(*lang_hooks.decls.poplevel) (1, 0, 0);
end_sequence ();
if (cleanup_insns != 0)
f->before_jump

View File

@ -31,6 +31,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "toplev.h"
#include "ggc.h"
#include "target.h"
#include "langhooks.h"
/* Set to one when set_sizetype has been called. */
static int sizetype_set;
@ -151,7 +152,8 @@ variable_size (size)
just return SIZE unchanged. Likewise for self-referential sizes and
constant sizes. */
if (TREE_CONSTANT (size)
|| global_bindings_p () < 0 || contains_placeholder_p (size))
|| (*lang_hooks.decls.global_bindings_p) () < 0
|| contains_placeholder_p (size))
return size;
size = save_expr (size);
@ -167,7 +169,7 @@ variable_size (size)
if (TREE_CODE (size) == SAVE_EXPR)
SAVE_EXPR_PERSISTENT_P (size) = 1;
if (global_bindings_p ())
if ((*lang_hooks.decls.global_bindings_p) ())
{
if (TREE_CONSTANT (size))
error ("type size can't be explicitly evaluated");

View File

@ -2098,7 +2098,7 @@ compile_file ()
if (flag_syntax_only)
return;
globals = getdecls ();
globals = (*lang_hooks.decls.getdecls) ();
/* Really define vars that have had only a tentative definition.
Really output inline functions that must actually be callable

View File

@ -257,7 +257,7 @@ remap_block (scope_stmt, decls, id)
/* We're building a clone; DECL_INITIAL is still
error_mark_node, and current_binding_level is the parm
binding level. */
insert_block (new_block);
(*lang_hooks.decls.insert_block) (new_block);
else
{
/* Attach this new block after the DECL_INITIAL block for the

View File

@ -2847,30 +2847,6 @@ extern tree invert_truthvalue PARAMS ((tree));
extern tree (*lang_type_promotes_to) PARAMS ((tree));
extern tree fold_builtin PARAMS ((tree));
/* The language front-end must define these functions. */
/* Functions for processing symbol declarations. */
/* Function to enter a new lexical scope.
Takes one argument: always zero when called from outside the front end. */
extern void pushlevel PARAMS ((int));
/* Function to exit a lexical scope. It returns 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. */
extern tree poplevel PARAMS ((int, int, int));
/* Set the BLOCK node for the current scope level. */
extern void set_block PARAMS ((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 name. */
extern tree pushdecl PARAMS ((tree));
/* Function to return the chain of decls so far in the current scope level. */
extern tree getdecls PARAMS ((void));
/* Function to return the chain of structure tags in the current scope level. */
extern tree gettags PARAMS ((void));
extern tree build_range_type PARAMS ((tree, tree, tree));
/* In alias.c */
@ -3024,8 +3000,6 @@ extern int lang_attribute_common;
extern int mark_addressable PARAMS ((tree));
extern void incomplete_type_error PARAMS ((tree, tree));
extern tree truthvalue_conversion PARAMS ((tree));
extern int global_bindings_p PARAMS ((void));
extern void insert_block PARAMS ((tree));
/* In integrate.c */
extern void save_for_inline PARAMS ((tree));