This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA, C++] Symbol table 12/many: Remove cxx_analyze_expr hook

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
    suit better.

    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;
                  mark_needed (decl);
 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).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]