This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] gas: xtensa: reuse find_trampoline_seg


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1c2649f50f4e40c07840f45c4d237efcdd02e8e2

commit 1c2649f50f4e40c07840f45c4d237efcdd02e8e2
Author: Max Filippov <jcmvbkbc@gmail.com>
Date:   Fri Nov 10 13:38:23 2017 -0800

    gas: xtensa: reuse find_trampoline_seg
    
    xtensa_create_trampoline_frag has opencoded fragment equivalent to
    find_trampoline_seg. Drop the fragment and use find_trampoline_seg
    instead. No functional changes.
    
    gas/
    2017-11-27  Max Filippov  <jcmvbkbc@gmail.com>
    
    	* config/tc-xtensa.c (find_trampoline_seg): Move above the first
    	use.
    	(xtensa_create_trampoline_frag): Replace trampoline seg search
    	code with a call to find_trampoline_seg.

Diff:
---
 gas/ChangeLog          |  7 +++++++
 gas/config/tc-xtensa.c | 38 ++++++++++++++++----------------------
 2 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index d156052..82c4f6b 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,12 @@
 2017-11-27  Max Filippov  <jcmvbkbc@gmail.com>
 
+	* config/tc-xtensa.c (find_trampoline_seg): Move above the first
+	use.
+	(xtensa_create_trampoline_frag): Replace trampoline seg search
+	code with a call to find_trampoline_seg.
+
+2017-11-27  Max Filippov  <jcmvbkbc@gmail.com>
+
 	* config/tc-xtensa.c (xg_append_jump): New function.
 	(xg_relax_trampoline, init_trampoline_frag)
 	(add_jump_to_trampoline): Replace trampoline jump assembling
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index eccf3c3..a8ed49b 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -7421,6 +7421,21 @@ static xtensa_insnbuf litpool_slotbuf = NULL;
 
 #define TRAMPOLINE_FRAG_SIZE 3000
 
+static struct trampoline_seg *
+find_trampoline_seg (asection *seg)
+{
+  struct trampoline_seg *ts = trampoline_seg_list.next;
+
+  for ( ; ts; ts = ts->next)
+    {
+      if (ts->seg == seg)
+	return ts;
+    }
+
+  return NULL;
+}
+
+
 static void
 xtensa_create_trampoline_frag (bfd_boolean needs_jump_around)
 {
@@ -7430,18 +7445,12 @@ xtensa_create_trampoline_frag (bfd_boolean needs_jump_around)
      We allocate enough for 1000 trampolines in each frag.
      If that's not enough, oh well.  */
 
-  struct trampoline_seg *ts = trampoline_seg_list.next;
+  struct trampoline_seg *ts = find_trampoline_seg (now_seg);
   struct trampoline_frag *tf;
   char *varP;
   fragS *fragP;
   int size = TRAMPOLINE_FRAG_SIZE;
 
-  for ( ; ts; ts = ts->next)
-    {
-      if (ts->seg == now_seg)
-	break;
-    }
-
   if (ts == NULL)
     {
       ts = XCNEW(struct trampoline_seg);
@@ -7469,21 +7478,6 @@ xtensa_create_trampoline_frag (bfd_boolean needs_jump_around)
 }
 
 
-static struct trampoline_seg *
-find_trampoline_seg (asection *seg)
-{
-  struct trampoline_seg *ts = trampoline_seg_list.next;
-
-  for ( ; ts; ts = ts->next)
-    {
-      if (ts->seg == seg)
-	return ts;
-    }
-
-  return NULL;
-}
-
-
 void dump_trampolines (void);
 
 void


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]