This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/4] New data structure for cgraph_summary introduced.
- From: Trevor Saunders <tsaunders at mozilla dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 14 Nov 2014 01:19:01 -0500
- Subject: Re: [PATCH 2/4] New data structure for cgraph_summary introduced.
- Authentication-results: sourceware.org; auth=none
- References: <cd4c62522f43eb2d2ad92769431e91c8d8bd15bc dot 1415888515 dot git dot mliska at suse dot cz> <8d6246a176f0270dee1f5b190e8ecbddebee342f dot 1415888515 dot git dot mliska at suse dot cz> <20141113144834 dot GA346 at x4>
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