diff options
author | Nick Clifton <nickc@cambridge.redhat.com> | 2002-01-24 16:27:51 +0000 |
---|---|---|
committer | Nick Clifton <nickc@gcc.gnu.org> | 2002-01-24 16:27:51 +0000 |
commit | 92a4639e2eeaa74745592505e1e927b8f81b6b85 (patch) | |
tree | 95f50f466fdd86ca7863745e0dff124c2f88e81d | |
parent | 467cb2da563aa7b595a0de7fe36e4c4c50fcd480 (diff) | |
download | gcc-92a4639e2eeaa74745592505e1e927b8f81b6b85.zip gcc-92a4639e2eeaa74745592505e1e927b8f81b6b85.tar.gz gcc-92a4639e2eeaa74745592505e1e927b8f81b6b85.tar.bz2 |
Allow SImode values to be assigned to the stack pointer.
From-SVN: r49183
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/arm/arm.c | 15 |
2 files changed, 19 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9bd5fe4..aa3fe7b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-01-24 Nick Clifton <nickc@cambridge.redhat.com> + + * config/arm/arm.c (arm_hard_regno_mode_ok): Allow SImode + values to be assigned to the stack pointer. + 2002-01-14 Hartmut Penner <hpenner@de.ibm.com> * emit_rtl.c (gen_lowpart_common): Conversion from const_int diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 567daa3..1999af0 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -9143,7 +9143,20 @@ arm_hard_regno_mode_ok (regno, mode) 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. */ - return regno < (SP_REGNUM - (unsigned) NUM_REGS (mode)); + { + /* 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)); + } if ( regno == FRAME_POINTER_REGNUM || regno == ARG_POINTER_REGNUM) |