On Thu, Jul 13, 2017 at 03:51:31PM +0200, Martin Liška wrote:
> It's request for comment where I mechanically moved attribute-related
> function to attribs.[hc].
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Thoughts?
I've only noticed this now, what is the reason for undoing the size
optimization we had, i.e. inline lookup_attribute that handles the most
common case inline only and inline computes the strlen (an important
optimization, because we almost always call it with a string literal
and strlen of that is a constant) and doing the rest out of line?
> -/* Given an attribute name ATTR_NAME and a list of attributes LIST,
> - return a pointer to the attribute's list element if the attribute
> - is part of the list, or NULL_TREE if not found. If the attribute
> - appears more than once, this only returns the first occurrence; the
> - TREE_CHAIN of the return value should be passed back in if further
> - occurrences are wanted. ATTR_NAME must be in the form 'text' (not
> - '__text__'). */
> -
> -static inline tree
> -lookup_attribute (const char *attr_name, tree list)
> -{
> - gcc_checking_assert (attr_name[0] != '_');
> - /* In most cases, list is NULL_TREE. */
> - if (list == NULL_TREE)
> - return NULL_TREE;
> - else
> - /* Do the strlen() before calling the out-of-line implementation.
> - In most cases attr_name is a string constant, and the compiler
> - will optimize the strlen() away. */
> - return private_lookup_attribute (attr_name, strlen (attr_name), list);
> -}
The current code instead inlines the whole lookup_attribute which is larger.
Have you looked at the code size effects of that change?
Jakub