Commit 6dad9361 by Trevor Saunders Committed by Trevor Saunders

remove #if ARGS_GROW_DOWNWARD

gcc/ChangeLog:

2015-04-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* calls.c (save_fixed_argument_area): Don't check
	ARGS_GROW_DOWNWARD with the preprocessor.
	(restore_fixed_argument_area): Likewise.
	(mem_overlaps_already_clobbered_arg_p): Likewise.
	(check_sibcall_argument_overlap): Likewise.
	(expand_call): Likewise.
	(emit_library_call_value_1): Likewise.
	(store_one_arg): Likewise.
	* function.c (assign_parms): Likewise.
	(locate_and_pad_parm): Likewise.
	(pad_to_arg_alignment): Likewise.
	* targhooks.c (std_gimplify_va_arg_expr): Likewise.

From-SVN: r222508
parent 376bddab
2015-04-27 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* calls.c (save_fixed_argument_area): Don't check
ARGS_GROW_DOWNWARD with the preprocessor.
(restore_fixed_argument_area): Likewise.
(mem_overlaps_already_clobbered_arg_p): Likewise.
(check_sibcall_argument_overlap): Likewise.
(expand_call): Likewise.
(emit_library_call_value_1): Likewise.
(store_one_arg): Likewise.
* function.c (assign_parms): Likewise.
(locate_and_pad_parm): Likewise.
(pad_to_arg_alignment): Likewise.
* targhooks.c (std_gimplify_va_arg_expr): Likewise.
2015-04-27 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* config/pa/pa.h (ARGS_GROW_DOWNWARD): Define to 1.
* defaults.h (ARGS_GROW_DOWNWARD): Define it to 0 by default.
* calls.c (save_fixed_argument_area): Don't chekc if
......
......@@ -948,9 +948,9 @@ save_fixed_argument_area (int reg_parm_stack_space, rtx argblock, int *low_to_sa
/* Compute the boundary of the area that needs to be saved, if any. */
high = reg_parm_stack_space;
#if ARGS_GROW_DOWNWARD
high += 1;
#endif
if (ARGS_GROW_DOWNWARD)
high += 1;
if (high > highest_outgoing_arg_in_use)
high = highest_outgoing_arg_in_use;
......@@ -979,11 +979,11 @@ save_fixed_argument_area (int reg_parm_stack_space, rtx argblock, int *low_to_sa
BIGGEST_ALIGNMENT / UNITS_PER_WORD) - 1)))
save_mode = BLKmode;
#if ARGS_GROW_DOWNWARD
delta = -high;
#else
delta = low;
#endif
if (ARGS_GROW_DOWNWARD)
delta = -high;
else
delta = low;
addr = plus_constant (Pmode, argblock, delta);
stack_area = gen_rtx_MEM (save_mode, memory_address (save_mode, addr));
......@@ -1013,11 +1013,11 @@ restore_fixed_argument_area (rtx save_area, rtx argblock, int high_to_save, int
int delta;
rtx addr, stack_area;
#if ARGS_GROW_DOWNWARD
delta = -high_to_save;
#else
delta = low_to_save;
#endif
if (ARGS_GROW_DOWNWARD)
delta = -high_to_save;
else
delta = low_to_save;
addr = plus_constant (Pmode, argblock, delta);
stack_area = gen_rtx_MEM (save_mode, memory_address (save_mode, addr));
set_mem_align (stack_area, PARM_BOUNDARY);
......@@ -1980,9 +1980,9 @@ mem_overlaps_already_clobbered_arg_p (rtx addr, unsigned HOST_WIDE_INT size)
i += crtl->args.pretend_args_size;
#endif
#if ARGS_GROW_DOWNWARD
i = -i - size;
#endif
if (ARGS_GROW_DOWNWARD)
i = -i - size;
if (size > 0)
{
unsigned HOST_WIDE_INT k;
......@@ -2286,11 +2286,10 @@ check_sibcall_argument_overlap (rtx_insn *insn, struct arg_data *arg,
if (mark_stored_args_map)
{
#if ARGS_GROW_DOWNWARD
low = -arg->locate.slot_offset.constant - arg->locate.size.constant;
#else
low = arg->locate.slot_offset.constant;
#endif
if (ARGS_GROW_DOWNWARD)
low = -arg->locate.slot_offset.constant - arg->locate.size.constant;
else
low = arg->locate.slot_offset.constant;
for (high = low + arg->locate.size.constant; low < high; low++)
bitmap_set_bit (stored_args_map, low);
......@@ -2979,13 +2978,13 @@ expand_call (tree exp, rtx target, int ignore)
if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl))))
needed += reg_parm_stack_space;
#if ARGS_GROW_DOWNWARD
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed + 1);
#else
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed);
#endif
if (ARGS_GROW_DOWNWARD)
highest_outgoing_arg_in_use
= MAX (initial_highest_arg_in_use, needed + 1);
else
highest_outgoing_arg_in_use
= MAX (initial_highest_arg_in_use, needed);
free (stack_usage_map_buf);
stack_usage_map_buf = XNEWVEC (char, highest_outgoing_arg_in_use);
stack_usage_map = stack_usage_map_buf;
......@@ -3047,9 +3046,8 @@ expand_call (tree exp, rtx target, int ignore)
else
{
argblock = push_block (GEN_INT (needed), 0, 0);
#if ARGS_GROW_DOWNWARD
argblock = plus_constant (Pmode, argblock, needed);
#endif
if (ARGS_GROW_DOWNWARD)
argblock = plus_constant (Pmode, argblock, needed);
}
/* We only really need to call `copy_to_reg' in the case
......@@ -4122,13 +4120,12 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl))))
needed += reg_parm_stack_space;
#if ARGS_GROW_DOWNWARD
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed + 1);
#else
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed);
#endif
if (ARGS_GROW_DOWNWARD)
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed + 1);
else
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, needed);
stack_usage_map_buf = XNEWVEC (char, highest_outgoing_arg_in_use);
stack_usage_map = stack_usage_map_buf;
......@@ -4213,15 +4210,18 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
/* If this is being stored into a pre-allocated, fixed-size,
stack area, save any previous data at that location. */
#if ARGS_GROW_DOWNWARD
/* stack_slot is negative, but we want to index stack_usage_map
with positive values. */
upper_bound = -argvec[argnum].locate.slot_offset.constant + 1;
lower_bound = upper_bound - argvec[argnum].locate.size.constant;
#else
lower_bound = argvec[argnum].locate.slot_offset.constant;
upper_bound = lower_bound + argvec[argnum].locate.size.constant;
#endif
if (ARGS_GROW_DOWNWARD)
{
/* stack_slot is negative, but we want to index stack_usage_map
with positive values. */
upper_bound = -argvec[argnum].locate.slot_offset.constant + 1;
lower_bound = upper_bound - argvec[argnum].locate.size.constant;
}
else
{
lower_bound = argvec[argnum].locate.slot_offset.constant;
upper_bound = lower_bound + argvec[argnum].locate.size.constant;
}
i = lower_bound;
/* Don't worry about things in the fixed argument area;
......@@ -4702,23 +4702,26 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags,
save any previous data at that location. */
if (argblock && ! variable_size && arg->stack)
{
#if ARGS_GROW_DOWNWARD
/* stack_slot is negative, but we want to index stack_usage_map
with positive values. */
if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
upper_bound = -INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1)) + 1;
else
upper_bound = 0;
if (ARGS_GROW_DOWNWARD)
{
/* stack_slot is negative, but we want to index stack_usage_map
with positive values. */
if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
upper_bound = -INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1)) + 1;
else
upper_bound = 0;
lower_bound = upper_bound - arg->locate.size.constant;
#else
if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
lower_bound = INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1));
lower_bound = upper_bound - arg->locate.size.constant;
}
else
lower_bound = 0;
{
if (GET_CODE (XEXP (arg->stack_slot, 0)) == PLUS)
lower_bound = INTVAL (XEXP (XEXP (arg->stack_slot, 0), 1));
else
lower_bound = 0;
upper_bound = lower_bound + arg->locate.size.constant;
#endif
upper_bound = lower_bound + arg->locate.size.constant;
}
i = lower_bound;
/* Don't worry about things in the fixed argument area;
......
......@@ -3771,15 +3771,16 @@ assign_parms (tree fndecl)
crtl->args.size = CEIL_ROUND (crtl->args.size,
PARM_BOUNDARY / BITS_PER_UNIT);
#if ARGS_GROW_DOWNWARD
crtl->args.arg_offset_rtx
= (all.stack_args_size.var == 0 ? GEN_INT (-all.stack_args_size.constant)
: expand_expr (size_diffop (all.stack_args_size.var,
size_int (-all.stack_args_size.constant)),
NULL_RTX, VOIDmode, EXPAND_NORMAL));
#else
crtl->args.arg_offset_rtx = ARGS_SIZE_RTX (all.stack_args_size);
#endif
if (ARGS_GROW_DOWNWARD)
{
crtl->args.arg_offset_rtx
= (all.stack_args_size.var == 0 ? GEN_INT (-all.stack_args_size.constant)
: expand_expr (size_diffop (all.stack_args_size.var,
size_int (-all.stack_args_size.constant)),
NULL_RTX, VOIDmode, EXPAND_NORMAL));
}
else
crtl->args.arg_offset_rtx = ARGS_SIZE_RTX (all.stack_args_size);
/* See how many bytes, if any, of its args a function should try to pop
on return. */
......@@ -4070,68 +4071,71 @@ locate_and_pad_parm (machine_mode passed_mode, tree type, int in_regs,
if (crtl->preferred_stack_boundary < boundary)
crtl->preferred_stack_boundary = boundary;
#if ARGS_GROW_DOWNWARD
locate->slot_offset.constant = -initial_offset_ptr->constant;
if (initial_offset_ptr->var)
locate->slot_offset.var = size_binop (MINUS_EXPR, ssize_int (0),
initial_offset_ptr->var);
if (ARGS_GROW_DOWNWARD)
{
locate->slot_offset.constant = -initial_offset_ptr->constant;
if (initial_offset_ptr->var)
locate->slot_offset.var = size_binop (MINUS_EXPR, ssize_int (0),
initial_offset_ptr->var);
{
tree s2 = sizetree;
if (where_pad != none
&& (!tree_fits_uhwi_p (sizetree)
|| (tree_to_uhwi (sizetree) * BITS_PER_UNIT) % round_boundary))
s2 = round_up (s2, round_boundary / BITS_PER_UNIT);
SUB_PARM_SIZE (locate->slot_offset, s2);
}
{
tree s2 = sizetree;
if (where_pad != none
&& (!tree_fits_uhwi_p (sizetree)
|| (tree_to_uhwi (sizetree) * BITS_PER_UNIT) % round_boundary))
s2 = round_up (s2, round_boundary / BITS_PER_UNIT);
SUB_PARM_SIZE (locate->slot_offset, s2);
}
locate->slot_offset.constant += part_size_in_regs;
if (!in_regs || reg_parm_stack_space > 0)
pad_to_arg_alignment (&locate->slot_offset, boundary,
&locate->alignment_pad);
locate->size.constant = (-initial_offset_ptr->constant
- locate->slot_offset.constant);
if (initial_offset_ptr->var)
locate->size.var = size_binop (MINUS_EXPR,
size_binop (MINUS_EXPR,
ssize_int (0),
initial_offset_ptr->var),
locate->slot_offset.var);
locate->slot_offset.constant += part_size_in_regs;
if (!in_regs || reg_parm_stack_space > 0)
pad_to_arg_alignment (&locate->slot_offset, boundary,
&locate->alignment_pad);
locate->size.constant = (-initial_offset_ptr->constant
- locate->slot_offset.constant);
if (initial_offset_ptr->var)
locate->size.var = size_binop (MINUS_EXPR,
size_binop (MINUS_EXPR,
ssize_int (0),
initial_offset_ptr->var),
locate->slot_offset.var);
/* Pad_below needs the pre-rounded size to know how much to pad
below. */
locate->offset = locate->slot_offset;
if (where_pad == downward)
pad_below (&locate->offset, passed_mode, sizetree);
#else /* !ARGS_GROW_DOWNWARD */
if (!in_regs || reg_parm_stack_space > 0)
pad_to_arg_alignment (initial_offset_ptr, boundary,
&locate->alignment_pad);
locate->slot_offset = *initial_offset_ptr;
/* Pad_below needs the pre-rounded size to know how much to pad
below. */
locate->offset = locate->slot_offset;
if (where_pad == downward)
pad_below (&locate->offset, passed_mode, sizetree);
}
else
{
if (!in_regs || reg_parm_stack_space > 0)
pad_to_arg_alignment (initial_offset_ptr, boundary,
&locate->alignment_pad);
locate->slot_offset = *initial_offset_ptr;
#ifdef PUSH_ROUNDING
if (passed_mode != BLKmode)
sizetree = size_int (PUSH_ROUNDING (TREE_INT_CST_LOW (sizetree)));
if (passed_mode != BLKmode)
sizetree = size_int (PUSH_ROUNDING (TREE_INT_CST_LOW (sizetree)));
#endif
/* Pad_below needs the pre-rounded size to know how much to pad below
so this must be done before rounding up. */
locate->offset = locate->slot_offset;
if (where_pad == downward)
pad_below (&locate->offset, passed_mode, sizetree);
/* Pad_below needs the pre-rounded size to know how much to pad below
so this must be done before rounding up. */
locate->offset = locate->slot_offset;
if (where_pad == downward)
pad_below (&locate->offset, passed_mode, sizetree);
if (where_pad != none
&& (!tree_fits_uhwi_p (sizetree)
|| (tree_to_uhwi (sizetree) * BITS_PER_UNIT) % round_boundary))
sizetree = round_up (sizetree, round_boundary / BITS_PER_UNIT);
if (where_pad != none
&& (!tree_fits_uhwi_p (sizetree)
|| (tree_to_uhwi (sizetree) * BITS_PER_UNIT) % round_boundary))
sizetree = round_up (sizetree, round_boundary / BITS_PER_UNIT);
ADD_PARM_SIZE (locate->size, sizetree);
ADD_PARM_SIZE (locate->size, sizetree);
locate->size.constant -= part_size_in_regs;
#endif /* ARGS_GROW_DOWNWARD */
locate->size.constant -= part_size_in_regs;
}
#ifdef FUNCTION_ARG_OFFSET
locate->offset.constant += FUNCTION_ARG_OFFSET (passed_mode, type);
......@@ -4175,11 +4179,11 @@ pad_to_arg_alignment (struct args_size *offset_ptr, int boundary,
tree offset = size_binop (PLUS_EXPR,
ARGS_SIZE_TREE (*offset_ptr),
sp_offset_tree);
#if ARGS_GROW_DOWNWARD
tree rounded = round_down (offset, boundary / BITS_PER_UNIT);
#else
tree rounded = round_up (offset, boundary / BITS_PER_UNIT);
#endif
tree rounded;
if (ARGS_GROW_DOWNWARD)
rounded = round_down (offset, boundary / BITS_PER_UNIT);
else
rounded = round_up (offset, boundary / BITS_PER_UNIT);
offset_ptr->var = size_binop (MINUS_EXPR, rounded, sp_offset_tree);
/* ARGS_SIZE_TREE includes constant term. */
......@@ -4191,11 +4195,10 @@ pad_to_arg_alignment (struct args_size *offset_ptr, int boundary,
else
{
offset_ptr->constant = -sp_offset +
#if ARGS_GROW_DOWNWARD
FLOOR_ROUND (offset_ptr->constant + sp_offset, boundary_in_bytes);
#else
ARGS_GROW_DOWNWARD ?
FLOOR_ROUND (offset_ptr->constant + sp_offset, boundary_in_bytes) :
CEIL_ROUND (offset_ptr->constant + sp_offset, boundary_in_bytes);
#endif
if (boundary > PARM_BOUNDARY)
alignment_pad->constant = offset_ptr->constant - save_constant;
}
......
......@@ -1786,12 +1786,11 @@ std_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
unsigned HOST_WIDE_INT align, boundary;
bool indirect;
#if ARGS_GROW_DOWNWARD
/* All of the alignment and movement below is for args-grow-up machines.
As of 2004, there are only 3 ARGS_GROW_DOWNWARD targets, and they all
implement their own specialized gimplify_va_arg_expr routines. */
gcc_unreachable ();
#endif
if (ARGS_GROW_DOWNWARD)
gcc_unreachable ();
indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
if (indirect)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment