summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/class.c1
-rw-r--r--gcc/cp/cp-lang.c3
-rw-r--r--gcc/cp/cp-tree.h5
-rw-r--r--gcc/cp/decl2.c12
-rw-r--r--gcc/langhooks-def.h2
-rw-r--r--gcc/langhooks.h3
-rw-r--r--gcc/varasm.c3
10 files changed, 40 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e2de16881f0..7be7d42dc5d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index b985ee3c2cb..ebb2000eab3 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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 \
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b99ae526649..2bc04849978 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 53f097b2bdf..12c20685456 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -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) */
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index 7914d81c5f6..c79943727f3 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -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
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 6bc6f6f2f38..1527aa45a63 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -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, ...);
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 44ea6a38437..9a960000468 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -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)
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index a7f0abcd39f..12e4f9b48e1 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -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, \
}
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index cfb26de5994..089fc4ea059 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -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));
};
diff --git a/gcc/varasm.c b/gcc/varasm.c
index a464e328b83..fdfa0227341 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -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,
OpenPOWER on IntegriCloud