summaryrefslogtreecommitdiffstats
path: root/gcc/cp/optimize.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2001-03-23 12:04:11 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2001-03-23 12:04:11 +0000
commite6393a027e2ea8e2835f93afa0c596676ce3bb9b (patch)
tree1a8f5604777aadd2add12ef78e66d86095808cde /gcc/cp/optimize.c
parent59c0e3039bcd783f1385865ecae8f73cb2ce9066 (diff)
downloadppe42-gcc-e6393a027e2ea8e2835f93afa0c596676ce3bb9b.tar.gz
ppe42-gcc-e6393a027e2ea8e2835f93afa0c596676ce3bb9b.zip
* decl.c (local_names): Define.
(push_local_name): New. (grok_reference_init): Return init if initializing static reference variable with non-constant instead of emitting it. Move expand_static_init call to cp_finish_decl. (layout_var_decl): Call push_local_name. (maybe_commonize_var): Allow inlining functions even if they have static local variables, use comdat_linkage for them if flag_weak. (check_initializer): Call obscure_complex_init if grok_reference_init returned non-zero. (save_function_data): Clear x_local_names. (pop_cp_function_context): Free x_local_names. (mark_inlined_fns): Remove. (mark_lang_function): Mark x_local_names. (lang_mark_tree): Don't mark DECL_ACCESS for DECL_DISCRIMINATOR_P. Mark inlined_fns as tree, remove call to mark_inlined_fns. * class.c (alter_access): Ensure DECL_ACCESS is never set if DECL_DISCRIMINATOR_P. * cp-tree.h (cp_language_function): Add x_local_names. (lang_decl_flags): Add discriminator into u2. (lang_decl_inlined_fns): Remove. (lang_decl): inlined_fns is now a TREE_VEC. (DECL_DISCRIMINATOR_P, DECL_DISCRIMINATOR): Define. * optimize.c (inlinable_function_p): DECL_INLINED_FNS is now a TREE_VEC, not a custom structure. (optimize_function): Likewise. * mangle.c (discriminator_for_local_entity): Discriminate among VAR_DECL local entities. * search.c (dfs_access_in_type): If DECL_DISCRIMINATOR_P, DECL_ACCESS is not valid. * g++.old-deja/g++.other/mangle3.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40779 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/optimize.c')
-rw-r--r--gcc/cp/optimize.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index c1cbf52c9fc..d350fdaaeed 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -620,10 +620,11 @@ inlinable_function_p (fn, id)
if (inlinable && DECL_LANG_SPECIFIC (fn) && DECL_INLINED_FNS (fn))
{
- struct lang_decl_inlined_fns *ifn = DECL_INLINED_FNS (fn);
+ int j;
+ tree inlined_fns = DECL_INLINED_FNS (fn);
- for (i = 0; i < ifn->num_fns; ++i)
- if (ifn->fns [i] == VARRAY_TREE (id->fns, 0))
+ for (j = 0; j < TREE_VEC_LENGTH (inlined_fns); ++j)
+ if (TREE_VEC_ELT (inlined_fns, j) == VARRAY_TREE (id->fns, 0))
return 0;
}
}
@@ -912,14 +913,10 @@ optimize_function (fn)
VARRAY_FREE (id.target_exprs);
if (DECL_LANG_SPECIFIC (fn))
{
- struct lang_decl_inlined_fns *ifn;
-
- ifn = ggc_alloc (sizeof (struct lang_decl_inlined_fns)
- + (VARRAY_ACTIVE_SIZE (id.inlined_fns) - 1)
- * sizeof (tree));
- ifn->num_fns = VARRAY_ACTIVE_SIZE (id.inlined_fns);
- memcpy (&ifn->fns[0], &VARRAY_TREE (id.inlined_fns, 0),
- ifn->num_fns * sizeof (tree));
+ tree ifn = make_tree_vec (VARRAY_ACTIVE_SIZE (id.inlined_fns));
+
+ memcpy (&TREE_VEC_ELT (ifn, 0), &VARRAY_TREE (id.inlined_fns, 0),
+ VARRAY_ACTIVE_SIZE (id.inlined_fns) * sizeof (tree));
DECL_INLINED_FNS (fn) = ifn;
}
VARRAY_FREE (id.inlined_fns);
OpenPOWER on IntegriCloud