This is the mail archive of the
mailing list for the GCC project.
Re: [RFA, C++] Symbol table 12/many: Remove cxx_analyze_expr hook
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, mark at codesourcery dot com, gcc-patches at gcc dot gnu dot org
- Date: Sat, 21 Apr 2012 15:11:43 +0200
- Subject: Re: [RFA, C++] Symbol table 12/many: Remove cxx_analyze_expr hook
- References: <20120420200835.GE20081@kam.mff.cuni.cz> <4F92AB5A.firstname.lastname@example.org>
thank you. My goal is to get rid of places where C++ FE is forcing symbols to be output unconditoinally.
I think the remaining cases are those where mark_decl_referenced is called.
My understnading is that those are
1) COMDAT symbols that must be output because they are keyed, but for weird
ABI reasons they have COMDAT linkage even if normal public linkage would
This is code in maybe_make_one_only and the following call of mark_needed:
if (!CLASSTYPE_KEY_METHOD (class_type)
|| DECL_DECLARED_INLINE_P (CLASSTYPE_KEY_METHOD (class_type))
|| targetm.cxx.class_data_always_comdat ())
/* The ABI requires COMDAT linkage. Normally, we
only emit COMDAT things when they are needed;
make sure that we realize that this entity is
indeed needed. */
comdat_p = true;
2) symbols marked as needed by the repository (rest of mark_needed calls).
I would like to make those cases less restrictive.
When doing LTO, we can still privatize and/or optimize out those symbols. This is
the case where the symbols have hidden linkage and linker plugin tells us that there
are no external uses.
I am not sure about symbols exported form the DSO when linker plugin does not mark them
as used, I think they need to stay.
Consequentely I would like to add a new flag, comdat_keyed_by_abi, that force
comdat to stay unless the above exception holds (and verify that only comdats
are getting this flag). Does this make sense?
It is couple thousdand symbols building Mozilla, being able to optimize them
may make things to smoother + this flag is a lot more descriptive than the
fallback mechanizm disabling any sort of optimization on the symbol.
(mark_decl_referenced has same the effect as used attribute, that is IPA code
assumes it has no chance to track its behaviour at all).