From dfb1ee390b244652bcfdcbbebcade5741904cc36 Mon Sep 17 00:00:00 2001 From: law Date: Thu, 19 Nov 1998 22:47:55 +0000 Subject: [PATCH] * expr.c (STACK_BYTES): Delete unused macro. * calls.c: Provide default for PREFERRED_STACK_BOUNDARY. (STACK_BYTES): Use PREFERRED_STACK_BOUNDARY, not STACK_BOUNDARY. (expand_call): Likewise. (emit_library_call): Likewise. (emit_library_call_value): Likewise. * function.c: Provide default for PREFERRED_STACK_BOUNDARY. (STACK_BYTES): Use PREFERRED_STACK_BOUNDARY, not STACK_BOUNDARY. * explow.c: Provide default for PREFERRED_STACK_BOUNDARY. (round_push): Use PREFERRED_STACK_BOUNDARY, not STACK_BOUNDARY. (allocate_dynamic_stack_space): Likewise. * tm.texi (PREFERRED_STACK_BOUNDARY): Document new macro. (STACK_BOUNDARY): Update description to reflect the new situation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23730 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 16 ++++++++++++++++ gcc/calls.c | 32 ++++++++++++++++++-------------- gcc/explow.c | 22 +++++++++++++--------- gcc/expr.c | 3 --- gcc/function.c | 10 +++++++--- gcc/tm.texi | 19 ++++++++++++++----- 6 files changed, 68 insertions(+), 34 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 92ae27a..fff326d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +Thu Nov 19 23:44:38 1998 Bernd Schmidt + + * expr.c (STACK_BYTES): Delete unused macro. + * calls.c: Provide default for PREFERRED_STACK_BOUNDARY. + (STACK_BYTES): Use PREFERRED_STACK_BOUNDARY, not STACK_BOUNDARY. + (expand_call): Likewise. + (emit_library_call): Likewise. + (emit_library_call_value): Likewise. + * function.c: Provide default for PREFERRED_STACK_BOUNDARY. + (STACK_BYTES): Use PREFERRED_STACK_BOUNDARY, not STACK_BOUNDARY. + * explow.c: Provide default for PREFERRED_STACK_BOUNDARY. + (round_push): Use PREFERRED_STACK_BOUNDARY, not STACK_BOUNDARY. + (allocate_dynamic_stack_space): Likewise. + * tm.texi (PREFERRED_STACK_BOUNDARY): Document new macro. + (STACK_BOUNDARY): Update description to reflect the new situation. + Thu Nov 19 22:20:51 1998 Jeffrey A Law (law@cygnus.com) * reorg.c (relax_delay_slots): When optimizing for code size, if a diff --git a/gcc/calls.c b/gcc/calls.c index fb64c75..6f67b7c 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -29,6 +29,10 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "output.h" +#if !defined PREFERRED_STACK_BOUNDARY && defined STACK_BOUNDARY +#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY +#endif + /* Decide whether a function's arguments should be processed from first to last or from last to first. @@ -43,8 +47,8 @@ Boston, MA 02111-1307, USA. */ #endif -/* Like STACK_BOUNDARY but in units of bytes, not bits. */ -#define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT) +/* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits. */ +#define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT) /* Data structure and subroutines used within expand_call. */ @@ -311,7 +315,7 @@ prepare_call_address (funexp, fndecl, call_fusage, reg_parm_seen) says that the pointer to this aggregate is to be popped by the callee. STACK_SIZE is the number of bytes of arguments on the stack, - rounded up to STACK_BOUNDARY; zero if the size is variable. + rounded up to PREFERRED_STACK_BOUNDARY; zero if the size is variable. This is both to put into the call insn and to generate explicit popping code if necessary. @@ -1240,8 +1244,8 @@ expand_call (exp, target, ignore) args_size.var = ARGS_SIZE_TREE (args_size); args_size.constant = 0; -#ifdef STACK_BOUNDARY - if (STACK_BOUNDARY != BITS_PER_UNIT) +#ifdef PREFERRED_STACK_BOUNDARY + if (PREFERRED_STACK_BOUNDARY != BITS_PER_UNIT) args_size.var = round_up (args_size.var, STACK_BYTES); #endif @@ -1262,7 +1266,7 @@ expand_call (exp, target, ignore) } else { -#ifdef STACK_BOUNDARY +#ifdef PREFERRED_STACK_BOUNDARY args_size.constant = (((args_size.constant + (STACK_BYTES - 1)) / STACK_BYTES) * STACK_BYTES); #endif @@ -1589,7 +1593,7 @@ expand_call (exp, target, ignore) } #ifdef PUSH_ARGS_REVERSED -#ifdef STACK_BOUNDARY +#ifdef PREFERRED_STACK_BOUNDARY /* If we push args individually in reverse order, perform stack alignment before the first push (the last arg). */ if (argblock == 0) @@ -1838,7 +1842,7 @@ expand_call (exp, target, ignore) args_size.var != 0, reg_parm_stack_space); #ifndef PUSH_ARGS_REVERSED -#ifdef STACK_BOUNDARY +#ifdef PREFERRED_STACK_BOUNDARY /* If we pushed args in forward order, perform stack alignment after pushing the last arg. */ if (argblock == 0) @@ -2386,7 +2390,7 @@ emit_library_call VPROTO((rtx orgfun, int no_queue, enum machine_mode outmode, assemble_external_libcall (fun); original_args_size = args_size; -#ifdef STACK_BOUNDARY +#ifdef PREFERRED_STACK_BOUNDARY args_size.constant = (((args_size.constant + (STACK_BYTES - 1)) / STACK_BYTES) * STACK_BYTES); #endif @@ -2454,7 +2458,7 @@ emit_library_call VPROTO((rtx orgfun, int no_queue, enum machine_mode outmode, #endif #ifdef PUSH_ARGS_REVERSED -#ifdef STACK_BOUNDARY +#ifdef PREFERRED_STACK_BOUNDARY /* If we push args individually in reverse order, perform stack alignment before the first push (the last arg). */ if (argblock == 0) @@ -2599,7 +2603,7 @@ emit_library_call VPROTO((rtx orgfun, int no_queue, enum machine_mode outmode, } #ifndef PUSH_ARGS_REVERSED -#ifdef STACK_BOUNDARY +#ifdef PREFERRED_STACK_BOUNDARY /* If we pushed args in forward order, perform stack alignment after pushing the last arg. */ if (argblock == 0) @@ -2950,7 +2954,7 @@ emit_library_call_value VPROTO((rtx orgfun, rtx value, int no_queue, assemble_external_libcall (fun); original_args_size = args_size; -#ifdef STACK_BOUNDARY +#ifdef PREFERRED_STACK_BOUNDARY args_size.constant = (((args_size.constant + (STACK_BYTES - 1)) / STACK_BYTES) * STACK_BYTES); #endif @@ -3018,7 +3022,7 @@ emit_library_call_value VPROTO((rtx orgfun, rtx value, int no_queue, #endif #ifdef PUSH_ARGS_REVERSED -#ifdef STACK_BOUNDARY +#ifdef PREFERRED_STACK_BOUNDARY /* If we push args individually in reverse order, perform stack alignment before the first push (the last arg). */ if (argblock == 0) @@ -3164,7 +3168,7 @@ emit_library_call_value VPROTO((rtx orgfun, rtx value, int no_queue, } #ifndef PUSH_ARGS_REVERSED -#ifdef STACK_BOUNDARY +#ifdef PREFERRED_STACK_BOUNDARY /* If we pushed args in forward order, perform stack alignment after pushing the last arg. */ if (argblock == 0) diff --git a/gcc/explow.c b/gcc/explow.c index 95fb561..0dbf002 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -31,6 +31,10 @@ Boston, MA 02111-1307, USA. */ #include "insn-flags.h" #include "insn-codes.h" +#if !defined PREFERRED_STACK_BOUNDARY && defined STACK_BOUNDARY +#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY +#endif + static rtx break_out_memory_refs PROTO((rtx)); static void emit_stack_probe PROTO((rtx)); /* Return an rtx for the sum of X and the integer C. @@ -830,8 +834,8 @@ rtx round_push (size) rtx size; { -#ifdef STACK_BOUNDARY - int align = STACK_BOUNDARY / BITS_PER_UNIT; +#ifdef PREFERRED_STACK_BOUNDARY + int align = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT; if (align == 1) return size; if (GET_CODE (size) == CONST_INT) @@ -851,7 +855,7 @@ round_push (size) NULL_RTX, 1); size = expand_mult (Pmode, size, GEN_INT (align), NULL_RTX, 1); } -#endif /* STACK_BOUNDARY */ +#endif /* PREFERRED_STACK_BOUNDARY */ return size; } @@ -1124,10 +1128,10 @@ allocate_dynamic_stack_space (size, target, known_align) If we have to align, we must leave space in SIZE for the hole that might result from the alignment operation. */ -#if defined (STACK_DYNAMIC_OFFSET) || defined (STACK_POINTER_OFFSET) || ! defined (STACK_BOUNDARY) +#if defined (STACK_DYNAMIC_OFFSET) || defined (STACK_POINTER_OFFSET) || ! defined (PREFERRED_STACK_BOUNDARY) #define MUST_ALIGN 1 #else -#define MUST_ALIGN (STACK_BOUNDARY < BIGGEST_ALIGNMENT) +#define MUST_ALIGN (PREFERRED_STACK_BOUNDARY < BIGGEST_ALIGNMENT) #endif if (MUST_ALIGN) @@ -1154,12 +1158,12 @@ allocate_dynamic_stack_space (size, target, known_align) if (!current_function_calls_setjmp) { - int align = STACK_BOUNDARY / BITS_PER_UNIT; + int align = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT; /* See optimize_save_area_alloca to understand what is being set up here. */ -#if !defined(STACK_BOUNDARY) || !defined(MUST_ALIGN) || (STACK_BOUNDARY != BIGGEST_ALIGNMENT) +#if !defined(PREFERRED_STACK_BOUNDARY) || !defined(MUST_ALIGN) || (PREFERRED_STACK_BOUNDARY != BIGGEST_ALIGNMENT) /* If anyone creates a target with these characteristics, let them know that our optimization cannot work correctly in such a case. */ abort(); @@ -1209,11 +1213,11 @@ allocate_dynamic_stack_space (size, target, known_align) way of knowing which systems have this problem. So we avoid even momentarily mis-aligning the stack. */ -#ifdef STACK_BOUNDARY +#ifdef PREFERRED_STACK_BOUNDARY /* If we added a variable amount to SIZE, we can no longer assume it is aligned. */ #if !defined (SETJMP_VIA_SAVE_AREA) - if (MUST_ALIGN || known_align % STACK_BOUNDARY != 0) + if (MUST_ALIGN || known_align % PREFERRED_STACK_BOUNDARY != 0) #endif size = round_push (size); #endif diff --git a/gcc/expr.c b/gcc/expr.c index 3d46dea..ca0aba1 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -65,9 +65,6 @@ Boston, MA 02111-1307, USA. */ #endif #endif -/* Like STACK_BOUNDARY but in units of bytes, not bits. */ -#define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT) - /* Assume that case vectors are not pc-relative. */ #ifndef CASE_VECTOR_PC_RELATIVE #define CASE_VECTOR_PC_RELATIVE 0 diff --git a/gcc/function.c b/gcc/function.c index 3f47848..fa8b14a 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -57,6 +57,10 @@ Boston, MA 02111-1307, USA. */ #include "obstack.h" #include "toplev.h" +#if !defined PREFERRED_STACK_BOUNDARY && defined STACK_BOUNDARY +#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY +#endif + #ifndef TRAMPOLINE_ALIGNMENT #define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY #endif @@ -669,7 +673,7 @@ void pop_function_context () /* Allocate fixed slots in the stack frame of the current function. */ /* Return size needed for stack frame based on slots so far allocated. - This size counts from zero. It is not rounded to STACK_BOUNDARY; + This size counts from zero. It is not rounded to PREFERRED_STACK_BOUNDARY; the caller may have to do that. */ HOST_WIDE_INT @@ -4645,8 +4649,8 @@ assign_parms (fndecl, second_time) #endif #endif -#ifdef STACK_BOUNDARY -#define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT) +#ifdef PREFERRED_STACK_BOUNDARY +#define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT) current_function_args_size = ((current_function_args_size + STACK_BYTES - 1) diff --git a/gcc/tm.texi b/gcc/tm.texi index ab35f1f..7a0dd0e 100644 --- a/gcc/tm.texi +++ b/gcc/tm.texi @@ -790,15 +790,24 @@ size of an integer. @findex STACK_BOUNDARY @item STACK_BOUNDARY +Define this macro if there is a guaranteed alignment for the stack +pointer on this machine. The definition is a C expression +for the desired alignment (measured in bits). This value is used as a +default if PREFERRED_STACK_BOUNDARY is not defined. + +@findex PREFERRED_STACK_BOUNDARY +@item PREFERRED_STACK_BOUNDARY Define this macro if you wish to preserve a certain alignment for the stack pointer. The definition is a C expression -for the desired alignment (measured in bits). +for the desired alignment (measured in bits). If STACK_BOUNDARY is +also defined, this macro must evaluate to a value equal to or larger +than STACK_BOUNDARY. -@cindex @code{PUSH_ROUNDING}, interaction with @code{STACK_BOUNDARY} +@cindex @code{PUSH_ROUNDING}, interaction with @code{PREFERRED_STACK_BOUNDARY} If @code{PUSH_ROUNDING} is not defined, the stack will always be aligned -to the specified boundary. If @code{PUSH_ROUNDING} is defined and specifies a -less strict alignment than @code{STACK_BOUNDARY}, the stack may be -momentarily unaligned while pushing arguments. +to the specified boundary. If @code{PUSH_ROUNDING} is defined and specifies +a less strict alignment than @code{PREFERRED_STACK_BOUNDARY}, the stack may +be momentarily unaligned while pushing arguments. @findex FUNCTION_BOUNDARY @item FUNCTION_BOUNDARY -- 2.7.4