s390.c (s390_decompose_address): Accept invalid displacements for addresses containin...
authorAndreas Krebbel <krebbel1@de.ibm.com>
Wed, 29 Jun 2005 15:21:42 +0000 (15:21 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Wed, 29 Jun 2005 15:21:42 +0000 (15:21 +0000)
2005-06-29  Andreas Krebbel  <krebbel1@de.ibm.com>

* config/s390/s390.c (s390_decompose_address): Accept invalid
displacements for addresses containing frame_pointer_rtx or
virtual_stack_vars_rtx.
(s390_frame_info): Replaced use of STARTING_FRAME_OFFSET.
(s390_initial_elimination_offset): New offset when eliminating the
soft frame pointer.
* config/s390/s390.h (FRAME_GROWS_DOWNWARD): Defined as 1.
(STARTING_FRAME_OFFSET, STACK_DYNAMIC_OFFSET): Definitions changed.

From-SVN: r101422

gcc/ChangeLog
gcc/config/s390/s390.c
gcc/config/s390/s390.h

index 708f198e923ba5ea29063133b1f716e1e8a97f7e..151a7c83b5b79c903cfd18755052b9e039b5aad3 100644 (file)
@@ -1,3 +1,14 @@
+2005-06-29  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       * config/s390/s390.c (s390_decompose_address): Accept invalid
+       displacements for addresses containing frame_pointer_rtx or
+       virtual_stack_vars_rtx.
+       (s390_frame_info): Replaced use of STARTING_FRAME_OFFSET.
+       (s390_initial_elimination_offset): New offset when eliminating the 
+       soft frame pointer.
+       * config/s390/s390.h (FRAME_GROWS_DOWNWARD): Defined as 1.
+       (STARTING_FRAME_OFFSET, STACK_DYNAMIC_OFFSET): Definitions changed.
+
 2006-06-28  Ziemowit Laski  <zlaski@apple.com>
 
        * c-common.c (flag_next_runtime): Move...
index 6311833d390d1dd446e6906fbd797cf35aa69334..1dfefc5369c03f161ec140140b66268ecfacbded 100644 (file)
@@ -1490,19 +1490,22 @@ s390_decompose_address (rtx addr, struct s390_address *out)
   /* Validate displacement.  */
   if (!disp)
     {
-      /* If the argument pointer or the return address pointer are involved,
-        the displacement will change later anyway as the virtual registers get
-        eliminated.  This could make a valid displacement invalid, but it is 
-        more likely to make an invalid displacement valid, because we sometimes
-        access the register save area via negative offsets to one of those 
-        registers.
+      /* If virtual registers are involved, the displacement will change later 
+        anyway as the virtual registers get eliminated.  This could make a 
+        valid displacement invalid, but it is more likely to make an invalid 
+        displacement valid, because we sometimes access the register save area 
+        via negative offsets to one of those registers.
         Thus we don't check the displacement for validity here.  If after
         elimination the displacement turns out to be invalid after all,
         this is fixed up by reload in any case.  */
       if (base != arg_pointer_rtx 
          && indx != arg_pointer_rtx 
          && base != return_address_pointer_rtx 
-         && indx != return_address_pointer_rtx)
+         && indx != return_address_pointer_rtx
+         && base != frame_pointer_rtx 
+         && indx != frame_pointer_rtx
+         && base != virtual_stack_vars_rtx 
+         && indx != virtual_stack_vars_rtx)
        if (!DISP_IN_RANGE (offset))
          return false;
     }
@@ -5865,7 +5868,8 @@ s390_frame_info (void)
     return;
 
   if (!TARGET_PACKED_STACK)
-    cfun_frame_layout.frame_size += (STARTING_FRAME_OFFSET
+    cfun_frame_layout.frame_size += (STACK_POINTER_OFFSET
+                                    + current_function_outgoing_args_size
                                     + cfun_frame_layout.high_fprs * 8);
   else
     {
@@ -6008,7 +6012,9 @@ s390_initial_elimination_offset (int from, int to)
   switch (from)
     {
     case FRAME_POINTER_REGNUM:
-      offset = 0;
+      offset = (get_frame_size() 
+               + STACK_POINTER_OFFSET
+               + current_function_outgoing_args_size);
       break;
 
     case ARG_POINTER_REGNUM:
index 77387e6a5809c0294fb6adc5ba1649bfd52af001..42119a467b1554aa57fd1b28f52f572c69a14e75 100644 (file)
@@ -506,7 +506,7 @@ extern const enum reg_class regclass_map[FIRST_PSEUDO_REGISTER];
    are accessed by positive offsets, and function arguments are stored at
    increasing addresses.  */
 #define STACK_GROWS_DOWNWARD
-/* #define FRAME_GROWS_DOWNWARD 0 */
+#define FRAME_GROWS_DOWNWARD 1
 /* #undef ARGS_GROW_DOWNWARD */
 
 /* The basic stack layout looks like this: the stack pointer points
@@ -518,13 +518,13 @@ extern const enum reg_class regclass_map[FIRST_PSEUDO_REGISTER];
 #define STACK_POINTER_OFFSET (TARGET_64BIT ? 160 : 96)
 
 /* Offset within stack frame to start allocating local variables at.  */
-extern int current_function_outgoing_args_size;
-#define STARTING_FRAME_OFFSET \
-     (STACK_POINTER_OFFSET + current_function_outgoing_args_size)
+#define STARTING_FRAME_OFFSET 0
 
 /* Offset from the stack pointer register to an item dynamically
    allocated on the stack, e.g., by `alloca'.  */
-#define STACK_DYNAMIC_OFFSET(FUNDECL) (STARTING_FRAME_OFFSET)
+extern int current_function_outgoing_args_size;
+#define STACK_DYNAMIC_OFFSET(FUNDECL) \
+  (STACK_POINTER_OFFSET + current_function_outgoing_args_size)
 
 /* Offset of first parameter from the argument pointer register value.
    We have a fake argument pointer register that points directly to