remove most ifdef STACK_GROWS_DOWNWARD
gcc/c-family/ChangeLog: 2015-05-20 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * c-cppbuiltin.c (c_cpp_builtins): Use if instead of #if with STACK_GROWS_DOWNWARD. gcc/ChangeLog: 2015-05-20 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * builtins.c, dwarf2cfi.c, explow.c, expr.c, recog.c, sched-deps.c: Use if instead of preprocessor checks with STACK_GROWS_DOWNWARD. From-SVN: r223514
This commit is contained in:
parent
62f9f30bfb
commit
581edfa33d
@ -1,3 +1,9 @@
|
||||
2015-05-20 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
|
||||
|
||||
* builtins.c, dwarf2cfi.c, explow.c, expr.c, recog.c,
|
||||
sched-deps.c: Use if instead of preprocessor checks with
|
||||
STACK_GROWS_DOWNWARD.
|
||||
|
||||
2015-05-20 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
|
||||
|
||||
* *.c: Check the value of STACK_GROWS_DOWNWARD rather than if it
|
||||
|
@ -1521,14 +1521,14 @@ expand_builtin_apply_args_1 (void)
|
||||
|
||||
/* Save the arg pointer to the block. */
|
||||
tem = copy_to_reg (crtl->args.internal_arg_pointer);
|
||||
#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. */
|
||||
tem
|
||||
= force_operand (plus_constant (Pmode, tem, crtl->args.pretend_args_size),
|
||||
NULL_RTX);
|
||||
#endif
|
||||
if (STACK_GROWS_DOWNWARD)
|
||||
tem
|
||||
= force_operand (plus_constant (Pmode, tem,
|
||||
crtl->args.pretend_args_size),
|
||||
NULL_RTX);
|
||||
emit_move_insn (adjust_address (registers, Pmode, 0), tem);
|
||||
|
||||
size = GET_MODE_SIZE (Pmode);
|
||||
@ -1613,10 +1613,9 @@ 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));
|
||||
#if !STACK_GROWS_DOWNWARD
|
||||
incoming_args = expand_simple_binop (Pmode, MINUS, incoming_args, argsize,
|
||||
incoming_args, 0, OPTAB_LIB_WIDEN);
|
||||
#endif
|
||||
if (!STACK_GROWS_DOWNWARD)
|
||||
incoming_args = expand_simple_binop (Pmode, MINUS, incoming_args, argsize,
|
||||
incoming_args, 0, OPTAB_LIB_WIDEN);
|
||||
|
||||
/* Push a new argument block and copy the arguments. Do not allow
|
||||
the (potential) memcpy call below to interfere with our stack
|
||||
@ -1646,12 +1645,13 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
|
||||
crtl->need_drap = true;
|
||||
|
||||
dest = virtual_outgoing_args_rtx;
|
||||
#if !STACK_GROWS_DOWNWARD
|
||||
if (CONST_INT_P (argsize))
|
||||
dest = plus_constant (Pmode, dest, -INTVAL (argsize));
|
||||
else
|
||||
dest = gen_rtx_PLUS (Pmode, dest, negate_rtx (Pmode, argsize));
|
||||
#endif
|
||||
if (!STACK_GROWS_DOWNWARD)
|
||||
{
|
||||
if (CONST_INT_P (argsize))
|
||||
dest = plus_constant (Pmode, dest, -INTVAL (argsize));
|
||||
else
|
||||
dest = gen_rtx_PLUS (Pmode, dest, negate_rtx (Pmode, argsize));
|
||||
}
|
||||
dest = gen_rtx_MEM (BLKmode, dest);
|
||||
set_mem_align (dest, PARM_BOUNDARY);
|
||||
src = gen_rtx_MEM (BLKmode, incoming_args);
|
||||
|
@ -1,3 +1,8 @@
|
||||
2015-05-20 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
|
||||
|
||||
* c-cppbuiltin.c (c_cpp_builtins): Use if instead of #if with
|
||||
STACK_GROWS_DOWNWARD.
|
||||
|
||||
2015-05-20 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
|
||||
|
||||
* c-cppbuiltin.c (c_cpp_builtins): Check the value of
|
||||
|
@ -1138,9 +1138,8 @@ c_cpp_builtins (cpp_reader *pfile)
|
||||
TRAMPOLINE_SIZE);
|
||||
|
||||
/* For libgcc generic-morestack.c and unwinder code. */
|
||||
#if STACK_GROWS_DOWNWARD
|
||||
cpp_define (pfile, "__LIBGCC_STACK_GROWS_DOWNWARD__");
|
||||
#endif
|
||||
if (STACK_GROWS_DOWNWARD)
|
||||
cpp_define (pfile, "__LIBGCC_STACK_GROWS_DOWNWARD__");
|
||||
|
||||
/* For libgcc unwinder code. */
|
||||
#ifdef DONT_USE_BUILTIN_SETJMP
|
||||
|
@ -944,9 +944,9 @@ 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. */
|
||||
#if !STACK_GROWS_DOWNWARD
|
||||
delta = -delta;
|
||||
#endif
|
||||
if (!STACK_GROWS_DOWNWARD)
|
||||
delta = -delta;
|
||||
|
||||
cur_cfa->offset += delta;
|
||||
}
|
||||
}
|
||||
@ -2347,9 +2347,9 @@ 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. */
|
||||
#if !STACK_GROWS_DOWNWARD
|
||||
delta = -delta;
|
||||
#endif
|
||||
if (!STACK_GROWS_DOWNWARD)
|
||||
delta = -delta;
|
||||
|
||||
cur_row->cfa.offset += delta;
|
||||
}
|
||||
|
||||
|
33
gcc/explow.c
33
gcc/explow.c
@ -866,10 +866,9 @@ adjust_stack_1 (rtx adjust, bool anti_p)
|
||||
rtx temp;
|
||||
rtx_insn *insn;
|
||||
|
||||
#if !STACK_GROWS_DOWNWARD
|
||||
/* Hereafter anti_p means subtract_p. */
|
||||
anti_p = !anti_p;
|
||||
#endif
|
||||
if (!STACK_GROWS_DOWNWARD)
|
||||
anti_p = !anti_p;
|
||||
|
||||
temp = expand_binop (Pmode,
|
||||
anti_p ? sub_optab : add_optab,
|
||||
@ -1414,24 +1413,23 @@ allocate_dynamic_stack_space (rtx size, unsigned size_align,
|
||||
{
|
||||
int saved_stack_pointer_delta;
|
||||
|
||||
#if !STACK_GROWS_DOWNWARD
|
||||
emit_move_insn (target, virtual_stack_dynamic_rtx);
|
||||
#endif
|
||||
if (!STACK_GROWS_DOWNWARD)
|
||||
emit_move_insn (target, virtual_stack_dynamic_rtx);
|
||||
|
||||
/* Check stack bounds if necessary. */
|
||||
if (crtl->limit_stack)
|
||||
{
|
||||
rtx available;
|
||||
rtx_code_label *space_available = gen_label_rtx ();
|
||||
#if STACK_GROWS_DOWNWARD
|
||||
available = expand_binop (Pmode, sub_optab,
|
||||
stack_pointer_rtx, stack_limit_rtx,
|
||||
NULL_RTX, 1, OPTAB_WIDEN);
|
||||
#else
|
||||
available = expand_binop (Pmode, sub_optab,
|
||||
stack_limit_rtx, stack_pointer_rtx,
|
||||
NULL_RTX, 1, OPTAB_WIDEN);
|
||||
#endif
|
||||
if (STACK_GROWS_DOWNWARD)
|
||||
available = expand_binop (Pmode, sub_optab,
|
||||
stack_pointer_rtx, stack_limit_rtx,
|
||||
NULL_RTX, 1, OPTAB_WIDEN);
|
||||
else
|
||||
available = expand_binop (Pmode, sub_optab,
|
||||
stack_limit_rtx, stack_pointer_rtx,
|
||||
NULL_RTX, 1, OPTAB_WIDEN);
|
||||
|
||||
emit_cmp_and_jump_insns (available, size, GEU, NULL_RTX, Pmode, 1,
|
||||
space_available);
|
||||
#ifdef HAVE_trap
|
||||
@ -1456,9 +1454,8 @@ allocate_dynamic_stack_space (rtx size, unsigned size_align,
|
||||
crtl->preferred_stack_boundary alignment. */
|
||||
stack_pointer_delta = saved_stack_pointer_delta;
|
||||
|
||||
#if STACK_GROWS_DOWNWARD
|
||||
emit_move_insn (target, virtual_stack_dynamic_rtx);
|
||||
#endif
|
||||
if (STACK_GROWS_DOWNWARD)
|
||||
emit_move_insn (target, virtual_stack_dynamic_rtx);
|
||||
}
|
||||
|
||||
suppress_reg_args_size = false;
|
||||
|
58
gcc/expr.c
58
gcc/expr.c
@ -869,11 +869,10 @@ move_by_pieces (rtx to, rtx from, unsigned HOST_WIDE_INT len,
|
||||
to_addr = NULL_RTX;
|
||||
data.to = NULL_RTX;
|
||||
data.autinc_to = 1;
|
||||
#if STACK_GROWS_DOWNWARD
|
||||
data.reverse = 1;
|
||||
#else
|
||||
data.reverse = 0;
|
||||
#endif
|
||||
if (STACK_GROWS_DOWNWARD)
|
||||
data.reverse = 1;
|
||||
else
|
||||
data.reverse = 0;
|
||||
}
|
||||
data.to_addr = to_addr;
|
||||
data.from = from;
|
||||
@ -4000,9 +3999,9 @@ 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));
|
||||
#if STACK_GROWS_DOWNWARD
|
||||
this_delta = -(unsigned HOST_WIDE_INT) this_delta;
|
||||
#endif
|
||||
if (STACK_GROWS_DOWNWARD)
|
||||
this_delta = -(unsigned HOST_WIDE_INT) this_delta;
|
||||
|
||||
args_size -= this_delta;
|
||||
}
|
||||
|
||||
@ -4045,42 +4044,38 @@ emit_single_push_insn_1 (machine_mode mode, rtx x, tree type)
|
||||
|
||||
emit_move_insn (stack_pointer_rtx,
|
||||
expand_binop (Pmode,
|
||||
#if STACK_GROWS_DOWNWARD
|
||||
sub_optab,
|
||||
#else
|
||||
add_optab,
|
||||
#endif
|
||||
STACK_GROWS_DOWNWARD ? sub_optab
|
||||
: add_optab,
|
||||
stack_pointer_rtx,
|
||||
gen_int_mode (rounded_size, Pmode),
|
||||
NULL_RTX, 0, OPTAB_LIB_WIDEN));
|
||||
|
||||
offset = (HOST_WIDE_INT) padding_size;
|
||||
#if STACK_GROWS_DOWNWARD
|
||||
if (STACK_PUSH_CODE == POST_DEC)
|
||||
if (STACK_GROWS_DOWNWARD && STACK_PUSH_CODE == POST_DEC)
|
||||
/* We have already decremented the stack pointer, so get the
|
||||
previous value. */
|
||||
offset += (HOST_WIDE_INT) rounded_size;
|
||||
#else
|
||||
if (STACK_PUSH_CODE == POST_INC)
|
||||
|
||||
if (!STACK_GROWS_DOWNWARD && STACK_PUSH_CODE == POST_INC)
|
||||
/* We have already incremented the stack pointer, so get the
|
||||
previous value. */
|
||||
offset -= (HOST_WIDE_INT) rounded_size;
|
||||
#endif
|
||||
|
||||
dest_addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
|
||||
gen_int_mode (offset, Pmode));
|
||||
}
|
||||
else
|
||||
{
|
||||
#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,
|
||||
Pmode));
|
||||
#else
|
||||
/* ??? This seems wrong if STACK_PUSH_CODE == POST_INC. */
|
||||
dest_addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
|
||||
gen_int_mode (rounded_size, Pmode));
|
||||
#endif
|
||||
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,
|
||||
Pmode));
|
||||
else
|
||||
/* ??? This seems wrong if STACK_PUSH_CODE == POST_INC. */
|
||||
dest_addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx,
|
||||
gen_int_mode (rounded_size, Pmode));
|
||||
|
||||
dest_addr = gen_rtx_PRE_MODIFY (Pmode, stack_pointer_rtx, dest_addr);
|
||||
}
|
||||
|
||||
@ -4163,12 +4158,7 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size,
|
||||
rtx alignment_pad)
|
||||
{
|
||||
rtx xinner;
|
||||
enum direction stack_direction
|
||||
#if STACK_GROWS_DOWNWARD
|
||||
= downward;
|
||||
#else
|
||||
= upward;
|
||||
#endif
|
||||
enum direction stack_direction = STACK_GROWS_DOWNWARD ? downward : upward;
|
||||
|
||||
/* Decide where to pad the argument: `downward' for below,
|
||||
`upward' for above, or `none' for don't pad it.
|
||||
|
@ -1332,12 +1332,8 @@ 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))
|
||||
#if STACK_GROWS_DOWNWARD
|
||||
|| INTVAL (XEXP (XEXP (op, 1), 1)) != - (int) rounded_size
|
||||
#else
|
||||
|| INTVAL (XEXP (XEXP (op, 1), 1)) != (int) rounded_size
|
||||
#endif
|
||||
)
|
||||
|| INTVAL (XEXP (XEXP (op, 1), 1))
|
||||
!= ((STACK_GROWS_DOWNWARD ? -1 : 1) * (int) rounded_size))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4734,11 +4734,10 @@ 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. */
|
||||
#if STACK_GROWS_DOWNWARD
|
||||
return mii->inc_constant > 0;
|
||||
#else
|
||||
return mii->inc_constant < 0;
|
||||
#endif
|
||||
if (STACK_GROWS_DOWNWARD)
|
||||
return mii->inc_constant > 0;
|
||||
else
|
||||
return mii->inc_constant < 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user