This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/7] always define STACK_GROWS_DOWNWARD


From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/c-family/ChangeLog:

2015-05-20  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* c-cppbuiltin.c (c_cpp_builtins): Check the value of
	STACK_GROWS_DOWNWARD rather than if it is defined.

gcc/ChangeLog:

2015-05-20  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* *.c: Check the value of STACK_GROWS_DOWNWARD rather than if it
	is defined.
	* config/**/*.h: Define STACK_GROWS_DOWNWARD to an integer.
	* defaults.h: Provide default for STACK_GROWS_DOWNWARD.
---
 gcc/ChangeLog                      |  7 +++++++
 gcc/builtins.c                     |  6 +++---
 gcc/c-family/ChangeLog             |  5 +++++
 gcc/c-family/c-cppbuiltin.c        |  2 +-
 gcc/calls.c                        |  8 --------
 gcc/combine-stack-adj.c            |  8 --------
 gcc/config/alpha/alpha.h           |  2 +-
 gcc/config/arc/arc.h               |  2 +-
 gcc/config/avr/avr.h               |  2 +-
 gcc/config/bfin/bfin.h             |  2 +-
 gcc/config/c6x/c6x.h               |  2 +-
 gcc/config/cr16/cr16.h             |  2 +-
 gcc/config/cris/cris.h             |  2 +-
 gcc/config/epiphany/epiphany.h     |  2 +-
 gcc/config/h8300/h8300.h           |  2 +-
 gcc/config/i386/i386.h             |  2 +-
 gcc/config/iq2000/iq2000.h         |  2 +-
 gcc/config/m32r/m32r.h             |  2 +-
 gcc/config/mcore/mcore.h           |  2 +-
 gcc/config/microblaze/microblaze.h |  2 +-
 gcc/config/mips/mips.h             |  2 +-
 gcc/config/mmix/mmix.h             |  2 +-
 gcc/config/mn10300/mn10300.h       |  2 +-
 gcc/config/moxie/moxie.h           |  2 +-
 gcc/config/nds32/nds32.h           |  2 +-
 gcc/config/nios2/nios2.h           |  2 +-
 gcc/config/nvptx/nvptx.h           |  2 +-
 gcc/config/pdp11/pdp11.h           |  2 +-
 gcc/config/rs6000/rs6000.h         |  2 +-
 gcc/config/s390/s390.h             |  2 +-
 gcc/config/sh/sh.h                 |  2 +-
 gcc/config/sparc/sparc.h           |  2 +-
 gcc/config/spu/spu.h               |  2 +-
 gcc/config/tilegx/tilegx.h         |  2 +-
 gcc/config/tilepro/tilepro.h       |  2 +-
 gcc/config/v850/v850.h             |  2 +-
 gcc/config/vax/vax.h               |  2 +-
 gcc/config/xtensa/xtensa.h         |  2 +-
 gcc/defaults.h                     |  4 ++++
 gcc/dwarf2cfi.c                    |  4 ++--
 gcc/explow.c                       | 10 +++++-----
 gcc/expr.c                         | 20 ++++++++------------
 gcc/ira-color.c                    |  8 --------
 gcc/lower-subreg.c                 |  7 -------
 gcc/lra-spills.c                   |  8 --------
 gcc/recog.c                        |  6 +++---
 gcc/sched-deps.c                   |  2 +-
 47 files changed, 71 insertions(+), 98 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5bcbcb4..2dec0c3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-05-20  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
+
+	* *.c: Check the value of STACK_GROWS_DOWNWARD rather than if it
+	is defined.
+	* config/**/*.h: Define STACK_GROWS_DOWNWARD to an integer.
+	* defaults.h: Provide default for STACK_GROWS_DOWNWARD.
+
 2015-05-20  Mikhail Maltsev  <maltsevm@gmail.com>
 
 	* bb-reorder.c (set_edge_can_fallthru_flag): Use rtx_jump_insn where
diff --git a/gcc/builtins.c b/gcc/builtins.c
index f6012af..e81ab04 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1521,7 +1521,7 @@ expand_builtin_apply_args_1 (void)
 
   /* Save the arg pointer to the block.  */
   tem = copy_to_reg (crtl->args.internal_arg_pointer);
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
   /* We need the pointer as the caller actually passed them to us, not
      as we might have pretended they were passed.  Make sure it's a valid
      operand, as emit_move_insn isn't expected to handle a PLUS.  */
@@ -1613,7 +1613,7 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
   /* Fetch the arg pointer from the ARGUMENTS block.  */
   incoming_args = gen_reg_rtx (Pmode);
   emit_move_insn (incoming_args, gen_rtx_MEM (Pmode, arguments));
-#ifndef STACK_GROWS_DOWNWARD
+#if !STACK_GROWS_DOWNWARD
   incoming_args = expand_simple_binop (Pmode, MINUS, incoming_args, argsize,
 				       incoming_args, 0, OPTAB_LIB_WIDEN);
 #endif
@@ -1646,7 +1646,7 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
     crtl->need_drap = true;
 
   dest = virtual_outgoing_args_rtx;
-#ifndef STACK_GROWS_DOWNWARD
+#if !STACK_GROWS_DOWNWARD
   if (CONST_INT_P (argsize))
     dest = plus_constant (Pmode, dest, -INTVAL (argsize));
   else
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 9d7736e..7b526a6 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-20  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
+
+	* c-cppbuiltin.c (c_cpp_builtins): Check the value of
+	STACK_GROWS_DOWNWARD rather than if it is defined.
+
 2015-05-20  Marek Polacek  <polacek@redhat.com>
 
 	* c-omp.c (check_omp_for_incr_expr): Use BINARY_CLASS_P.
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 60c2d7f..da9cb2f 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1138,7 +1138,7 @@ c_cpp_builtins (cpp_reader *pfile)
 				     TRAMPOLINE_SIZE);
 
       /* For libgcc generic-morestack.c and unwinder code.  */
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
       cpp_define (pfile, "__LIBGCC_STACK_GROWS_DOWNWARD__");
 #endif
 
diff --git a/gcc/calls.c b/gcc/calls.c
index 9cd488d..afe61f4 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -82,14 +82,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "rtl-chkp.h"
 
 
-/* Redefine STACK_GROWS_DOWNWARD in terms of 0 or 1.  */
-#ifdef STACK_GROWS_DOWNWARD
-# undef STACK_GROWS_DOWNWARD
-# define STACK_GROWS_DOWNWARD 1
-#else
-# define STACK_GROWS_DOWNWARD 0
-#endif
-
 /* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits.  */
 #define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)
 
diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index 83cdfae..4d40e4e 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -84,14 +84,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "rtl-iter.h"
 
 
-/* Turn STACK_GROWS_DOWNWARD into a boolean.  */
-#ifdef STACK_GROWS_DOWNWARD
-#undef STACK_GROWS_DOWNWARD
-#define STACK_GROWS_DOWNWARD 1
-#else
-#define STACK_GROWS_DOWNWARD 0
-#endif
-
 /* This structure records two kinds of stack references between stack
    adjusting instructions: stack references in memory addresses for
    regular insns and all stack references for debug insns.  */
diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h
index 196349d..8d2ab23 100644
--- a/gcc/config/alpha/alpha.h
+++ b/gcc/config/alpha/alpha.h
@@ -564,7 +564,7 @@ extern int alpha_memory_latency;
 
 /* Define this if pushing a word on the stack
    makes the stack pointer a smaller address.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Define this to nonzero if the nominal address of the stack frame
    is at the high-address end of the local variables;
diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index 66965b0..4fdd654 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -765,7 +765,7 @@ extern enum reg_class arc_regno_reg_class[];
 
 /* Define this macro if pushing a word onto the stack moves the stack
    pointer to a smaller address.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Define this if the nominal address of the stack frame
    is at the high-address end of the local variables;
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index d8bee77..7439964 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -290,7 +290,7 @@ enum reg_class {
 
 #define STACK_PUSH_CODE POST_DEC
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 #define STARTING_FRAME_OFFSET avr_starting_frame_offset()
 
diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h
index 49cc741..b0d017e 100644
--- a/gcc/config/bfin/bfin.h
+++ b/gcc/config/bfin/bfin.h
@@ -233,7 +233,7 @@ extern const char *bfin_library_id_string;
 
 /* Define this if pushing a word on the stack
    makes the stack pointer a smaller address.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 #define STACK_PUSH_CODE PRE_DEC
 
diff --git a/gcc/config/c6x/c6x.h b/gcc/config/c6x/c6x.h
index 9b3fcfb..1c30469 100644
--- a/gcc/config/c6x/c6x.h
+++ b/gcc/config/c6x/c6x.h
@@ -313,7 +313,7 @@ enum reg_class
 #define FIRST_PARM_OFFSET(fundecl) 4
 #define STARTING_FRAME_OFFSET 0
 #define FRAME_GROWS_DOWNWARD 1
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 #define STACK_POINTER_REGNUM REG_B15
 #define HARD_FRAME_POINTER_REGNUM REG_A15
diff --git a/gcc/config/cr16/cr16.h b/gcc/config/cr16/cr16.h
index e5df6f9..5767be9 100644
--- a/gcc/config/cr16/cr16.h
+++ b/gcc/config/cr16/cr16.h
@@ -368,7 +368,7 @@ enum reg_class
        && GET_CODE (XEXP ((XEXP (OP, 0)), 1)) == CONST_INT))
 
 /* Stack layout and calling conventions.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 #define STARTING_FRAME_OFFSET   0
 
diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h
index cb7baf7..aa7dc17 100644
--- a/gcc/config/cris/cris.h
+++ b/gcc/config/cris/cris.h
@@ -620,7 +620,7 @@ enum reg_class
 
 /* Node: Frame Layout */
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 #define FRAME_GROWS_DOWNWARD 1
 
 /* It seems to be indicated in the code (at least 2.1) that this is
diff --git a/gcc/config/epiphany/epiphany.h b/gcc/config/epiphany/epiphany.h
index dab368c..5515edb 100644
--- a/gcc/config/epiphany/epiphany.h
+++ b/gcc/config/epiphany/epiphany.h
@@ -467,7 +467,7 @@ typedef struct GTY (()) machine_function
 
 /* Define this macro if pushing a word onto the stack moves the stack
    pointer to a smaller address.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Define this to nonzero if the nominal address of the stack frame
    is at the high-address end of the local variables;
diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h
index a17d7d5..a829cfa 100644
--- a/gcc/config/h8300/h8300.h
+++ b/gcc/config/h8300/h8300.h
@@ -360,7 +360,7 @@ enum reg_class {
 /* Define this if pushing a word on the stack
    makes the stack pointer a smaller address.  */
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Define this to nonzero if the nominal address of the stack frame
    is at the high-address end of the local variables;
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 5279b2d..40e8f83 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1564,7 +1564,7 @@ enum reg_class
 
 /* Define this if pushing a word on the stack
    makes the stack pointer a smaller address.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Define this to nonzero if the nominal address of the stack frame
    is at the high-address end of the local variables;
diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h
index a10eda3..14a68ce 100644
--- a/gcc/config/iq2000/iq2000.h
+++ b/gcc/config/iq2000/iq2000.h
@@ -230,7 +230,7 @@ enum reg_class
 
 /* Basic Stack Layout.  */
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 #define FRAME_GROWS_DOWNWARD 0
 
diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h
index ee0c447..66ceae0 100644
--- a/gcc/config/m32r/m32r.h
+++ b/gcc/config/m32r/m32r.h
@@ -524,7 +524,7 @@ extern enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
 
 /* Define this macro if pushing a word onto the stack moves the stack
    pointer to a smaller address.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Offset from frame pointer to start allocating local variables at.
    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h
index 74860df..0aa9680 100644
--- a/gcc/config/mcore/mcore.h
+++ b/gcc/config/mcore/mcore.h
@@ -415,7 +415,7 @@ extern const enum reg_class regno_reg_class[FIRST_PSEUDO_REGISTER];
 
 /* Define this if pushing a word on the stack
    makes the stack pointer a smaller address.  */
-#define STACK_GROWS_DOWNWARD  
+#define STACK_GROWS_DOWNWARD 1
 
 /* Offset within stack frame to start allocating local variables at.
    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
index fa53848..c832fa0 100644
--- a/gcc/config/microblaze/microblaze.h
+++ b/gcc/config/microblaze/microblaze.h
@@ -413,7 +413,7 @@ extern enum reg_class microblaze_regno_to_class[];
 
 /* Stack layout; function entry, exit and calling.  */
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Changed the starting frame offset to including the new link stuff */
 #define STARTING_FRAME_OFFSET						\
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index b4c6e5f..bceef31 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -2234,7 +2234,7 @@ enum reg_class
 
 /* Stack layout; function entry, exit and calling.  */
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 #define FRAME_GROWS_DOWNWARD flag_stack_protect
 
diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h
index 1a17582..61ae4d6 100644
--- a/gcc/config/mmix/mmix.h
+++ b/gcc/config/mmix/mmix.h
@@ -451,7 +451,7 @@ enum reg_class
 
 /* Node: Frame Layout */
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 #define FRAME_GROWS_DOWNWARD 1
 
 #define STARTING_FRAME_OFFSET \
diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h
index d41dc4e..e5fa70b 100644
--- a/gcc/config/mn10300/mn10300.h
+++ b/gcc/config/mn10300/mn10300.h
@@ -404,7 +404,7 @@ enum reg_class
 /* Define this if pushing a word on the stack
    makes the stack pointer a smaller address.  */
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Define this to nonzero if the nominal address of the stack frame
    is at the high-address end of the local variables;
diff --git a/gcc/config/moxie/moxie.h b/gcc/config/moxie/moxie.h
index 89e6a38..d20d214 100644
--- a/gcc/config/moxie/moxie.h
+++ b/gcc/config/moxie/moxie.h
@@ -247,7 +247,7 @@ enum reg_class
 
 /* Define this macro if pushing a word onto the stack moves the stack
    pointer to a smaller address.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 #define INITIAL_FRAME_POINTER_OFFSET(DEPTH) (DEPTH) = 0
 
diff --git a/gcc/config/nds32/nds32.h b/gcc/config/nds32/nds32.h
index 963b3a2..dcecea7 100644
--- a/gcc/config/nds32/nds32.h
+++ b/gcc/config/nds32/nds32.h
@@ -696,7 +696,7 @@ enum reg_class
 
 /* Stack Layout and Calling Conventions.  */
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 #define FRAME_GROWS_DOWNWARD 1
 
diff --git a/gcc/config/nios2/nios2.h b/gcc/config/nios2/nios2.h
index ac33978..45eb70b 100644
--- a/gcc/config/nios2/nios2.h
+++ b/gcc/config/nios2/nios2.h
@@ -230,7 +230,7 @@ enum reg_class
 #define TRAMPOLINE_SIZE 20
 
 /* Stack layout.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 #define STARTING_FRAME_OFFSET 0
 #define FIRST_PARM_OFFSET(FUNDECL) 0
 
diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h
index 8835906..502e43d 100644
--- a/gcc/config/nvptx/nvptx.h
+++ b/gcc/config/nvptx/nvptx.h
@@ -150,7 +150,7 @@ enum reg_class
 
 #define STARTING_FRAME_OFFSET 0
 #define FRAME_GROWS_DOWNWARD 0
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 #define STACK_POINTER_REGNUM 1
 #define HARD_FRAME_POINTER_REGNUM 2
diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h
index a827f3a..1d947f3 100644
--- a/gcc/config/pdp11/pdp11.h
+++ b/gcc/config/pdp11/pdp11.h
@@ -289,7 +289,7 @@ enum reg_class { NO_REGS, MUL_REGS, GENERAL_REGS, LOAD_FPU_REGS, NO_LOAD_FPU_REG
 
 /* Define this if pushing a word on the stack
    makes the stack pointer a smaller address.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Define this to nonzero if the nominal address of the stack frame
    is at the high-address end of the local variables;
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index c93c3ce..bbecf58 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -1563,7 +1563,7 @@ extern enum reg_class rs6000_constraints[RS6000_CONSTRAINT_MAX];
 
 /* Define this if pushing a word on the stack
    makes the stack pointer a smaller address.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Offsets recorded in opcodes are a multiple of this alignment factor.  */
 #define DWARF_CIE_DATA_ALIGNMENT (-((int) (TARGET_32BIT ? 4 : 8)))
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index 6ddd8aa..a9bf9b5 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -561,7 +561,7 @@ extern const enum reg_class regclass_map[FIRST_PSEUDO_REGISTER];
 /* Our stack grows from higher to lower addresses.  However, local variables
    are accessed by positive offsets, and function arguments are stored at
    increasing addresses.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 #define FRAME_GROWS_DOWNWARD 1
 /* #undef ARGS_GROW_DOWNWARD */
 
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index a9b7fa0..3078880 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -1223,7 +1223,7 @@ extern enum reg_class regno_reg_class[FIRST_PSEUDO_REGISTER];
 
 /* Define this if pushing a word on the stack
    makes the stack pointer a smaller address.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /*  Define this macro to nonzero if the addresses of local variable slots
     are at negative offsets from the frame pointer.  */
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index 2fae9e8..ce1b68b 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -1074,7 +1074,7 @@ extern char leaf_reg_remap[];
 
 /* Define this if pushing a word on the stack
    makes the stack pointer a smaller address.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Define this to nonzero if the nominal address of the stack frame
    is at the high-address end of the local variables;
diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h
index 24d8047..25fa435 100644
--- a/gcc/config/spu/spu.h
+++ b/gcc/config/spu/spu.h
@@ -237,7 +237,7 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin;	\
 
 /* Frame Layout */
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 #define FRAME_GROWS_DOWNWARD 1
 
diff --git a/gcc/config/tilegx/tilegx.h b/gcc/config/tilegx/tilegx.h
index 72a0324..5fa10b3 100644
--- a/gcc/config/tilegx/tilegx.h
+++ b/gcc/config/tilegx/tilegx.h
@@ -257,7 +257,7 @@ enum reg_class
 
 /* Stack layout; function entry, exit and calling.  */
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 #define FRAME_GROWS_DOWNWARD 1
 #define STARTING_FRAME_OFFSET 0
 
diff --git a/gcc/config/tilepro/tilepro.h b/gcc/config/tilepro/tilepro.h
index e1c790d..f2b7b16 100644
--- a/gcc/config/tilepro/tilepro.h
+++ b/gcc/config/tilepro/tilepro.h
@@ -221,7 +221,7 @@ enum reg_class
 
 /* Stack layout; function entry, exit and calling.  */
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 #define FRAME_GROWS_DOWNWARD 1
 #define STARTING_FRAME_OFFSET 0
 
diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h
index 2f0118c..e40fd87 100644
--- a/gcc/config/v850/v850.h
+++ b/gcc/config/v850/v850.h
@@ -411,7 +411,7 @@ enum reg_class
 /* Define this if pushing a word on the stack
    makes the stack pointer a smaller address.  */
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Define this to nonzero if the nominal address of the stack frame
    is at the high-address end of the local variables;
diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h
index 7c2d8c6..0b19014 100644
--- a/gcc/config/vax/vax.h
+++ b/gcc/config/vax/vax.h
@@ -238,7 +238,7 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
 
 /* Define this if pushing a word on the stack
    makes the stack pointer a smaller address.  */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Define this to nonzero if the nominal address of the stack frame
    is at the high-address end of the local variables;
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index 011411c..615f741 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -459,7 +459,7 @@ enum reg_class
 
 /* Stack layout; function entry, exit and calling.  */
 
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
 
 /* Offset within stack frame to start allocating local variables at.  */
 #define STARTING_FRAME_OFFSET						\
diff --git a/gcc/defaults.h b/gcc/defaults.h
index b3edcc9..a01969a 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1229,6 +1229,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define ARGS_GROW_DOWNWARD 0
 #endif
 
+#ifndef STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 0
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 7b5cecd..8b8931f 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -944,7 +944,7 @@ notice_args_size (rtx_insn *insn)
 
       /* Convert a change in args_size (always a positive in the
 	 direction of stack growth) to a change in stack pointer.  */
-#ifndef STACK_GROWS_DOWNWARD
+#if !STACK_GROWS_DOWNWARD
       delta = -delta;
 #endif
       cur_cfa->offset += delta;
@@ -2347,7 +2347,7 @@ maybe_record_trace_start_abnormal (rtx_insn *start, rtx_insn *origin)
     {
       /* Convert a change in args_size (always a positive in the
 	 direction of stack growth) to a change in stack pointer.  */
-#ifndef STACK_GROWS_DOWNWARD
+#if !STACK_GROWS_DOWNWARD
       delta = -delta;
 #endif
       cur_row->cfa.offset += delta;
diff --git a/gcc/explow.c b/gcc/explow.c
index b41feb6..39b63ed 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -866,7 +866,7 @@ adjust_stack_1 (rtx adjust, bool anti_p)
   rtx temp;
   rtx_insn *insn;
 
-#ifndef STACK_GROWS_DOWNWARD
+#if !STACK_GROWS_DOWNWARD
   /* Hereafter anti_p means subtract_p.  */
   anti_p = !anti_p;
 #endif
@@ -1414,7 +1414,7 @@ allocate_dynamic_stack_space (rtx size, unsigned size_align,
     {
       int saved_stack_pointer_delta;
 
-#ifndef STACK_GROWS_DOWNWARD
+#if !STACK_GROWS_DOWNWARD
       emit_move_insn (target, virtual_stack_dynamic_rtx);
 #endif
 
@@ -1423,7 +1423,7 @@ allocate_dynamic_stack_space (rtx size, unsigned size_align,
 	{
 	  rtx available;
 	  rtx_code_label *space_available = gen_label_rtx ();
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
 	  available = expand_binop (Pmode, sub_optab,
 				    stack_pointer_rtx, stack_limit_rtx,
 				    NULL_RTX, 1, OPTAB_WIDEN);
@@ -1456,7 +1456,7 @@ allocate_dynamic_stack_space (rtx size, unsigned size_align,
 	 crtl->preferred_stack_boundary alignment.  */
       stack_pointer_delta = saved_stack_pointer_delta;
 
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
       emit_move_insn (target, virtual_stack_dynamic_rtx);
 #endif
     }
@@ -1545,7 +1545,7 @@ emit_stack_probe (rtx address)
 
 #define PROBE_INTERVAL (1 << STACK_CHECK_PROBE_INTERVAL_EXP)
 
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
 #define STACK_GROW_OP MINUS
 #define STACK_GROW_OPTAB sub_optab
 #define STACK_GROW_OFF(off) -(off)
diff --git a/gcc/expr.c b/gcc/expr.c
index 8d75ef5..3d691de 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -99,7 +99,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ccmp.h"
 
 #ifndef STACK_PUSH_CODE
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
 #define STACK_PUSH_CODE PRE_DEC
 #else
 #define STACK_PUSH_CODE PRE_INC
@@ -869,7 +869,7 @@ move_by_pieces (rtx to, rtx from, unsigned HOST_WIDE_INT len,
       to_addr = NULL_RTX;
       data.to = NULL_RTX;
       data.autinc_to = 1;
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
       data.reverse = 1;
 #else
       data.reverse = 0;
@@ -3792,11 +3792,7 @@ push_block (rtx size, int extra, int below)
       anti_adjust_stack (temp);
     }
 
-#ifndef STACK_GROWS_DOWNWARD
-  if (0)
-#else
-  if (1)
-#endif
+  if (STACK_GROWS_DOWNWARD)
     {
       temp = virtual_outgoing_args_rtx;
       if (extra != 0 && below)
@@ -4004,7 +4000,7 @@ fixup_args_size_notes (rtx_insn *prev, rtx_insn *last, int end_args_size)
 	saw_unknown = true;
 
       add_reg_note (insn, REG_ARGS_SIZE, GEN_INT (args_size));
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
       this_delta = -(unsigned HOST_WIDE_INT) this_delta;
 #endif
       args_size -= this_delta;
@@ -4049,7 +4045,7 @@ emit_single_push_insn_1 (machine_mode mode, rtx x, tree type)
 
       emit_move_insn (stack_pointer_rtx,
 		      expand_binop (Pmode,
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
 				    sub_optab,
 #else
 				    add_optab,
@@ -4059,7 +4055,7 @@ emit_single_push_insn_1 (machine_mode mode, rtx x, tree type)
 				    NULL_RTX, 0, OPTAB_LIB_WIDEN));
 
       offset = (HOST_WIDE_INT) padding_size;
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
       if (STACK_PUSH_CODE == POST_DEC)
 	/* We have already decremented the stack pointer, so get the
 	   previous value.  */
@@ -4075,7 +4071,7 @@ emit_single_push_insn_1 (machine_mode mode, rtx x, tree type)
     }
   else
     {
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
       /* ??? This seems wrong if STACK_PUSH_CODE == POST_DEC.  */
       dest_addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
 				gen_int_mode (-(HOST_WIDE_INT) rounded_size,
@@ -4168,7 +4164,7 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
 {
   rtx xinner;
   enum direction stack_direction
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
     = downward;
 #else
     = upward;
diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index 47430b0..4750714 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -3854,14 +3854,6 @@ coalesced_pseudo_reg_freq_compare (const void *v1p, const void *v2p)
    It is used for sorting pseudo registers.  */
 static unsigned int *regno_max_ref_width;
 
-/* Redefine STACK_GROWS_DOWNWARD in terms of 0 or 1.  */
-#ifdef STACK_GROWS_DOWNWARD
-# undef STACK_GROWS_DOWNWARD
-# define STACK_GROWS_DOWNWARD 1
-#else
-# define STACK_GROWS_DOWNWARD 0
-#endif
-
 /* Sort pseudos according their slot numbers (putting ones with
   smaller numbers first, or last when the frame pointer is not
   needed).  */
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 3535a07..6d2ba29 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -68,13 +68,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "lower-subreg.h"
 #include "rtl-iter.h"
 
-#ifdef STACK_GROWS_DOWNWARD
-# undef STACK_GROWS_DOWNWARD
-# define STACK_GROWS_DOWNWARD 1
-#else
-# define STACK_GROWS_DOWNWARD 0
-#endif
-
 
 /* Decompose multi-word pseudo-registers into individual
    pseudo-registers when possible and profitable.  This is possible
diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c
index ed678d5..19ece20 100644
--- a/gcc/lra-spills.c
+++ b/gcc/lra-spills.c
@@ -230,14 +230,6 @@ regno_freq_compare (const void *v1p, const void *v2p)
   return regno1 - regno2;
 }
 
-/* Redefine STACK_GROWS_DOWNWARD in terms of 0 or 1.  */
-#ifdef STACK_GROWS_DOWNWARD
-# undef STACK_GROWS_DOWNWARD
-# define STACK_GROWS_DOWNWARD 1
-#else
-# define STACK_GROWS_DOWNWARD 0
-#endif
-
 /* Sort pseudos according to their slots, putting the slots in the order
    that they should be allocated.  Slots with lower numbers have the highest
    priority and should get the smallest displacement from the stack or
diff --git a/gcc/recog.c b/gcc/recog.c
index b251299..4a7aa67 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -69,7 +69,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "insn-codes.h"
 
 #ifndef STACK_PUSH_CODE
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
 #define STACK_PUSH_CODE PRE_DEC
 #else
 #define STACK_PUSH_CODE PRE_INC
@@ -77,7 +77,7 @@ along with GCC; see the file COPYING3.  If not see
 #endif
 
 #ifndef STACK_POP_CODE
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
 #define STACK_POP_CODE POST_INC
 #else
 #define STACK_POP_CODE POST_DEC
@@ -1332,7 +1332,7 @@ push_operand (rtx op, machine_mode mode)
 	  || GET_CODE (XEXP (op, 1)) != PLUS
 	  || XEXP (XEXP (op, 1), 0) != XEXP (op, 0)
 	  || !CONST_INT_P (XEXP (XEXP (op, 1), 1))
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
 	  || INTVAL (XEXP (XEXP (op, 1), 1)) != - (int) rounded_size
 #else
 	  || INTVAL (XEXP (XEXP (op, 1), 1)) != (int) rounded_size
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 3a10d26..206da5a 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -4734,7 +4734,7 @@ parse_add_or_inc (struct mem_inc_info *mii, rtx_insn *insn, bool before_mem)
   if (regs_equal && REGNO (SET_DEST (pat)) == STACK_POINTER_REGNUM)
     {
       /* Note that the sign has already been reversed for !before_mem.  */
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
       return mii->inc_constant > 0;
 #else
       return mii->inc_constant < 0;
-- 
2.4.0.78.g7c6ecbf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]