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-27 Max Filippov <jcmvbkbc@gmail.com>
* config/tc-xtensa.c (find_trampoline_seg): Add static variable
that caches the result of the most recent search.
+2017-11-27 Max Filippov <jcmvbkbc@gmail.com>
+
+ * config/tc-xtensa.c (find_trampoline_seg): Add static variable
+ that caches the result of the most recent search.
+
2017-11-27 Max Filippov <jcmvbkbc@gmail.com>
* config/tc-xtensa.c (trampoline_chain_entry, trampoline_chain)
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;