[PATCH 8/8] gas: xtensa: speed up find_trampoline_seg
Max Filippov
jcmvbkbc@gmail.com
Mon Nov 27 19:40:00 GMT 2017
find_trampoline_seg takes noticeable time when assembling source with
many sections. Cache the result of the most recent search and check it
first. No functional changes.
gas/
2017-11-20 Max Filippov <jcmvbkbc@gmail.com>
* config/tc-xtensa.c (find_trampoline_seg): Add static variable
that caches the result of the most recent search.
---
gas/config/tc-xtensa.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 1fa059c29302..b16d81c64e23 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -7463,11 +7463,18 @@ static struct trampoline_seg *
find_trampoline_seg (asection *seg)
{
struct trampoline_seg *ts = trampoline_seg_list.next;
+ static struct trampoline_seg *mr;
+
+ if (mr && mr->seg == seg)
+ return mr;
for ( ; ts; ts = ts->next)
{
if (ts->seg == seg)
- return ts;
+ {
+ mr = ts;
+ return ts;
+ }
}
return NULL;
--
2.1.4
More information about the Binutils
mailing list