[PATCH 2/4] New data structure for cgraph_summary introduced.
Trevor Saunders
tsaunders@mozilla.com
Thu Nov 13 21:35:00 GMT 2014
On Thu, Nov 13, 2014 at 03:48:34PM +0100, Markus Trippelsdorf wrote:
> On 2014.11.13 at 15:11 +0100, mliska wrote:
>
> Just two remarks:
>
> > +template <class T>
> > +class GTY((user)) cgraph_summary <T *>
> > +{
> > +public:
> > + /* Default construction takes SYMTAB as an argument. */
> > + cgraph_summary (symbol_table *symtab, bool ggc = false): m_ggc (ggc),
> > + m_insertion_enabled (true), m_symtab (symtab)
> > + {
> > + cgraph_node *node;
> > +
> > + FOR_EACH_FUNCTION (node)
> > + {
> > + gcc_assert (node->summary_uid > 0);
> > + }
> > +
> > + m_map = new hash_map<int, T*, summary_hashmap_traits>(13, m_ggc);
> > +
> > + m_symtab_insertion_hook =
> > + symtab->add_cgraph_insertion_hook
> > + (cgraph_summary::symtab_insertion, this);
> > +
> > + m_symtab_removal_hook =
> > + symtab->add_cgraph_removal_hook
> > + (cgraph_summary::symtab_removal, this);
> > + m_symtab_duplication_hook =
> > + symtab->add_cgraph_duplication_hook
> > + (cgraph_summary::symtab_duplication, this);
> > + }
> > +
> > + /* Destructor. */
> > + virtual ~cgraph_summary ()
> > + {
> > + destroy ();
> > + }
>
> From https://gcc.gnu.org/wiki/CppConventions:
>
> Constructors and destructors are often much larger than programmers
> expect. Prefer non-inline versions unless you have evidence that the
> inline version is needed.
I never really agreed with that, and we don't really follow it. However
it really doesn't matter in this case since its virtual.
Trev
More information about the Gcc-patches
mailing list