Commit ba6adec4 by Adam Nemet

mips.h (FRAME_GROWS_DOWNWARD, [...]): Define new macros.

	* config/mips/mips.h (FRAME_GROWS_DOWNWARD,
	MIPS_GP_SAVE_AREA_SIZE): Define new macros.
	(STARTING_FRAME_OFFSET): Return 0 if FRAME_GROWS_DOWNWARD.  Use
	MIPS_GP_SAVE_AREA_SIZE.
	* config/mips/mips.c (struct mips_frame_info): Update comment
	before arg_pointer_offset and hard_frame_pointer_offset.
	(mips_compute_frame_info): Update diagram before function: to
	correctly use stack_pointer_rtx for fp_sp_offset and gp_sp_offset, to
	indicate the position of frame_pointer_rtx with -fstack-protector and
	to show args_size.  Don't allocate cprestore area for leaf functions
	if FRAME_GROWS_DOWNWARD.  Use MIPS_GP_SAVE_AREA_SIZE to set
	cprestore_size.
	(mips_initial_elimination_offset): Update for FRAME_GROWS_DOWNWARD.

From-SVN: r147024
parent 794f21f9
2009-04-30 Adam Nemet <anemet@caviumnetworks.com>
* config/mips/mips.h (FRAME_GROWS_DOWNWARD,
MIPS_GP_SAVE_AREA_SIZE): Define new macros.
(STARTING_FRAME_OFFSET): Return 0 if FRAME_GROWS_DOWNWARD. Use
MIPS_GP_SAVE_AREA_SIZE.
* config/mips/mips.c (struct mips_frame_info): Update comment
before arg_pointer_offset and hard_frame_pointer_offset.
(mips_compute_frame_info): Update diagram before function: to
correctly use stack_pointer_rtx for fp_sp_offset and gp_sp_offset, to
indicate the position of frame_pointer_rtx with -fstack-protector and
to show args_size. Don't allocate cprestore area for leaf functions
if FRAME_GROWS_DOWNWARD. Use MIPS_GP_SAVE_AREA_SIZE to set
cprestore_size.
(mips_initial_elimination_offset): Update for FRAME_GROWS_DOWNWARD.
2009-04-30 Michael Matz <matz@suse.de> 2009-04-30 Michael Matz <matz@suse.de>
PR tree-optimization/39955 PR tree-optimization/39955
* config/rs6000/rs6000.c (rs6000_check_sdmode): Also check SSA_NAMEs. * config/rs6000/rs6000.c (rs6000_check_sdmode): Also check SSA_NAMEs.
2009-04-30 Dave Korn <dave.korn.cygwin@gmail.com> 2009-04-30 Dave Korn <dave.korn.cygwin@gmail.com>
......
...@@ -285,10 +285,10 @@ struct GTY(()) mips_frame_info { ...@@ -285,10 +285,10 @@ struct GTY(()) mips_frame_info {
HOST_WIDE_INT acc_sp_offset; HOST_WIDE_INT acc_sp_offset;
HOST_WIDE_INT cop0_sp_offset; HOST_WIDE_INT cop0_sp_offset;
/* The offset of arg_pointer_rtx from frame_pointer_rtx. */ /* The offset of arg_pointer_rtx from the bottom of the frame. */
HOST_WIDE_INT arg_pointer_offset; HOST_WIDE_INT arg_pointer_offset;
/* The offset of hard_frame_pointer_rtx from frame_pointer_rtx. */ /* The offset of hard_frame_pointer_rtx from the bottom of the frame. */
HOST_WIDE_INT hard_frame_pointer_offset; HOST_WIDE_INT hard_frame_pointer_offset;
}; };
...@@ -8673,16 +8673,16 @@ mips_save_reg_p (unsigned int regno) ...@@ -8673,16 +8673,16 @@ mips_save_reg_p (unsigned int regno)
| | + UNITS_PER_WORD | | + UNITS_PER_WORD
| accumulator save area | | accumulator save area |
| | | |
+-------------------------------+ <-- frame_pointer_rtx + fp_sp_offset +-------------------------------+ <-- stack_pointer_rtx + fp_sp_offset
| | + UNITS_PER_HWFPVALUE | | + UNITS_PER_HWFPVALUE
| FPR save area | | FPR save area |
| | | |
+-------------------------------+ <-- frame_pointer_rtx + gp_sp_offset +-------------------------------+ <-- stack_pointer_rtx + gp_sp_offset
| | + UNITS_PER_WORD | | + UNITS_PER_WORD
| GPR save area | | GPR save area |
| | | |
+-------------------------------+ +-------------------------------+ <-- frame_pointer_rtx with
| | \ | | \ -fstack-protector
| local variables | | var_size | local variables | | var_size
| | / | | /
+-------------------------------+ +-------------------------------+
...@@ -8690,16 +8690,17 @@ mips_save_reg_p (unsigned int regno) ...@@ -8690,16 +8690,17 @@ mips_save_reg_p (unsigned int regno)
| $gp save area | | cprestore_size | $gp save area | | cprestore_size
| | / | | /
P +-------------------------------+ <-- hard_frame_pointer_rtx for P +-------------------------------+ <-- hard_frame_pointer_rtx for
| | MIPS16 code | | \ MIPS16 code
| outgoing stack arguments | | outgoing stack arguments | |
| | | | |
+-------------------------------+ +-------------------------------+ | args_size
| | | | |
| caller-allocated save area | | caller-allocated save area | |
| for register arguments | | for register arguments | |
| | | | /
+-------------------------------+ <-- stack_pointer_rtx +-------------------------------+ <-- stack_pointer_rtx
frame_pointer_rtx frame_pointer_rtx without
-fstack-protector
hard_frame_pointer_rtx for hard_frame_pointer_rtx for
non-MIPS16 code. non-MIPS16 code.
...@@ -8744,11 +8745,11 @@ mips_compute_frame_info (void) ...@@ -8744,11 +8745,11 @@ mips_compute_frame_info (void)
cfun->machine->global_pointer = mips_global_pointer (); cfun->machine->global_pointer = mips_global_pointer ();
/* The first STARTING_FRAME_OFFSET bytes contain the outgoing argument /* The first two blocks contain the outgoing argument area and the $gp save
area and the $gp save slot. This area isn't needed in leaf functions, slot. This area isn't needed in leaf functions, but if the
but if the target-independent frame size is nonzero, we're committed target-independent frame size is nonzero, we have already committed to
to allocating it anyway. */ allocating these in STARTING_FRAME_OFFSET for !FRAME_GROWS_DOWNWARD. */
if (size == 0 && current_function_is_leaf) if ((size == 0 || FRAME_GROWS_DOWNWARD) && current_function_is_leaf)
{ {
/* The MIPS 3.0 linker does not like functions that dynamically /* The MIPS 3.0 linker does not like functions that dynamically
allocate the stack and have 0 for STACK_DYNAMIC_OFFSET, since it allocate the stack and have 0 for STACK_DYNAMIC_OFFSET, since it
...@@ -8763,7 +8764,7 @@ mips_compute_frame_info (void) ...@@ -8763,7 +8764,7 @@ mips_compute_frame_info (void)
else else
{ {
frame->args_size = crtl->outgoing_args_size; frame->args_size = crtl->outgoing_args_size;
frame->cprestore_size = STARTING_FRAME_OFFSET - frame->args_size; frame->cprestore_size = MIPS_GP_SAVE_AREA_SIZE;
} }
offset = frame->args_size + frame->cprestore_size; offset = frame->args_size + frame->cprestore_size;
...@@ -8942,12 +8943,16 @@ mips_initial_elimination_offset (int from, int to) ...@@ -8942,12 +8943,16 @@ mips_initial_elimination_offset (int from, int to)
mips_compute_frame_info (); mips_compute_frame_info ();
/* Set OFFSET to the offset from the soft frame pointer, which is also /* Set OFFSET to the offset from the end-of-prologue stack pointer. */
the offset from the end-of-prologue stack pointer. */
switch (from) switch (from)
{ {
case FRAME_POINTER_REGNUM: case FRAME_POINTER_REGNUM:
offset = 0; if (FRAME_GROWS_DOWNWARD)
offset = (cfun->machine->frame.args_size
+ cfun->machine->frame.cprestore_size
+ cfun->machine->frame.var_size);
else
offset = 0;
break; break;
case ARG_POINTER_REGNUM: case ARG_POINTER_REGNUM:
......
...@@ -2081,12 +2081,20 @@ enum reg_class ...@@ -2081,12 +2081,20 @@ enum reg_class
#define STACK_GROWS_DOWNWARD #define STACK_GROWS_DOWNWARD
/* The offset of the first local variable from the beginning of the frame. #define FRAME_GROWS_DOWNWARD flag_stack_protect
See mips_compute_frame_info for details about the frame layout. */
#define STARTING_FRAME_OFFSET \ /* Size of the area allocated in the frame to save the GP. */
(crtl->outgoing_args_size \
+ (TARGET_CALL_CLOBBERED_GP ? MIPS_STACK_ALIGN (UNITS_PER_WORD) : 0)) #define MIPS_GP_SAVE_AREA_SIZE \
(TARGET_CALL_CLOBBERED_GP ? MIPS_STACK_ALIGN (UNITS_PER_WORD) : 0)
/* The offset of the first local variable from the frame pointer. See
mips_compute_frame_info for details about the frame layout. */
#define STARTING_FRAME_OFFSET \
(FRAME_GROWS_DOWNWARD \
? 0 \
: crtl->outgoing_args_size + MIPS_GP_SAVE_AREA_SIZE)
#define RETURN_ADDR_RTX mips_return_addr #define RETURN_ADDR_RTX mips_return_addr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment