diff options
author | Mark Mitchell <mark@codesourcery.com> | 2000-05-25 23:27:18 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2000-05-25 23:27:18 +0000 |
commit | 3ec6bad360a051793659af054b5ecf41318a2a8b (patch) | |
tree | db2ec4264a1fd32d8fe39dfd89a501b714b874ca /gcc/cp/optimize.c | |
parent | a0ee3b83359ace5b2fb7cd0d400d99472e5738c3 (diff) | |
download | gcc-3ec6bad360a051793659af054b5ecf41318a2a8b.zip gcc-3ec6bad360a051793659af054b5ecf41318a2a8b.tar.gz gcc-3ec6bad360a051793659af054b5ecf41318a2a8b.tar.bz2 |
Finish implementation of VTTs.
* cp-tree.h (cp_tree_index): Add CPTI_VTT_PARM_TYPE and
CPTI_VTT_PARM_IDENTIFIER.
(vtt_parm_identifier): New macro.
(vtt_parm_type): Likewise.
(BINFO_SUBVTT_INDEX): Likewise.
(BINFO_VPTR_INDEX): Likewise.
(struct lang_decl): Add vtt_parm.
(DECL_VTT_PARM): New macro.
(DECL_USE_VTT_PARM): Likewise.
(DECL_NEEDS_VTT_PARM_P): Likewise.
(get_vtt_name): Declare.
(build_artifical_parm): Likewise.
(fixup_all_virtual_upcast_offsets): Likewise.
(expand_indirect_vtbls_init): Remove.
* call.c (build_new_method_call): Pass the vtt to subobject
constructors and destructors.
* class.c (get_vtt_name): Give it external linkage.
(build_clone): Handle the magic VTT parameters for clones.
(clone_function_decl): Fix typo in comment.
(build_vtt): Keep track of the indices in the VTTs where various
entities are stored.
(build_vtt_inits): Likewise.
(dfs_build_vtt_inits): Likewise.
(build_ctor_vtbl_group): Tweak type of construction vtables.
(dfs_accumulate_vtbl_inits): Build vtables for all bases, even
primary bases, when building construction vtables.
* decl.c (duplicate_decls): Handle DECL_VTT_PARM.
(initialize_predefined_identifiers): Add vtt_parm_identifier.
(init_decl_processing): Initialize vtt_parm_type.
(grokfndecl): Use DECL_OVERLOADED_OPERATOR_P.
(lang_mark_tree): Make vtt_parm.
* decl2.c (build_artificial_parm): New function.
(maybe_retrofit_in_chrg): Use it. Add VTT parameters.
(grokclassfn): Use build_artificial_parm.
* init.c (initialize_vtbl_ptrs): Call
fixup_all_virtual_upcast_offsets directly.
(perform_member_init): Use the complete subobject destructor for
member cleanups.
(build_vtbl_address): New function.
(expand_virtual_init): Handle VTTs.
* optimize (maybe_clone_body): Likewise.
* search.c (fixup_all_virtual_upcast_offsets): Give it external
linkage.
(expand_indirect_vtbls_init): Remove.
* semantics.c (setup_vtbl_ptr): Fix typos in comment.
* tree.c (make_binfo): Make them bigger.
From-SVN: r34177
Diffstat (limited to 'gcc/cp/optimize.c')
-rw-r--r-- | gcc/cp/optimize.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index b7711d6..52292ff 100644 --- a/gcc/cp/optimize.c +++ b/gcc/cp/optimize.c @@ -902,6 +902,10 @@ maybe_clone_body (fn) DECL_SOURCE_LINE (clone) = DECL_SOURCE_LINE (fn); DECL_INLINE (clone) = DECL_INLINE (fn); DECL_THIS_INLINE (clone) = DECL_THIS_INLINE (fn); + DECL_COMDAT (clone) = DECL_COMDAT (fn); + DECL_WEAK (clone) = DECL_WEAK (fn); + DECL_ONE_ONLY (clone) = DECL_ONE_ONLY (fn); + DECL_SECTION_NAME (clone) = DECL_SECTION_NAME (fn); /* Start processing the function. */ push_to_top_level (); @@ -934,7 +938,31 @@ maybe_clone_body (fn) in_charge = in_charge_arg_for_name (DECL_NAME (clone)); splay_tree_insert (id.decl_map, (splay_tree_key) parm, - (splay_tree_key) in_charge); + (splay_tree_value) in_charge); + + /* For a subobject constructor or destructor, the next + argument is the VTT parameter. Remap the VTT_PARM + from the CLONE to this parameter. */ + if (DECL_NEEDS_VTT_PARM_P (clone)) + { + splay_tree_insert (id.decl_map, + (splay_tree_key) DECL_VTT_PARM (fn), + (splay_tree_value) clone_parm); + splay_tree_insert (id.decl_map, + (splay_tree_key) DECL_USE_VTT_PARM (fn), + (splay_tree_value) boolean_true_node); + clone_parm = TREE_CHAIN (clone_parm); + } + /* Otherwise, map the VTT parameter to `NULL'. */ + else if (DECL_VTT_PARM (fn)) + { + splay_tree_insert (id.decl_map, + (splay_tree_key) DECL_VTT_PARM (fn), + (splay_tree_value) null_pointer_node); + splay_tree_insert (id.decl_map, + (splay_tree_key) DECL_USE_VTT_PARM (fn), + (splay_tree_value) boolean_false_node); + } } /* Map other parameters to their equivalents in the cloned function. */ |