Commit b10fb078 by Iain Sandoe Committed by Iain Sandoe

darwin - fix powerpc-darwin stack alignments

2018-10-28  Iain Sandoe  <iain@sandoe.co.uk>

	PR target/85669
	* config/rs6000/darwin.h (STACK_BOUNDARY): New.
	(RS6000_STARTING_FRAME_OFFSET): Adjust to preserve 16byte alignment.
	(STACK_DYNAMIC_OFFSET): Likewise.

From-SVN: r265568
parent 01497ce7
2018-10-28 Iain Sandoe <iain@sandoe.co.uk>
PR target/85669
* config/rs6000/darwin.h (STACK_BOUNDARY): New.
(RS6000_STARTING_FRAME_OFFSET): Adjust to preserve 16byte alignment.
(STACK_DYNAMIC_OFFSET): Likewise.
2018-10-27 Sandra Loosemore <sandra@codesourcery.com>
PR target/80024
......@@ -159,17 +159,45 @@ extern int darwin_emit_branch_islands;
#undef RS6000_PIC_OFFSET_TABLE_REGNUM
#define RS6000_PIC_OFFSET_TABLE_REGNUM 31
/* Pad the outgoing args area to 16 bytes instead of the usual 8. */
/* Darwin's stack must remain 16-byte aligned for both 32 and 64 bit
ABIs. */
#undef STACK_BOUNDARY
#define STACK_BOUNDARY 128
/* Offset within stack frame to start allocating local variables at.
For supported Darwin versions, FRAME_GROWS_DOWNWARD is true, therefore
this value is the offset to the END of the first local allocated.
On the RS/6000, the frame pointer is the same as the stack pointer,
except for dynamic allocations. So we start after the fixed area and
outgoing parameter area.
If the function uses dynamic stack space (CALLS_ALLOCA is set), that
space needs to be aligned to STACK_BOUNDARY, i.e. the sum of the
sizes of the fixed area and the parameter area must be a multiple of
STACK_BOUNDARY. */
#undef RS6000_STARTING_FRAME_OFFSET
#define RS6000_STARTING_FRAME_OFFSET \
(RS6000_ALIGN (crtl->outgoing_args_size, 16) \
+ RS6000_SAVE_AREA)
(cfun->calls_alloca \
? RS6000_ALIGN (crtl->outgoing_args_size + RS6000_SAVE_AREA, 16) \
: (RS6000_ALIGN (crtl->outgoing_args_size, 16) + RS6000_SAVE_AREA))
/* Offset from the stack pointer register to an item dynamically
allocated on the stack, e.g., by `alloca'.
The default value for this macro is `STACK_POINTER_OFFSET' plus the
length of the outgoing arguments. The default is correct for most
machines. See `function.c' for details.
This value must be a multiple of STACK_BOUNDARY (hard coded in
`emit-rtl.c'). */
#undef STACK_DYNAMIC_OFFSET
#define STACK_DYNAMIC_OFFSET(FUNDECL) \
(RS6000_ALIGN (crtl->outgoing_args_size.to_constant (), 16) \
+ (STACK_POINTER_OFFSET))
RS6000_ALIGN (crtl->outgoing_args_size.to_constant() \
+ STACK_POINTER_OFFSET, 16)
/* Darwin uses a function call if everything needs to be saved/restored. */
......
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