diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2017-11-20 06:35:06 -0800 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2017-11-27 15:16:22 -0800 |
commit | 407e1140841f7fc337e90a7ba4482fb5a10c1701 (patch) | |
tree | df093648a065533bf0d0ffd62396811a1a6ec00d /gas | |
parent | 148d6384291720bcaaa062badf1179b6215f6da3 (diff) | |
download | gdb-407e1140841f7fc337e90a7ba4482fb5a10c1701.zip gdb-407e1140841f7fc337e90a7ba4482fb5a10c1701.tar.gz gdb-407e1140841f7fc337e90a7ba4482fb5a10c1701.tar.bz2 |
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.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 5 | ||||
-rw-r--r-- | gas/config/tc-xtensa.c | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 92d0c36..81f9f83 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,10 @@ 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) (trampoline_chain_index): New structures. (trampoline_index): Add chain_index field. diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index 9defd73..ce7eb49 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -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; |