Allow SImode values to be assigned to the stack pointer.
authorNick Clifton <nickc@cambridge.redhat.com>
Thu, 24 Jan 2002 16:27:51 +0000 (16:27 +0000)
committerNick Clifton <nickc@gcc.gnu.org>
Thu, 24 Jan 2002 16:27:51 +0000 (16:27 +0000)
From-SVN: r49183

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

index 9bd5fe4b357730b92c36129ed1e81b301d3e8358..aa3fe7bac4e04c77bac076b409497f43ef14f1cf 100644 (file)
@@ -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 
index 567daa3731286feb14c29d82183667393475a505..1999af04e4ee0d2d105f711de7d2d1e176c21d04 100644 (file)
@@ -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)