defaults.h: Define PREFERRED_STACK_BOUNDARY to STACK_BOUNDARY if not already defined.
authorZack Weinberg <zackw@panix.com>
Sun, 12 Aug 2001 01:46:15 +0000 (01:46 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Sun, 12 Aug 2001 01:46:15 +0000 (01:46 +0000)
* 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.

From-SVN: r44814

gcc/ChangeLog
gcc/calls.c
gcc/defaults.h
gcc/doc/tm.texi
gcc/explow.c
gcc/function.c
gcc/reload1.c

index e46af0e68de4da67ea694df405c597dddcc86165..04cc0916e56f8d1467dd7960107964793950bd6d 100644 (file)
@@ -1,3 +1,18 @@
+2001-08-11  Zack Weinberg  <zackw@panix.com>
+
+       * 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  <neil@daikokuya.demon.co.uk>
 
        * cppmacro.c (enter_macro_context): Push macro expansions even
index 1f40d53e5203078c0fdb9e4e0acbec78187c9c80..60178d7250658b8ef13e2eeb20456d0d8722346f 100644 (file)
@@ -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.
 
index b069c5713d374bfe73469caca21a3fc123b56f33..d20bc28f6ffadd86029f6fc0a4897a17b881d88a 100644 (file)
@@ -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.  */
index 0de3768b2739cb0281a6516258309095b0dd4dcd..60fc2d3acb327bb62d8c3a4d056e1ec80abd096b 100644 (file)
@@ -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
index 9f2357aff443aea244b99b0e5c5de1318fd664fc..cf1faf86fa6ee034be7a44011ab63a3cdbeda123 100644 (file)
@@ -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;
 }
 \f
@@ -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.  */
index a0cfa00ba51ac9ec76cd94459d96f006fb272d90..7a03d9cd73e52a60631a8e2a4f23db67cfa8570d 100644 (file)
@@ -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
index 61100c990fa22efa0c0e1ca4b3537b2b0253c243..e2f895af47406da56cadd8d28f6e16ae708d8062 100644 (file)
@@ -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