From 63296cb1fedf5f58b90783fab73c90760b5e315b Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Wed, 29 Jun 2005 15:21:42 +0000 Subject: [PATCH] s390.c (s390_decompose_address): Accept invalid displacements for addresses containing frame_pointer_rtx or... 2005-06-29 Andreas Krebbel * 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 | 11 +++++++++++ gcc/config/s390/s390.c | 24 +++++++++++++++--------- gcc/config/s390/s390.h | 10 +++++----- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 708f198..151a7c8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2005-06-29 Andreas Krebbel + + * 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 * c-common.c (flag_next_runtime): Move... diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 6311833..1dfefc5 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -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: diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index 77387e6..42119a4 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -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 -- 2.7.4