gas: xtensa: speed up find_trampoline_seg

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.
This commit is contained in:
Max Filippov 2017-11-20 06:35:06 -08:00
parent 148d638429
commit 407e114084
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,8 @@
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)

View File

@ -7453,11 +7453,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;