diff options
author | Geoffrey Keating <geoffk@apple.com> | 2003-10-07 19:48:23 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2003-10-07 19:48:23 +0000 |
commit | a594a19c2a352d53de842809678db0171e99878b (patch) | |
tree | c53a7e4a83374635bd98d065b41f34892f94f167 /gcc/function.c | |
parent | da61a073057aea7ae3441f077bfd3a8d822e4d08 (diff) | |
download | gcc-a594a19c2a352d53de842809678db0171e99878b.zip gcc-a594a19c2a352d53de842809678db0171e99878b.tar.gz gcc-a594a19c2a352d53de842809678db0171e99878b.tar.bz2 |
function.c (pad_to_arg_alignment): Take STACK_POINTER_OFFSET into account when aligning arguments.
2003-10-07 Geoffrey Keating <geoffk@apple.com>
* function.c (pad_to_arg_alignment): Take STACK_POINTER_OFFSET into
account when aligning arguments.
* calls.c (STACK_POINTER_OFFSET): Move default from here ...
* defaults.h (STACK_POINTER_OFFSET): ... to here.
* config/sparc/sparc.h (STACK_BOUNDARY): Add comment about how
it's wrong when TARGET_ARCH64 && TARGET_STACK_BIAS.
(SPARC_STACK_BOUNDARY_HACK): Define.
* config/rs6000/rs6000.c (function_arg): On non-SVR4 systems,
arrange for vector parameters to varargs functions to be passed
in both memory and GPRs when appropriate.
(rs6000_va_arg): Vector arguments passed in memory are 16-byte
aligned.
Index: testsuite/ChangeLog
2003-10-07 Geoffrey Keating <geoffk@apple.com>
* gcc.dg/darwin-abi-2.c: New file.
* gcc.c-torture/execute/va-arg-24.c: New file.
From-SVN: r72199
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/gcc/function.c b/gcc/function.c index 0251fe3..0f158ac 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -5511,6 +5511,16 @@ pad_to_arg_alignment (struct args_size *offset_ptr, int boundary, { tree save_var = NULL_TREE; HOST_WIDE_INT save_constant = 0; + HOST_WIDE_INT sp_offset = STACK_POINTER_OFFSET; + +#ifdef SPARC_STACK_BOUNDARY_HACK + /* The sparc port has a bug. It sometimes claims a STACK_BOUNDARY + higher than the real alignment of %sp. However, when it does this, + the alignment of %sp+STACK_POINTER_OFFSET will be STACK_BOUNDARY. + This is a temporary hack while the sparc port is fixed. */ + if (SPARC_STACK_BOUNDARY_HACK) + sp_offset = 0; +#endif int boundary_in_bytes = boundary / BITS_PER_UNIT; @@ -5527,14 +5537,17 @@ pad_to_arg_alignment (struct args_size *offset_ptr, int boundary, { if (offset_ptr->var) { - offset_ptr->var = + tree sp_offset_tree = ssize_int (sp_offset); + tree offset = size_binop (PLUS_EXPR, + ARGS_SIZE_TREE (*offset_ptr), + sp_offset_tree); #ifdef ARGS_GROW_DOWNWARD - round_down + tree rounded = round_down (offset, boundary / BITS_PER_UNIT); #else - round_up + tree rounded = round_up (offset, boundary / BITS_PER_UNIT); #endif - (ARGS_SIZE_TREE (*offset_ptr), - boundary / BITS_PER_UNIT); + + offset_ptr->var = size_binop (MINUS_EXPR, rounded, sp_offset_tree); /* ARGS_SIZE_TREE includes constant term. */ offset_ptr->constant = 0; if (boundary > PARM_BOUNDARY && boundary > STACK_BOUNDARY) @@ -5543,11 +5556,11 @@ pad_to_arg_alignment (struct args_size *offset_ptr, int boundary, } else { - offset_ptr->constant = + offset_ptr->constant = -sp_offset + #ifdef ARGS_GROW_DOWNWARD - FLOOR_ROUND (offset_ptr->constant, boundary_in_bytes); + FLOOR_ROUND (offset_ptr->constant + sp_offset, boundary_in_bytes); #else - CEIL_ROUND (offset_ptr->constant, boundary_in_bytes); + CEIL_ROUND (offset_ptr->constant + sp_offset, boundary_in_bytes); #endif if (boundary > PARM_BOUNDARY && boundary > STACK_BOUNDARY) alignment_pad->constant = offset_ptr->constant - save_constant; |