[PATCH 2/4] New data structure for cgraph_summary introduced.
Martin Liška
mliska@suse.cz
Thu Nov 13 15:04:00 GMT 2014
On 11/13/2014 03:48 PM, 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.
>
>> ...
>> + 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.
>
Hi.
Thank you for remarks. There's new version of the patch.
Thanks,
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cgraph_annotation_2-v2.patch
Type: text/x-patch
Size: 11605 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141113/77114747/attachment.bin>
More information about the Gcc-patches
mailing list