[PATCH 2/4] New data structure for cgraph_summary introduced.
Markus Trippelsdorf
markus@trippelsdorf.de
Thu Nov 13 14:52:00 GMT 2014
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.
>...
> + inline T* operator[] (int uid)
> + {
> + T **v = m_map->get (uid);
The inline keyword is redundant for members inside a class definition.
Please drop it.
--
Markus
More information about the Gcc-patches
mailing list