diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e46af0e68de..04cc0916e56 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2001-08-11 Zack Weinberg + + * defaults.h: Define PREFERRED_STACK_BOUNDARY to + STACK_BOUNDARY if not already defined. + + * calls.c, function.c, reload1.c, explow.c: Don't default + PREFERRED_STACK_BOUNDARY. Remove all #if/#ifdef on + PREFERRRED_STACK_BOUNDARY and/or STACK_BOUNDARY. + + * explow.c (allocate_dynamic_stack_space): Change unsafe #if + to run-time test. + + * doc/tm.texi: Document that STACK_BOUNDARY is required; + clarify difference between it and PREFERRED_STACK_BOUNDARY. + 2001-08-11 Neil Booth * cppmacro.c (enter_macro_context): Push macro expansions even diff --git a/gcc/calls.c b/gcc/calls.c index 1f40d53e520..60178d72506 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -37,10 +37,6 @@ Boston, MA 02111-1307, USA. */ #define FUNCTION_OK_FOR_SIBCALL(DECL) 1 #endif -#if !defined PREFERRED_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. diff --git a/gcc/defaults.h b/gcc/defaults.h index b069c5713d3..d20bc28f6ff 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -352,6 +352,12 @@ do { \ #endif #endif +/* If PREFERRED_STACK_BOUNDARY is not defined, set it to STACK_BOUNDARY. + STACK_BOUNDARY is required. */ +#ifndef PREFERRED_STACK_BOUNDARY +#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY +#endif + /* Select a format to encode pointers in exception handling data. We prefer those that result in fewer dynamic relocations. Assume no special support here and encode direct references. */ diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 0de3768b273..60fc2d3acb3 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -1015,18 +1015,19 @@ 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 @code{PREFERRED_STACK_BOUNDARY} is not defined. +Define this macro to the minimum alignment enforced by hardware 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 @code{PREFERRED_STACK_BOUNDARY} is not defined. On most machines, +this should be the same as @code{PARM_BOUNDARY}. @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). If @code{STACK_BOUNDARY} is -also defined, this macro must evaluate to a value equal to or larger -than @code{STACK_BOUNDARY}. +Define this macro if you wish to preserve a certain alignment for the +stack pointer, greater than what the hardware enforces. The definition +is a C expression for the desired alignment (measured in bits). This +macro must evaluate to a value equal to or larger than +@code{STACK_BOUNDARY}. @findex FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN @item FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN diff --git a/gcc/explow.c b/gcc/explow.c index 9f2357aff44..cf1faf86fa6 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -33,10 +33,6 @@ Boston, MA 02111-1307, USA. */ #include "insn-config.h" #include "recog.h" -#if !defined PREFERRED_STACK_BOUNDARY && defined STACK_BOUNDARY -#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY -#endif - static rtx break_out_memory_refs PARAMS ((rtx)); static void emit_stack_probe PARAMS ((rtx)); @@ -976,7 +972,6 @@ rtx round_push (size) rtx size; { -#ifdef PREFERRED_STACK_BOUNDARY int align = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT; if (align == 1) return size; @@ -997,7 +992,6 @@ round_push (size) NULL_RTX, 1); size = expand_mult (Pmode, size, GEN_INT (align), NULL_RTX, 1); } -#endif /* PREFERRED_STACK_BOUNDARY */ return size; } @@ -1260,9 +1254,7 @@ allocate_dynamic_stack_space (size, target, known_align) /* We can't attempt to minimize alignment necessary, because we don't know the final value of preferred_stack_boundary yet while executing this code. */ -#ifdef PREFERRED_STACK_BOUNDARY cfun->preferred_stack_boundary = PREFERRED_STACK_BOUNDARY; -#endif /* We will need to ensure that the address we return is aligned to BIGGEST_ALIGNMENT. If STACK_DYNAMIC_OFFSET is defined, we don't @@ -1277,7 +1269,7 @@ 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 (PREFERRED_STACK_BOUNDARY) +#if defined (STACK_DYNAMIC_OFFSET) || defined (STACK_POINTER_OFFSET) #define MUST_ALIGN 1 #else #define MUST_ALIGN (PREFERRED_STACK_BOUNDARY < BIGGEST_ALIGNMENT) @@ -1307,11 +1299,10 @@ allocate_dynamic_stack_space (size, target, known_align) /* See optimize_save_area_alloca to understand what is being set up here. */ -#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 (); -#endif + /* ??? Code below assumes that the save area needs maximal + alignment. This constraint may be too strong. */ + if (PREFERRED_STACK_BOUNDARY != BIGGEST_ALIGNMENT) + abort (); if (GET_CODE (size) == CONST_INT) { @@ -1357,23 +1348,19 @@ 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 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 % PREFERRED_STACK_BOUNDARY != 0) #endif size = round_push (size); -#endif do_pending_stack_adjust (); /* We ought to be called always on the toplevel and stack ought to be aligned propertly. */ -#ifdef PREFERRED_STACK_BOUNDARY if (stack_pointer_delta % (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)) abort (); -#endif /* If needed, check that we have the required amount of stack. Take into account what has already been checked. */ diff --git a/gcc/function.c b/gcc/function.c index a0cfa00ba51..7a03d9cd73e 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -67,10 +67,6 @@ Boston, MA 02111-1307, USA. */ #define LOCAL_ALIGNMENT(TYPE, ALIGNMENT) ALIGNMENT #endif -#ifndef PREFERRED_STACK_BOUNDARY -#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY -#endif - /* Some systems use __main in a way incompatible with its use in gcc, in these cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to give the same symbol without quotes for an alternative entry point. You diff --git a/gcc/reload1.c b/gcc/reload1.c index 61100c990fa..e2f895af474 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -41,10 +41,6 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "except.h" -#if !defined PREFERRED_STACK_BOUNDARY && defined STACK_BOUNDARY -#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY -#endif - /* This file contains the reload pass of the compiler, which is run after register allocation has been done. It checks that each insn is valid (operands required to be in registers really