Remove PUSH_ARGS_REVERSED from the RTL expander.
gcc/ * calls.c (initialize_argument_information): Always treat PUSH_ARGS_REVERSED as 1, simplify code accordingly. (expand_call): Likewise. (emit_library_call_calue_1): Likewise. * expr.c (PUSH_ARGS_REVERSED): Do not define. (emit_push_insn): Always treat PUSH_ARGS_REVERSED as 1, simplify code accordingly. From-SVN: r209897
This commit is contained in:
parent
9575df4af0
commit
3d9684ae6f
3 changed files with 25 additions and 77 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
2014-04-29 James Greenhalgh <james.greenhalgh@arm.com>
|
||||||
|
|
||||||
|
* calls.c (initialize_argument_information): Always treat
|
||||||
|
PUSH_ARGS_REVERSED as 1, simplify code accordingly.
|
||||||
|
(expand_call): Likewise.
|
||||||
|
(emit_library_call_calue_1): Likewise.
|
||||||
|
* expr.c (PUSH_ARGS_REVERSED): Do not define.
|
||||||
|
(emit_push_insn): Always treat PUSH_ARGS_REVERSED as 1, simplify
|
||||||
|
code accordingly.
|
||||||
|
|
||||||
2014-04-29 Nick Clifton <nickc@redhat.com>
|
2014-04-29 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* config/arc/arc.c (arc_select_cc_mode): Fix parentheses.
|
* config/arc/arc.c (arc_select_cc_mode): Fix parentheses.
|
||||||
|
|
72
gcc/calls.c
72
gcc/calls.c
|
@ -1104,8 +1104,6 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
|
||||||
{
|
{
|
||||||
CUMULATIVE_ARGS *args_so_far_pnt = get_cumulative_args (args_so_far);
|
CUMULATIVE_ARGS *args_so_far_pnt = get_cumulative_args (args_so_far);
|
||||||
location_t loc = EXPR_LOCATION (exp);
|
location_t loc = EXPR_LOCATION (exp);
|
||||||
/* 1 if scanning parms front to back, -1 if scanning back to front. */
|
|
||||||
int inc;
|
|
||||||
|
|
||||||
/* Count arg position in order args appear. */
|
/* Count arg position in order args appear. */
|
||||||
int argpos;
|
int argpos;
|
||||||
|
@ -1116,22 +1114,9 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
|
||||||
args_size->var = 0;
|
args_size->var = 0;
|
||||||
|
|
||||||
/* In this loop, we consider args in the order they are written.
|
/* In this loop, we consider args in the order they are written.
|
||||||
We fill up ARGS from the front or from the back if necessary
|
We fill up ARGS from the back. */
|
||||||
so that in any case the first arg to be pushed ends up at the front. */
|
|
||||||
|
|
||||||
if (PUSH_ARGS_REVERSED)
|
i = num_actuals - 1;
|
||||||
{
|
|
||||||
i = num_actuals - 1, inc = -1;
|
|
||||||
/* In this case, must reverse order of args
|
|
||||||
so that we compute and push the last arg first. */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
i = 0, inc = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* First fill in the actual arguments in the ARGS array, splitting
|
|
||||||
complex arguments if necessary. */
|
|
||||||
{
|
{
|
||||||
int j = i;
|
int j = i;
|
||||||
call_expr_arg_iterator iter;
|
call_expr_arg_iterator iter;
|
||||||
|
@ -1140,7 +1125,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
|
||||||
if (struct_value_addr_value)
|
if (struct_value_addr_value)
|
||||||
{
|
{
|
||||||
args[j].tree_value = struct_value_addr_value;
|
args[j].tree_value = struct_value_addr_value;
|
||||||
j += inc;
|
j--;
|
||||||
}
|
}
|
||||||
FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
|
FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
|
||||||
{
|
{
|
||||||
|
@ -1152,17 +1137,17 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
|
||||||
{
|
{
|
||||||
tree subtype = TREE_TYPE (argtype);
|
tree subtype = TREE_TYPE (argtype);
|
||||||
args[j].tree_value = build1 (REALPART_EXPR, subtype, arg);
|
args[j].tree_value = build1 (REALPART_EXPR, subtype, arg);
|
||||||
j += inc;
|
j--;
|
||||||
args[j].tree_value = build1 (IMAGPART_EXPR, subtype, arg);
|
args[j].tree_value = build1 (IMAGPART_EXPR, subtype, arg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
args[j].tree_value = arg;
|
args[j].tree_value = arg;
|
||||||
j += inc;
|
j--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* I counts args in order (to be) pushed; ARGPOS counts in order written. */
|
/* I counts args in order (to be) pushed; ARGPOS counts in order written. */
|
||||||
for (argpos = 0; argpos < num_actuals; i += inc, argpos++)
|
for (argpos = 0; argpos < num_actuals; i--, argpos++)
|
||||||
{
|
{
|
||||||
tree type = TREE_TYPE (args[i].tree_value);
|
tree type = TREE_TYPE (args[i].tree_value);
|
||||||
int unsignedp;
|
int unsignedp;
|
||||||
|
@ -2952,9 +2937,8 @@ expand_call (tree exp, rtx target, int ignore)
|
||||||
|
|
||||||
compute_argument_addresses (args, argblock, num_actuals);
|
compute_argument_addresses (args, argblock, num_actuals);
|
||||||
|
|
||||||
/* If we push args individually in reverse order, perform stack alignment
|
/* Perform stack alignment before the first push (the last arg). */
|
||||||
before the first push (the last arg). */
|
if (argblock == 0
|
||||||
if (PUSH_ARGS_REVERSED && argblock == 0
|
|
||||||
&& adjusted_args_size.constant > reg_parm_stack_space
|
&& adjusted_args_size.constant > reg_parm_stack_space
|
||||||
&& adjusted_args_size.constant != unadjusted_args_size)
|
&& adjusted_args_size.constant != unadjusted_args_size)
|
||||||
{
|
{
|
||||||
|
@ -3097,12 +3081,6 @@ expand_call (tree exp, rtx target, int ignore)
|
||||||
sibcall_failure = 1;
|
sibcall_failure = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we pushed args in forward order, perform stack alignment
|
|
||||||
after pushing the last arg. */
|
|
||||||
if (!PUSH_ARGS_REVERSED && argblock == 0)
|
|
||||||
anti_adjust_stack (GEN_INT (adjusted_args_size.constant
|
|
||||||
- unadjusted_args_size));
|
|
||||||
|
|
||||||
/* If register arguments require space on the stack and stack space
|
/* If register arguments require space on the stack and stack space
|
||||||
was not preallocated, allocate stack space here for arguments
|
was not preallocated, allocate stack space here for arguments
|
||||||
passed in registers. */
|
passed in registers. */
|
||||||
|
@ -3152,8 +3130,7 @@ expand_call (tree exp, rtx target, int ignore)
|
||||||
if (pass == 1 && (return_flags & ERF_RETURNS_ARG))
|
if (pass == 1 && (return_flags & ERF_RETURNS_ARG))
|
||||||
{
|
{
|
||||||
int arg_nr = return_flags & ERF_RETURN_ARG_MASK;
|
int arg_nr = return_flags & ERF_RETURN_ARG_MASK;
|
||||||
if (PUSH_ARGS_REVERSED)
|
arg_nr = num_actuals - arg_nr - 1;
|
||||||
arg_nr = num_actuals - arg_nr - 1;
|
|
||||||
if (arg_nr >= 0
|
if (arg_nr >= 0
|
||||||
&& arg_nr < num_actuals
|
&& arg_nr < num_actuals
|
||||||
&& args[arg_nr].reg
|
&& args[arg_nr].reg
|
||||||
|
@ -3610,7 +3587,6 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
|
||||||
isn't present here, so we default to native calling abi here. */
|
isn't present here, so we default to native calling abi here. */
|
||||||
tree fndecl ATTRIBUTE_UNUSED = NULL_TREE; /* library calls default to host calling abi ? */
|
tree fndecl ATTRIBUTE_UNUSED = NULL_TREE; /* library calls default to host calling abi ? */
|
||||||
tree fntype ATTRIBUTE_UNUSED = NULL_TREE; /* library calls default to host calling abi ? */
|
tree fntype ATTRIBUTE_UNUSED = NULL_TREE; /* library calls default to host calling abi ? */
|
||||||
int inc;
|
|
||||||
int count;
|
int count;
|
||||||
rtx argblock = 0;
|
rtx argblock = 0;
|
||||||
CUMULATIVE_ARGS args_so_far_v;
|
CUMULATIVE_ARGS args_so_far_v;
|
||||||
|
@ -3959,22 +3935,13 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
|
||||||
argblock = push_block (GEN_INT (args_size.constant), 0, 0);
|
argblock = push_block (GEN_INT (args_size.constant), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we push args individually in reverse order, perform stack alignment
|
/* We push args individually in reverse order, perform stack alignment
|
||||||
before the first push (the last arg). */
|
before the first push (the last arg). */
|
||||||
if (argblock == 0 && PUSH_ARGS_REVERSED)
|
if (argblock == 0)
|
||||||
anti_adjust_stack (GEN_INT (args_size.constant
|
anti_adjust_stack (GEN_INT (args_size.constant
|
||||||
- original_args_size.constant));
|
- original_args_size.constant));
|
||||||
|
|
||||||
if (PUSH_ARGS_REVERSED)
|
argnum = nargs - 1;
|
||||||
{
|
|
||||||
inc = -1;
|
|
||||||
argnum = nargs - 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
inc = 1;
|
|
||||||
argnum = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef REG_PARM_STACK_SPACE
|
#ifdef REG_PARM_STACK_SPACE
|
||||||
if (ACCUMULATE_OUTGOING_ARGS)
|
if (ACCUMULATE_OUTGOING_ARGS)
|
||||||
|
@ -3991,7 +3958,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
|
||||||
|
|
||||||
/* ARGNUM indexes the ARGVEC array in the order in which the arguments
|
/* ARGNUM indexes the ARGVEC array in the order in which the arguments
|
||||||
are to be pushed. */
|
are to be pushed. */
|
||||||
for (count = 0; count < nargs; count++, argnum += inc)
|
for (count = 0; count < nargs; count++, argnum--)
|
||||||
{
|
{
|
||||||
enum machine_mode mode = argvec[argnum].mode;
|
enum machine_mode mode = argvec[argnum].mode;
|
||||||
rtx val = argvec[argnum].value;
|
rtx val = argvec[argnum].value;
|
||||||
|
@ -4093,16 +4060,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we pushed args in forward order, perform stack alignment
|
argnum = nargs - 1;
|
||||||
after pushing the last arg. */
|
|
||||||
if (argblock == 0 && !PUSH_ARGS_REVERSED)
|
|
||||||
anti_adjust_stack (GEN_INT (args_size.constant
|
|
||||||
- original_args_size.constant));
|
|
||||||
|
|
||||||
if (PUSH_ARGS_REVERSED)
|
|
||||||
argnum = nargs - 1;
|
|
||||||
else
|
|
||||||
argnum = 0;
|
|
||||||
|
|
||||||
fun = prepare_call_address (NULL, fun, NULL, &call_fusage, 0, 0);
|
fun = prepare_call_address (NULL, fun, NULL, &call_fusage, 0, 0);
|
||||||
|
|
||||||
|
@ -4110,7 +4068,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
|
||||||
|
|
||||||
/* ARGNUM indexes the ARGVEC array in the order in which the arguments
|
/* ARGNUM indexes the ARGVEC array in the order in which the arguments
|
||||||
are to be pushed. */
|
are to be pushed. */
|
||||||
for (count = 0; count < nargs; count++, argnum += inc)
|
for (count = 0; count < nargs; count++, argnum--)
|
||||||
{
|
{
|
||||||
enum machine_mode mode = argvec[argnum].mode;
|
enum machine_mode mode = argvec[argnum].mode;
|
||||||
rtx val = argvec[argnum].value;
|
rtx val = argvec[argnum].value;
|
||||||
|
|
20
gcc/expr.c
20
gcc/expr.c
|
@ -68,22 +68,6 @@ along with GCC; see the file COPYING3. If not see
|
||||||
#include "tree-ssa-address.h"
|
#include "tree-ssa-address.h"
|
||||||
#include "cfgexpand.h"
|
#include "cfgexpand.h"
|
||||||
|
|
||||||
/* Decide whether a function's arguments should be processed
|
|
||||||
from first to last or from last to first.
|
|
||||||
|
|
||||||
They should if the stack and args grow in opposite directions, but
|
|
||||||
only if we have push insns. */
|
|
||||||
|
|
||||||
#ifdef PUSH_ROUNDING
|
|
||||||
|
|
||||||
#ifndef PUSH_ARGS_REVERSED
|
|
||||||
#if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNWARD)
|
|
||||||
#define PUSH_ARGS_REVERSED /* If it's last to first. */
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef STACK_PUSH_CODE
|
#ifndef STACK_PUSH_CODE
|
||||||
#ifdef STACK_GROWS_DOWNWARD
|
#ifdef STACK_GROWS_DOWNWARD
|
||||||
#define STACK_PUSH_CODE PRE_DEC
|
#define STACK_PUSH_CODE PRE_DEC
|
||||||
|
@ -4365,11 +4349,7 @@ emit_push_insn (rtx x, enum machine_mode mode, tree type, rtx size,
|
||||||
/* Loop over all the words allocated on the stack for this arg. */
|
/* Loop over all the words allocated on the stack for this arg. */
|
||||||
/* We can do it by words, because any scalar bigger than a word
|
/* We can do it by words, because any scalar bigger than a word
|
||||||
has a size a multiple of a word. */
|
has a size a multiple of a word. */
|
||||||
#ifndef PUSH_ARGS_REVERSED
|
|
||||||
for (i = not_stack; i < size; i++)
|
|
||||||
#else
|
|
||||||
for (i = size - 1; i >= not_stack; i--)
|
for (i = size - 1; i >= not_stack; i--)
|
||||||
#endif
|
|
||||||
if (i >= not_stack + offset)
|
if (i >= not_stack + offset)
|
||||||
emit_push_insn (operand_subword_force (x, i, mode),
|
emit_push_insn (operand_subword_force (x, i, mode),
|
||||||
word_mode, NULL_TREE, NULL_RTX, align, 0, NULL_RTX,
|
word_mode, NULL_TREE, NULL_RTX, align, 0, NULL_RTX,
|
||||||
|
|
Loading…
Add table
Reference in a new issue