From 62f9f30bfbd23c0e7ca832e40cbad4092789e8dd Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Fri, 22 May 2015 01:03:11 +0000 Subject: [PATCH] always define STACK_GROWS_DOWNWARD gcc/c-family/ChangeLog: 2015-05-20 Trevor Saunders * 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 * *.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. * doc/tm.texi.in: Update references to STACK_GROWS_DOWNWARD. * doc/tm.texi: Regenerate. From-SVN: r223513 --- gcc/ChangeLog | 9 +++++++++ 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/doc/tm.texi | 12 ++++-------- gcc/doc/tm.texi.in | 12 ++++-------- 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 +- 49 files changed, 81 insertions(+), 114 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e5fa370ad4c..3fadbaf0e4c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-05-20 Trevor Saunders + + * *.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. + * doc/tm.texi.in: Update references to STACK_GROWS_DOWNWARD. + * doc/tm.texi: Regenerate. + 2015-05-21 H.J. Lu PR target/66232 diff --git a/gcc/builtins.c b/gcc/builtins.c index f6012afedaf..e81ab04ae7a 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 20a73e6d6ff..5408a12b24b 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2015-05-20 Trevor Saunders + + * c-cppbuiltin.c (c_cpp_builtins): Check the value of + STACK_GROWS_DOWNWARD rather than if it is defined. + 2015-05-21 Manuel López-Ibáñez PR c/52952 diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 60c2d7f3862..da9cb2f355c 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 9cd488d175d..afe61f47d87 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 83cdfaefe8d..4d40e4ea062 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 196349df911..8d2ab238157 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 66965b0f66c..4fdd6543415 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 d8bee773c63..74399647e0a 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 49cc741cbec..b0d017ebf5c 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 9b3fcfbd5e6..1c304697db2 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 e5df6f95330..5767be9f44f 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 cb7baf71476..aa7dc17f2d9 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 dab368c9cce..5515edbe9f0 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 a17d7d56621..a829cfa9100 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 5279b2d36c3..40e8f834e6f 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 a10eda3d5eb..14a68ce40a5 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 ee0c447187a..66ceae0c181 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 74860dfefa6..0aa96807b71 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 fa538485bcb..c832fa0fe93 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 b4c6e5f09de..bceef31b4a3 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 1a17582fb9f..61ae4d694eb 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 d41dc4e0aa5..e5fa70bd7a8 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 89e6a38ae1e..d20d2140778 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 963b3a252a5..dcecea72208 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 ac339781b6c..45eb70b7cec 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 88359062a33..502e43d6fd1 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 a827f3a6a6b..1d947f38a97 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 c93c3ce1884..bbecf58d9df 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 6ddd8aa2052..a9bf9b5b1cb 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 a9b7fa02ef3..3078880a69a 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 2fae9e88dbc..ce1b68b1b44 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 24d8047f0e6..25fa43563ee 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 72a0324fcc1..5fa10b39e39 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 e1c790d5c09..f2b7b163270 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 2f0118c4fcc..e40fd87789a 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 7c2d8c6b599..0b19014d57f 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 011411c09bf..615f7412fa7 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 b3edcc9eff6..a01969a4829 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/doc/tm.texi b/gcc/doc/tm.texi index 3a89eee7933..f2f34978db4 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -2921,12 +2921,8 @@ This describes the stack layout and calling conventions. Here is the basic stack layout. @defmac STACK_GROWS_DOWNWARD -Define this macro if pushing a word onto the stack moves the stack -pointer to a smaller address. - -When we say, ``define this macro if @dots{}'', it means that the -compiler checks this macro only with @code{#ifdef} so the precise -definition used does not matter. +Define this macro to be true if pushing a word onto the stack moves the stack +pointer to a smaller address, and false otherwise. @end defmac @defmac STACK_PUSH_CODE @@ -2941,7 +2937,7 @@ to the last item on the stack or whether it points to the space for the next item on the stack. The default is @code{PRE_DEC} when @code{STACK_GROWS_DOWNWARD} is -defined, which is almost always right, and @code{PRE_INC} otherwise, +true, which is almost always right, and @code{PRE_INC} otherwise, which is often wrong. @end defmac @@ -9038,7 +9034,7 @@ The default size is @code{FIRST_PSEUDO_REGISTER * sizeof(void *)}. This macro need only be defined if the target might save registers in the function prologue at an offset to the stack pointer that is not aligned to @code{UNITS_PER_WORD}. The definition should be the negative minimum -alignment if @code{STACK_GROWS_DOWNWARD} is defined, and the positive +alignment if @code{STACK_GROWS_DOWNWARD} is true, and the positive minimum alignment otherwise. @xref{SDB and DWARF}. Only applicable if the target supports DWARF 2 frame unwind information. @end defmac diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index e76b8a05e90..35b02b7632c 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -2527,12 +2527,8 @@ This describes the stack layout and calling conventions. Here is the basic stack layout. @defmac STACK_GROWS_DOWNWARD -Define this macro if pushing a word onto the stack moves the stack -pointer to a smaller address. - -When we say, ``define this macro if @dots{}'', it means that the -compiler checks this macro only with @code{#ifdef} so the precise -definition used does not matter. +Define this macro to be true if pushing a word onto the stack moves the stack +pointer to a smaller address, and false otherwise. @end defmac @defmac STACK_PUSH_CODE @@ -2547,7 +2543,7 @@ to the last item on the stack or whether it points to the space for the next item on the stack. The default is @code{PRE_DEC} when @code{STACK_GROWS_DOWNWARD} is -defined, which is almost always right, and @code{PRE_INC} otherwise, +true, which is almost always right, and @code{PRE_INC} otherwise, which is often wrong. @end defmac @@ -6559,7 +6555,7 @@ The default size is @code{FIRST_PSEUDO_REGISTER * sizeof(void *)}. This macro need only be defined if the target might save registers in the function prologue at an offset to the stack pointer that is not aligned to @code{UNITS_PER_WORD}. The definition should be the negative minimum -alignment if @code{STACK_GROWS_DOWNWARD} is defined, and the positive +alignment if @code{STACK_GROWS_DOWNWARD} is true, and the positive minimum alignment otherwise. @xref{SDB and DWARF}. Only applicable if the target supports DWARF 2 frame unwind information. @end defmac diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c index 7b5cecda1c2..8b8931f1d68 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 b41feb68266..39b63ed7e39 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 8d75ef55f23..3d691de6baa 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 47430b015a4..4750714d78d 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 3535a07a5af..6d2ba2902c6 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 ed678d5edb4..19ece20d4fa 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 b251299ac17..4a7aa67cf9a 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 3a10d26311e..206da5a55f2 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.30.2