+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
/* 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);
/* 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
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);
+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
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
/* 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;
}
}
{
/* 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;
}
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,
{
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
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;
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;
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;
}
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);
}
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.
|| 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;
}
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;
}