aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2003-07-09 02:31:20 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2003-07-09 00:31:20 +0000
commit084c1779088967df7cde7aef1ac91587d68ab3bb (patch)
tree5029eb04a9f787f6958b11882444a0e5bc409cfb /gcc/cp/decl2.c
parent1b1838b64cf2ee0cc35ddf75020894de2a84ee38 (diff)
downloadgcc-084c1779088967df7cde7aef1ac91587d68ab3bb.zip
gcc-084c1779088967df7cde7aef1ac91587d68ab3bb.tar.gz
gcc-084c1779088967df7cde7aef1ac91587d68ab3bb.tar.bz2
java-tree.h (DECL_NUM_STMTS): Rename to...
* java-tree.h (DECL_NUM_STMTS): Rename to... (DECL_ESTIMATED_INSNS): ... this. * lang.c (java_estimate_num_insns, java_estimate_num_insns_1): New static functions. (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): Define. * parser.y (add_stmt_to_compound): Do not account statements. * cp-lang.c (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): New. * decl.c (duplicate_decls): Use DECL_ESTIMATED_INSNS. (start_function): Use DECL_ESTIMATED_INSNS. * optimize.c (maybe_clone_body): Use DECL_ESTIMATED_INSNS. * decl2.c (maybe_emit_vtables): Fix marking vtables as needed in unit-at-a-time * c-common.c (c_estimate_num_insns_1): New static function. (c_estimate_num_insns): New global function. * c-common.h (DECL_NUM_STMTS): Rename to... (DECL_ESTIMATED_INSNS): ... this. (c_estimate_num_insns): Declare. * c-decl.c (duplicate_decls): Use DECL_ESTIMATED_INSNS. * c-lang.c (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): New. * c-semantics.c (add_stmt): Do not account statements. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): New. * langhooks.h (lang_hooks_for_tree_inlining): Add estimate_num_insns * params.def (max-inline-insns-auto, max-inline-insns-auto): set to 100. (max-inline-insns): set to 300. (min-inline-insns): set to 10. * tree-inline.c (struct inline_data): Rename inlined_stmts to inlined-insns. (INSNS_PER_STMT): Kill. (inlinable_function_p): Compute and store body size. (expand_call_inline): Likewise. (optimize_inline_calls): Likewise. From-SVN: r69113
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 7158f10..7a2399a 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1634,6 +1634,7 @@ maybe_emit_vtables (tree ctype)
{
tree vtbl;
tree primary_vtbl;
+ bool needed = false;
/* If the vtables for this class have already been emitted there is
nothing more to do. */
@@ -1651,7 +1652,6 @@ maybe_emit_vtables (tree ctype)
for (vtbl = CLASSTYPE_VTABLES (ctype); vtbl; vtbl = TREE_CHAIN (vtbl))
if (!DECL_EXTERNAL (vtbl) && DECL_NEEDED_P (vtbl))
break;
-
if (!vtbl)
{
/* If the references to this class' vtables are optimized away,
@@ -1662,6 +1662,9 @@ maybe_emit_vtables (tree ctype)
note_debug_info_needed (ctype);
return false;
}
+ else if (TREE_PUBLIC (vtbl) && !DECL_COMDAT (vtbl))
+ needed = true;
+
/* The ABI requires that we emit all of the vtables if we emit any
of them. */
@@ -1672,7 +1675,7 @@ maybe_emit_vtables (tree ctype)
mark_vtable_entries (vtbl);
/* If we know that DECL is needed, mark it as such for the varpool. */
- if (CLASSTYPE_EXPLICIT_INSTANTIATION (ctype))
+ if (needed)
cgraph_varpool_mark_needed_node (cgraph_varpool_node (vtbl));
if (TREE_TYPE (DECL_INITIAL (vtbl)) == 0)