]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm.c (thumb_core_reg_alloc_order): New.
authorPaul Brook <paul@codesourcery.com>
Mon, 4 Aug 2008 16:27:17 +0000 (16:27 +0000)
committerPaul Brook <pbrook@gcc.gnu.org>
Mon, 4 Aug 2008 16:27:17 +0000 (16:27 +0000)
2008-08-04  Paul Brook  <paul@codesourcery.com>

gcc/
* cofig/arm/arm.c (thumb_core_reg_alloc_order): New.
(arm_order_regs_for_local_alloc): New function.
* config/arm/arm-protos.h (arm_order_regs_for_local_alloc): Add
prototype.
* config/arm/arm.h (ORDER_REGS_FOR_LOCAL_ALLOC): Define.

From-SVN: r138640

gcc/ChangeLog
gcc/config/arm/arm-protos.h
gcc/config/arm/arm.c
gcc/config/arm/arm.h

index 9483e53798623e085fa538799dc798d8d3082f3f..51138d63eb19488b32624bab3d7443a64349bb33 100644 (file)
@@ -1,3 +1,11 @@
+2008-08-04  Paul Brook  <paul@codesourcery.com>
+
+       * cofig/arm/arm.c (thumb_core_reg_alloc_order): New.
+       (arm_order_regs_for_local_alloc): New function.
+       * config/arm/arm-protos.h (arm_order_regs_for_local_alloc): Add
+       prototype.
+       * config/arm/arm.h (ORDER_REGS_FOR_LOCAL_ALLOC): Define.
+
 2008-08-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/37012
index a2963494c480750bf00c5f679f71d2cbdb950b86..bdf9a04416b9e9a7a2f0d06bd5f9013784166bc9 100644 (file)
@@ -208,4 +208,6 @@ extern void arm_lang_object_attributes_init(void);
 
 extern const char *arm_mangle_type (const_tree);
 
+extern void arm_order_regs_for_local_alloc (void);
+
 #endif /* ! GCC_ARM_PROTOS_H */
index a89229ec12ac99455170d01bd690ab9bbb3864ad..8b89904ffa18df9cd7c9373865e9ca037f9a83c4 100644 (file)
@@ -19046,4 +19046,28 @@ arm_mangle_type (const_tree type)
   return NULL;
 }
 
+/* Order of allocation of core registers for Thumb: this allocation is
+   written over the corresponding initial entries of the array
+   initialized with REG_ALLOC_ORDER.  We allocate all low registers
+   first.  Saving and restoring a low register is usually cheaper than
+   using a call-clobbered high register.  */
+
+static const int thumb_core_reg_alloc_order[] =
+{
+   3,  2,  1,  0,  4,  5,  6,  7,
+  14, 12,  8,  9, 10, 11, 13, 15
+};
+
+/* Adjust register allocation order when compiling for Thumb.  */
+
+void
+arm_order_regs_for_local_alloc (void)
+{
+  const int arm_reg_alloc_order[] = REG_ALLOC_ORDER;
+  memcpy(reg_alloc_order, arm_reg_alloc_order, sizeof (reg_alloc_order));
+  if (TARGET_THUMB)
+    memcpy (reg_alloc_order, thumb_core_reg_alloc_order,
+            sizeof (thumb_core_reg_alloc_order));
+}
+
 #include "gt-arm.h"
index 9f662f312977caeee7078cb22506a3799bf1a6d4..2ab44c2448343f22b1815a9e1e172dae50343b92 100644 (file)
@@ -1080,6 +1080,9 @@ extern int arm_structure_size_boundary;
    127                                         \
 }
 
+/* Use different register alloc ordering for Thumb.  */
+#define ORDER_REGS_FOR_LOCAL_ALLOC arm_order_regs_for_local_alloc ()
+
 /* Interrupt functions can only use registers that have already been
    saved by the prologue, even if they would normally be
    call-clobbered.  */