aboutsummaryrefslogtreecommitdiff
path: root/gcc/attribs.c
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.c
parent29545149bf8ca8c89a9a7d32fe7fdb8e9294759c (diff)
downloadgcc-13bdca744bda9321d6e0f4beca7bf9ac2e0870c0.zip
gcc-13bdca744bda9321d6e0f4beca7bf9ac2e0870c0.tar.gz
gcc-13bdca744bda9321d6e0f4beca7bf9ac2e0870c0.tar.bz2
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.c')
-rw-r--r--gcc/attribs.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c
index b8f58a7..4ef35b8 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -1584,3 +1584,25 @@ attribute_list_contained (const_tree l1, const_tree l2)
return 1;
}
+
+/* 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. */
+
+tree
+private_lookup_attribute (const char *attr_name, size_t attr_len, tree list)
+{
+ 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;
+}