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