OSDN Git Service

* arm.c (arm_get_frame_offsets): Prefer using r3 for padding a
authorrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Jun 2009 07:47:09 +0000 (07:47 +0000)
committerrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Jun 2009 07:47:09 +0000 (07:47 +0000)
push/pop multiple to 8-byte alignment.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148072 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/arm/arm.c

index 2fc45e3..0b96e70 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-02  Richard Earnshaw  <rearnsha@arm.com>
+
+       * arm.c (arm_get_frame_offsets): Prefer using r3 for padding a
+       push/pop multiple to 8-byte alignment.
+       
 2009-06-01  Jakub Jelinek  <jakub@redhat.com>
 
        * config/i386/i386.c (queued_cfa_restores): New static variable.
index 8ae8dab..24a94a6 100644 (file)
@@ -12822,22 +12822,23 @@ arm_get_frame_offsets (void)
        {
          int reg = -1;
 
-         for (i = 4; i <= (TARGET_THUMB1 ? LAST_LO_REGNUM : 11); i++)
+         /* If it is safe to use r3, then do so.  This sometimes 
+            generates better code on Thumb-2 by avoiding the need to
+            use 32-bit push/pop instructions.  */
+         if (!crtl->tail_call_emit
+             && arm_size_return_regs () <= 12)
            {
-             if ((offsets->saved_regs_mask & (1 << i)) == 0)
-               {
-                 reg = i;
-                 break;
-               }
-           }
-
-         if (reg == -1 && arm_size_return_regs () <= 12
-             && !crtl->tail_call_emit)
-           {
-             /* Push/pop an argument register (r3) if all callee saved
-                registers are already being pushed.  */
              reg = 3;
            }
+         else
+           for (i = 4; i <= (TARGET_THUMB1 ? LAST_LO_REGNUM : 11); i++)
+             {
+               if ((offsets->saved_regs_mask & (1 << i)) == 0)
+                 {
+                   reg = i;
+                   break;
+                 }
+             }
 
          if (reg != -1)
            {