aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/arm
diff options
context:
space:
mode:
authorNick Clifton <nickc@cambridge.redhat.com>2002-01-25 11:44:12 +0000
committerNick Clifton <nickc@gcc.gnu.org>2002-01-25 11:44:12 +0000
commit55492b32d768d06b1fee8bcade2ac198c3b8aee4 (patch)
treede1fd54a892e46adcca3d1cdf52259d8a8a95486 /gcc/config/arm
parent72c7c913b4bfd72a05b6085b3477201f1cbcac9a (diff)
downloadgcc-55492b32d768d06b1fee8bcade2ac198c3b8aee4.zip
gcc-55492b32d768d06b1fee8bcade2ac198c3b8aee4.tar.gz
gcc-55492b32d768d06b1fee8bcade2ac198c3b8aee4.tar.bz2
Allow any general purpose register to hold an SImode (or smaller) value.
From-SVN: r49213
Diffstat (limited to 'gcc/config/arm')
-rw-r--r--gcc/config/arm/arm.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 1999af0..dd823a2 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -9139,24 +9139,20 @@ arm_hard_regno_mode_ok (regno, mode)
return (NUM_REGS (mode) < 2) || (regno < LAST_LO_REGNUM);
if (regno <= LAST_ARM_REGNUM)
- /* If the register is a general purpose ARM register we allow
- it only if it not a special register (SP, LR, PC) and only
- if there will be enough (non-special) registers to hold the
- entire value. */
- {
- /* As a special exception we allow an SImode value to be
- "assigned" to the stack pointer. This is not intended
- to actually allow a value to be stored in the SP, but so
- that the stack pointer can be referenced from C code like
- this:
-
- register char * stack_ptr asm ("sp");
-
- This expression is actually used in newlib... */
- if (mode == SImode && regno == SP_REGNUM)
- return 1;
- return regno < (SP_REGNUM - (unsigned) NUM_REGS (mode));
- }
+ /* We allow an SImode or smaller value to be stored in any
+ general purpose register. This does not mean, for example
+ that GCC will choose to store a variable in the stack pointer
+ since it is a fixed register. But it is important to allow
+ access to these special registers, so that they can be
+ referenced from C code via the asm assembler alias, eg:
+
+ register char * stack_ptr asm ("sp");
+
+ For any mode requiring more than one register to hold the
+ value we restrict the choice so that r13, r14, and r15
+ cannot be part of the register set. */
+ return (NUM_REGS (mode) <= 1)
+ || (regno < (SP_REGNUM - (unsigned) NUM_REGS (mode)));
if ( regno == FRAME_POINTER_REGNUM
|| regno == ARG_POINTER_REGNUM)