builtins.c (fold_builtin_next_arg): Use stdarg_p.
gcc/ * builtins.c (fold_builtin_next_arg): Use stdarg_p. * config/arm/arm.c (arm_get_pcs_model): Likewise. * config/avr/avr.c (init_cumulative_args): Likewise. * config/iq2000/iq2000.c (iq2000_expand_prologue): Likewise. * config/lm32/lm32.c (lm32_setup_incoming_varargs): Likewise. * config/m68k/m68k.c (m68k_return_pops_args): Likewise. * config/mn10300/mn10300.c (mn10300_builtin_saveregs): Likewise. * config/pa/pa.c (hppa_builtin_saveregs): Likewise. * config/pa/som.h (ASM_DECLARE_FUNCTION_NAME): Likewise. * config/rs6000/rs6000.c (init_cumulative_args): Likewise. * dwarf2out.c (gen_subprogram_die): Likewise. * function.c (allocate_struct_function): Likewise. * c-aux-info.c (gen_formal_list_for_func_dec): Likewise. (deserves_ellipsis): Delete. gcc/cp/ * tree.c (varargs_function_p): Use stdarg_p. From-SVN: r163033
This commit is contained in:
parent
ec64af64d6
commit
f38958e826
16 changed files with 36 additions and 73 deletions
|
@ -1,3 +1,20 @@
|
|||
2010-08-09 Nathan Froyd <froydnj@codesourcery.com>
|
||||
|
||||
* builtins.c (fold_builtin_next_arg): Use stdarg_p.
|
||||
* config/arm/arm.c (arm_get_pcs_model): Likewise.
|
||||
* config/avr/avr.c (init_cumulative_args): Likewise.
|
||||
* config/iq2000/iq2000.c (iq2000_expand_prologue): Likewise.
|
||||
* config/lm32/lm32.c (lm32_setup_incoming_varargs): Likewise.
|
||||
* config/m68k/m68k.c (m68k_return_pops_args): Likewise.
|
||||
* config/mn10300/mn10300.c (mn10300_builtin_saveregs): Likewise.
|
||||
* config/pa/pa.c (hppa_builtin_saveregs): Likewise.
|
||||
* config/pa/som.h (ASM_DECLARE_FUNCTION_NAME): Likewise.
|
||||
* config/rs6000/rs6000.c (init_cumulative_args): Likewise.
|
||||
* dwarf2out.c (gen_subprogram_die): Likewise.
|
||||
* function.c (allocate_struct_function): Likewise.
|
||||
* c-aux-info.c (gen_formal_list_for_func_dec): Likewise.
|
||||
(deserves_ellipsis): Delete.
|
||||
|
||||
2010-08-09 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
* tree-ssa-copy.c (cached_last_copy_of): Remove.
|
||||
|
|
|
@ -11526,9 +11526,7 @@ fold_builtin_next_arg (tree exp, bool va_start_p)
|
|||
int nargs = call_expr_nargs (exp);
|
||||
tree arg;
|
||||
|
||||
if (TYPE_ARG_TYPES (fntype) == 0
|
||||
|| (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
|
||||
== void_type_node))
|
||||
if (!stdarg_p (fntype))
|
||||
{
|
||||
error ("%<va_start%> used in function with fixed args");
|
||||
return true;
|
||||
|
|
|
@ -42,7 +42,6 @@ static const char *data_type;
|
|||
|
||||
static char *affix_data_type (const char *) ATTRIBUTE_MALLOC;
|
||||
static const char *gen_formal_list_for_type (tree, formals_style);
|
||||
static int deserves_ellipsis (tree);
|
||||
static const char *gen_formal_list_for_func_def (tree, formals_style);
|
||||
static const char *gen_type (const char *, tree, formals_style);
|
||||
static const char *gen_decl (tree, int, formals_style);
|
||||
|
@ -183,28 +182,6 @@ gen_formal_list_for_type (tree fntype, formals_style style)
|
|||
return concat (" (", formal_list, ")", NULL);
|
||||
}
|
||||
|
||||
/* For the generation of an ANSI prototype for a function definition, we have
|
||||
to look at the formal parameter list of the function's own "type" to
|
||||
determine if the function's formal parameter list should end with an
|
||||
ellipsis. Given a tree node, the following function will return nonzero
|
||||
if the "function type" parameter list should end with an ellipsis. */
|
||||
|
||||
static int
|
||||
deserves_ellipsis (tree fntype)
|
||||
{
|
||||
tree formal_type;
|
||||
|
||||
formal_type = TYPE_ARG_TYPES (fntype);
|
||||
while (formal_type && TREE_VALUE (formal_type) != void_type_node)
|
||||
formal_type = TREE_CHAIN (formal_type);
|
||||
|
||||
/* If there were at least some parameters, and if the formals-types-list
|
||||
petered out to a NULL (i.e. without being terminated by a void_type_node)
|
||||
then we need to tack on an ellipsis. */
|
||||
|
||||
return (!formal_type && TYPE_ARG_TYPES (fntype));
|
||||
}
|
||||
|
||||
/* Generate a parameter list for a function definition (in some given style).
|
||||
|
||||
Note that this routine has to be separate (and different) from the code that
|
||||
|
@ -248,7 +225,7 @@ gen_formal_list_for_func_def (tree fndecl, formals_style style)
|
|||
{
|
||||
if (!DECL_ARGUMENTS (fndecl))
|
||||
formal_list = concat (formal_list, "void", NULL);
|
||||
if (deserves_ellipsis (TREE_TYPE (fndecl)))
|
||||
if (stdarg_p (TREE_TYPE (fndecl)))
|
||||
formal_list = concat (formal_list, ", ...", NULL);
|
||||
}
|
||||
if ((style == ansi) || (style == k_and_r_names))
|
||||
|
|
|
@ -3717,9 +3717,7 @@ arm_get_pcs_model (const_tree type, const_tree decl)
|
|||
/* Detect varargs functions. These always use the base rules
|
||||
(no argument is ever a candidate for a co-processor
|
||||
register). */
|
||||
bool base_rules = (TYPE_ARG_TYPES (type) != 0
|
||||
&& (TREE_VALUE (tree_last (TYPE_ARG_TYPES (type)))
|
||||
!= void_type_node));
|
||||
bool base_rules = stdarg_p (type);
|
||||
|
||||
if (user_convention)
|
||||
{
|
||||
|
|
|
@ -1530,14 +1530,8 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, rtx libname,
|
|||
{
|
||||
cum->nregs = 18;
|
||||
cum->regno = FIRST_CUM_REG;
|
||||
if (!libname && fntype)
|
||||
{
|
||||
int stdarg = (TYPE_ARG_TYPES (fntype) != 0
|
||||
&& (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
|
||||
!= void_type_node));
|
||||
if (stdarg)
|
||||
cum->nregs = 0;
|
||||
}
|
||||
if (!libname && stdarg_p (fntype))
|
||||
cum->nregs = 0;
|
||||
}
|
||||
|
||||
/* Returns the number of registers to allocate for a function argument. */
|
||||
|
|
|
@ -1996,9 +1996,7 @@ iq2000_expand_prologue (void)
|
|||
/* If this function is a varargs function, store any registers that
|
||||
would normally hold arguments ($4 - $7) on the stack. */
|
||||
if (store_args_on_stack
|
||||
&& ((TYPE_ARG_TYPES (fntype) != 0
|
||||
&& (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
|
||||
!= void_type_node))
|
||||
&& (stdarg_p (fntype)
|
||||
|| last_arg_is_vararg_marker))
|
||||
{
|
||||
int offset = (regno - GP_ARG_FIRST) * UNITS_PER_WORD;
|
||||
|
|
|
@ -656,14 +656,10 @@ lm32_setup_incoming_varargs (CUMULATIVE_ARGS * cum, enum machine_mode mode,
|
|||
{
|
||||
int first_anon_arg;
|
||||
tree fntype;
|
||||
int stdarg_p;
|
||||
|
||||
fntype = TREE_TYPE (current_function_decl);
|
||||
stdarg_p = (TYPE_ARG_TYPES (fntype) != 0
|
||||
&& (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
|
||||
!= void_type_node));
|
||||
|
||||
if (stdarg_p)
|
||||
if (stdarg_p (fntype))
|
||||
first_anon_arg = *cum + LM32_FIRST_ARG_REG;
|
||||
else
|
||||
{
|
||||
|
|
|
@ -6540,9 +6540,7 @@ m68k_return_pops_args (tree fundecl, tree funtype, int size)
|
|||
return ((TARGET_RTD
|
||||
&& (!fundecl
|
||||
|| TREE_CODE (fundecl) != IDENTIFIER_NODE)
|
||||
&& (TYPE_ARG_TYPES (funtype) == 0
|
||||
|| (TREE_VALUE (tree_last (TYPE_ARG_TYPES (funtype)))
|
||||
== void_type_node)))
|
||||
&& (!stdarg_p (funtype)))
|
||||
? size : 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1493,9 +1493,7 @@ mn10300_builtin_saveregs (void)
|
|||
{
|
||||
rtx offset, mem;
|
||||
tree fntype = TREE_TYPE (current_function_decl);
|
||||
int argadj = ((!(TYPE_ARG_TYPES (fntype) != 0
|
||||
&& (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
|
||||
!= void_type_node)))
|
||||
int argadj = ((!stdarg_p (fntype))
|
||||
? UNITS_PER_WORD : 0);
|
||||
alias_set_type set = get_varargs_alias_set ();
|
||||
|
||||
|
|
|
@ -5944,9 +5944,7 @@ hppa_builtin_saveregs (void)
|
|||
{
|
||||
rtx offset, dest;
|
||||
tree fntype = TREE_TYPE (current_function_decl);
|
||||
int argadj = ((!(TYPE_ARG_TYPES (fntype) != 0
|
||||
&& (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
|
||||
!= void_type_node)))
|
||||
int argadj = ((!stdarg_p (fntype))
|
||||
? UNITS_PER_WORD : 0);
|
||||
|
||||
if (argadj)
|
||||
|
|
|
@ -157,9 +157,7 @@ do { \
|
|||
} \
|
||||
} \
|
||||
/* anonymous args */ \
|
||||
if (TYPE_ARG_TYPES (tree_type) != 0 \
|
||||
&& (TREE_VALUE (tree_last (TYPE_ARG_TYPES (tree_type)))\
|
||||
!= void_type_node)) \
|
||||
if (stdarg_p (tree_type)) \
|
||||
{ \
|
||||
for (; i < 4; i++) \
|
||||
fprintf (FILE, ",ARGW%d=GR", i); \
|
||||
|
|
|
@ -7369,10 +7369,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype,
|
|||
cum->call_cookie = ((DEFAULT_ABI == ABI_V4 && libcall)
|
||||
? CALL_LIBCALL : CALL_NORMAL);
|
||||
cum->sysv_gregno = GP_ARG_MIN_REG;
|
||||
cum->stdarg = fntype
|
||||
&& (TYPE_ARG_TYPES (fntype) != 0
|
||||
&& (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
|
||||
!= void_type_node));
|
||||
cum->stdarg = stdarg_p (fntype);
|
||||
|
||||
cum->nargs_prototype = 0;
|
||||
if (incoming || cum->prototype)
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2010-08-09 Nathan Froyd <froydnj@codesourcery.com>
|
||||
|
||||
* tree.c (varargs_function_p): Use stdarg_p.
|
||||
|
||||
2010-08-07 Nathan Froyd <froydnj@codesourcery.com>
|
||||
|
||||
* parser.c (cp_default_arg_entry): Declare. Declare a VEC of it.
|
||||
|
|
|
@ -2284,11 +2284,7 @@ error_type (tree arg)
|
|||
int
|
||||
varargs_function_p (const_tree function)
|
||||
{
|
||||
const_tree parm = TYPE_ARG_TYPES (TREE_TYPE (function));
|
||||
for (; parm; parm = TREE_CHAIN (parm))
|
||||
if (TREE_VALUE (parm) == void_type_node)
|
||||
return 0;
|
||||
return 1;
|
||||
return stdarg_p (TREE_TYPE (function));
|
||||
}
|
||||
|
||||
/* Returns 1 if decl is a member of a class. */
|
||||
|
|
|
@ -18927,7 +18927,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
|
|||
if (fn_arg_types != NULL)
|
||||
{
|
||||
/* This is the prototyped case, check for.... */
|
||||
if (TREE_VALUE (tree_last (fn_arg_types)) != void_type_node)
|
||||
if (stdarg_p (TREE_TYPE (decl)))
|
||||
gen_unspecified_parameters_die (decl, subr_die);
|
||||
}
|
||||
else if (DECL_INITIAL (decl) == NULL_TREE)
|
||||
|
|
|
@ -4293,11 +4293,7 @@ allocate_struct_function (tree fndecl, bool abstract_p)
|
|||
cfun->returns_struct = 1;
|
||||
}
|
||||
|
||||
cfun->stdarg
|
||||
= (fntype
|
||||
&& TYPE_ARG_TYPES (fntype) != 0
|
||||
&& (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype)))
|
||||
!= void_type_node));
|
||||
cfun->stdarg = stdarg_p (fntype);
|
||||
|
||||
/* Assume all registers in stdarg functions need to be saved. */
|
||||
cfun->va_list_gpr_size = VA_LIST_MAX_GPR_SIZE;
|
||||
|
|
Loading…
Add table
Reference in a new issue