summaryrefslogtreecommitdiff
path: root/gcc/attribs.h
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2017-09-12 16:24:29 +0200
committerMartin Liska <marxin@gcc.gnu.org>2017-09-12 14:24:29 +0000
commit13bdca744bda9321d6e0f4beca7bf9ac2e0870c0 (patch)
tree9a86fbfc054247f37f8de32b3f1a30ec141c2e8e /gcc/attribs.h
parent29545149bf8ca8c89a9a7d32fe7fdb8e9294759c (diff)
downloadgcc-13bdca744bda9321d6e0f4beca7bf9ac2e0870c0.tar.gz
Reduce lookup_attribute memory footprint.
2017-09-12 Martin Liska <mliska@suse.cz> * attribs.c (private_lookup_attribute): New function. * attribs.h (private_lookup_attribute): Declared here. (lookup_attribute): Called from this place. From-SVN: r252022
Diffstat (limited to 'gcc/attribs.h')
-rw-r--r--gcc/attribs.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/gcc/attribs.h b/gcc/attribs.h
index 06e6993e958..65e002ce988 100644
--- a/gcc/attribs.h
+++ b/gcc/attribs.h
@@ -87,6 +87,14 @@ extern tree handle_dll_attribute (tree *, tree, tree, int, bool *);
extern int attribute_list_equal (const_tree, const_tree);
extern int attribute_list_contained (const_tree, const_tree);
+/* The backbone of lookup_attribute(). ATTR_LEN is the string length
+ of ATTR_NAME, and LIST is not NULL_TREE.
+
+ The function is called from lookup_attribute in order to optimize
+ for size. */
+extern tree private_lookup_attribute (const char *attr_name, size_t attr_len,
+ tree list);
+
/* For a given IDENTIFIER_NODE, strip leading and trailing '_' characters
so that we have a canonical form of attribute names. */
@@ -151,17 +159,7 @@ lookup_attribute (const char *attr_name, tree list)
/* 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. */
- while (list)
- {
- tree attr = get_attribute_name (list);
- size_t ident_len = IDENTIFIER_LENGTH (attr);
- if (cmp_attribs (attr_name, attr_len, IDENTIFIER_POINTER (attr),
- ident_len))
- break;
- list = TREE_CHAIN (list);
- }
-
- return list;
+ return private_lookup_attribute (attr_name, attr_len, list);
}
}