]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
langhooks-def.h (LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE): New macro.
authorJan Hubicka <jh@suse.cz>
Tue, 24 Jun 2003 11:54:01 +0000 (13:54 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 24 Jun 2003 11:54:01 +0000 (11:54 +0000)
* 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

gcc/ChangeLog
gcc/Makefile.in
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/cp-lang.c
gcc/cp/cp-tree.h
gcc/cp/decl2.c
gcc/langhooks-def.h
gcc/langhooks.h
gcc/varasm.c

index e2de16881f01c3143e74e8938beba4a316bc4146..7be7d42dc5d6b8e531ba727eaef0c81170313213 100644 (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
index b985ee3c2cb4f97fe049d510ae74bc47c980c851..ebb2000eab31f2113894534982cb618fb68ebcb4 100644 (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 \
index b99ae52664928a84c1944badf60ff8878543fb40..2bc0484997876bbfb9619a98cf8a3b9e69f7e11b 100644 (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.
index 53f097b2bdf453e3d32610babe1e2abaf0cb647e..12c206854564c40a1df5c5fa804b1e2a63fc1b13 100644 (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) */
index 7914d81c5f6f07a8af794e83e038e726983afcbf..c79943727f3b078fe7932f2320842056d227c193 100644 (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
index 6bc6f6f2f38605eed31df1abfc6150ea8c989c4e..1527aa45a63f3a260564fb67c1aef4d57634d11e 100644 (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, ...);
index 44ea6a3843726211d7c43ef69012d07522ac835b..9a96000046899576495f60d24620f29d9d78b5c8 100644 (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)
index a7f0abcd39f8fc1b87115a242e8f5098f9ccb02d..12e4f9b48e19d016d99ffd729d93b66684699fa8 100644 (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, \
 }
 
index cfb26de599497e250d45f0f87c664e0c9dd443de..089fc4ea0592bbdd94459f3c25abeb0d83df7426 100644 (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));
 };
index a464e328b83a3b4293b5518c9a944837351fb626..fdfa02273418219f9572370c2093c1fb732a348a 100644 (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,