+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.
+ * doc/tm.texi.in: Update references to STACK_GROWS_DOWNWARD.
+ * doc/tm.texi: Regenerate.
+
2015-05-21 H.J. Lu <hongjiu.lu@intel.com>
PR target/66232
/* 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. */
/* 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
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
+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-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/52952
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
#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)
#include "rtl-iter.h"
\f
-/* 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. */
/* 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;
/* 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;
#define STACK_PUSH_CODE POST_DEC
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
#define STARTING_FRAME_OFFSET avr_starting_frame_offset()
/* 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
#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
&& 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
/* 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
/* 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;
/* 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;
/* 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;
\f
/* Basic Stack Layout. */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
#define FRAME_GROWS_DOWNWARD 0
/* 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
/* 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
/* 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 \
\f
/* Stack layout; function entry, exit and calling. */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
#define FRAME_GROWS_DOWNWARD flag_stack_protect
/* Node: Frame Layout */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
#define FRAME_GROWS_DOWNWARD 1
#define STARTING_FRAME_OFFSET \
/* 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;
/* 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
\f
/* Stack Layout and Calling Conventions. */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
#define FRAME_GROWS_DOWNWARD 1
#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
#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
/* 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;
/* 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)))
/* 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 */
/* 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. */
/* 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;
\f
/* Frame Layout */
-#define STACK_GROWS_DOWNWARD
+#define STACK_GROWS_DOWNWARD 1
#define FRAME_GROWS_DOWNWARD 1
/* 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
/* 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
/* 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;
/* 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;
/* 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 \
#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
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
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
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
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
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
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
/* 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;
{
/* 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;
rtx temp;
rtx_insn *insn;
-#ifndef STACK_GROWS_DOWNWARD
+#if !STACK_GROWS_DOWNWARD
/* Hereafter anti_p means subtract_p. */
anti_p = !anti_p;
#endif
{
int saved_stack_pointer_delta;
-#ifndef STACK_GROWS_DOWNWARD
+#if !STACK_GROWS_DOWNWARD
emit_move_insn (target, virtual_stack_dynamic_rtx);
#endif
{
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);
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
}
#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)
#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
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;
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)
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;
emit_move_insn (stack_pointer_rtx,
expand_binop (Pmode,
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
sub_optab,
#else
add_optab,
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. */
}
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,
{
rtx xinner;
enum direction stack_direction
-#ifdef STACK_GROWS_DOWNWARD
+#if STACK_GROWS_DOWNWARD
= downward;
#else
= upward;
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). */
#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
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
#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
#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
|| 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
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;