langhooks-def.h (LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE): New macro.

* langhooks-def.h (LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE): New macro.
	* langhooks.h (lang_hooks_for_decls): Add prepare_assemble_variable.
	* varasm.c (assemble_variable): Call prepare_assemble_variable.
	* class.c (build_vtable): Make vtables.
	* cp-tree.h (DECL_VTABLE_OR_VTT_P): New macro.
	* decl2.c (output_vtable_inherit): Rename to ...
	(prepare_assemble_variable): ... this one; change interface.
	(maybe_emit_vtables): Do not call output_vtable_inherit.
	* cp-lang.c (LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE): Define.
	* cp-tree.h (prepare_assemble_variable): New.

From-SVN: r68418
This commit is contained in:
Jan Hubicka 2003-06-24 13:54:01 +02:00 committed by Jan Hubicka
parent 3a63ab4010
commit d35543c0dd
10 changed files with 40 additions and 7 deletions

View File

@ -1,3 +1,9 @@
Tue Jun 24 13:52:11 CEST 2003 Jan Hubicka <jh@suse.cz>
* langhooks-def.h (LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE): New macro.
* langhooks.h (lang_hooks_for_decls): Add prepare_assemble_variable.
* varasm.c (assemble_variable): Call prepare_assemble_variable.
2003-06-23 Roger Sayle <roger@eyesopen.com>
* builtins.c (expand_builtin): Use expand_builtin_pow to expand

View File

@ -1596,7 +1596,7 @@ simplify-rtx.o : simplify-rtx.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RT
$(REGS_H) hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \
output.h function.h $(GGC_H) $(OBSTACK_H) $(TM_P_H) $(TREE_H) $(TARGET_H)
cgraph.o : cgraph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
langhooks.h tree-inline.h toplev.h flags.h ggc.h $(TARGET_H) cgraph.h gt-cgraph.h
langhooks.h toplev.h flags.h ggc.h $(TARGET_H) cgraph.h gt-cgraph.h output.h
cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
langhooks.h tree-inline.h toplev.h flags.h ggc.h $(TARGET_H) cgraph.h
coverage.o : coverage.c gcov-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \

View File

@ -1,3 +1,13 @@
Tue Jun 24 13:52:34 CEST 2003 Jan Hubicka <jh@suse.cz>
* class.c (build_vtable): Make vtables.
* cp-tree.h (DECL_VTABLE_OR_VTT_P): New macro.
* decl2.c (output_vtable_inherit): Rename to ...
(prepare_assemble_variable): ... this one; change interface.
(maybe_emit_vtables): Do not call output_vtable_inherit.
* cp-lang.c (LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE): Define.
* cp-tree.h (prepare_assemble_variable): New.
2003-06-23 Andrew Pinski <pinskia@physics.uc.edu>
* method.c: add prototype for make_alias_for_thunk.

View File

@ -530,6 +530,7 @@ build_vtable (tree class_type, tree name, tree vtable_type)
TREE_READONLY (decl) = 1;
DECL_VIRTUAL_P (decl) = 1;
DECL_ALIGN (decl) = TARGET_VTABLE_ENTRY_ALIGN;
DECL_VTABLE_OR_VTT_P (decl) = 1;
/* At one time the vtable info was grabbed 2 words at a time. This
fails on sparc unless you have 8-byte alignment. (tiemann) */

View File

@ -145,6 +145,9 @@ static bool cp_var_mod_type_p (tree);
#undef LANG_HOOKS_EXPR_SIZE
#define LANG_HOOKS_EXPR_SIZE cp_expr_size
#undef LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE
#define LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE prepare_assemble_variable
#undef LANG_HOOKS_MAKE_TYPE
#define LANG_HOOKS_MAKE_TYPE cxx_make_type
#undef LANG_HOOKS_TYPE_FOR_MODE

View File

@ -73,6 +73,7 @@ struct diagnostic_context;
NEED_TEMPORARY_P (in REF_BIND, BASE_CONV)
IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE)
DECL_VTABLE_OR_VTT_P (in VAR_DECL)
6: For future expansion
Usage of TYPE_LANG_FLAG_?:
@ -2056,6 +2057,9 @@ struct lang_decl GTY(())
(DECL_CONTEXT (NODE) \
&& TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
/* 1 iff VAR_DECL node NODE is virtual table or VTT. */
#define DECL_VTABLE_OR_VTT_P(NODE) TREE_LANG_FLAG_5 (VAR_DECL_CHECK (NODE))
/* 1 iff NODE is function-local, but for types. */
#define LOCAL_CLASS_P(NODE) \
(decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE)
@ -3794,6 +3798,7 @@ extern tree build_artificial_parm (tree, tree);
extern tree get_guard (tree);
extern tree get_guard_cond (tree);
extern tree set_guard (tree);
extern void prepare_assemble_variable (tree);
extern void cp_error_at (const char *msgid, ...);
extern void cp_warning_at (const char *msgid, ...);

View File

@ -66,7 +66,6 @@ static void add_using_namespace (tree, tree, bool);
static cxx_binding *ambiguous_decl (tree, cxx_binding *, cxx_binding *, int);
static tree build_anon_union_vars (tree);
static bool acceptable_java_type (tree);
static void output_vtable_inherit (tree);
static tree start_objects (int, int);
static void finish_objects (int, int, tree);
static tree merge_functions (tree, tree);
@ -1606,12 +1605,16 @@ import_export_class (tree ctype)
/* We need to describe to the assembler the relationship between
a vtable and the vtable of the parent class. */
static void
output_vtable_inherit (tree vars)
void
prepare_assemble_variable (tree vars)
{
tree parent;
rtx child_rtx, parent_rtx;
if (!flag_vtable_gc || TREE_CODE (vars) != VAR_DECL
|| !DECL_VTABLE_OR_VTT_P (vars))
return;
child_rtx = XEXP (DECL_RTL (vars), 0); /* strip the mem ref */
parent = binfo_for_vtable (vars);
@ -1708,9 +1711,6 @@ maybe_emit_vtables (tree ctype)
rest_of_decl_compilation (vtbl, NULL, 1, 1);
if (flag_vtable_gc)
output_vtable_inherit (vtbl);
/* Because we're only doing syntax-checking, we'll never end up
actually marking the variable as written. */
if (flag_syntax_only)

View File

@ -221,6 +221,7 @@ int lhd_tree_dump_type_quals PARAMS ((tree));
#define LANG_HOOKS_GETDECLS getdecls
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
#define LANG_HOOKS_WRITE_GLOBALS write_global_declarations
#define LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE NULL
#define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall
#define LANG_HOOKS_DECLS { \
@ -233,6 +234,7 @@ int lhd_tree_dump_type_quals PARAMS ((tree));
LANG_HOOKS_GETDECLS, \
LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \
LANG_HOOKS_WRITE_GLOBALS, \
LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE, \
LANG_HOOKS_DECL_OK_FOR_SIBCALL, \
}

View File

@ -181,6 +181,9 @@ struct lang_hooks_for_decls
of compilation */
void (*final_write_globals) PARAMS ((void));
/* Do necessary preparations before assemble_variable can proceed. */
void (*prepare_assemble_variable) PARAMS ((tree));
/* True if this decl may be called via a sibcall. */
bool (*ok_for_sibcall) PARAMS ((tree));
};

View File

@ -1409,6 +1409,9 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
int reloc = 0;
rtx decl_rtl;
if (lang_hooks.decls.prepare_assemble_variable)
(*lang_hooks.decls.prepare_assemble_variable) (decl);
last_assemble_variable_decl = 0;
/* Normally no need to say anything here for external references,