diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-05 10:49:06 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-05 10:49:06 +0000 |
commit | f05722ee0a2710c7504cd3aae1e156bbb210b35e (patch) | |
tree | e49ff40ba730819257273683f54ffa3c90c352a5 /gcc/config/arm | |
parent | 53087cb544c2ee2d6dae2e06e62f4b8472f11833 (diff) | |
download | gcc-f05722ee0a2710c7504cd3aae1e156bbb210b35e.tar.gz |
2008-08-05 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r138697
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@138698 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/arm')
-rw-r--r-- | gcc/config/arm/arm-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/arm/arm.c | 24 | ||||
-rw-r--r-- | gcc/config/arm/arm.h | 3 |
3 files changed, 29 insertions, 0 deletions
diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index a2963494c48..bdf9a04416b 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -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 */ diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index a89229ec12a..8b89904ffa1 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -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" diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 9f662f31297..2ab44c24483 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -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. */ |