builtins.c (stabilize_va_list): Don't INDIRECT_REF through an ARRAY_TYPE.
* builtins.c (stabilize_va_list): Don't INDIRECT_REF through an ARRAY_TYPE. (std_expand_builtin_va_start): Back out one word if !stdarg_p. (expand_builtin_va_end): Evaluate arg for side effects. * c-common.c (c_common_nodes_and_builtins): Construct a va_list_arg_type_node to handle array decomposition to pointer. From-SVN: r28283
This commit is contained in:
parent
f654e52683
commit
daf68dd71f
@ -1,3 +1,12 @@
|
||||
Mon Jul 26 22:43:12 1999 Richard Henderson <rth@cygnus.com>
|
||||
|
||||
* builtins.c (stabilize_va_list): Don't INDIRECT_REF through
|
||||
an ARRAY_TYPE.
|
||||
(std_expand_builtin_va_start): Back out one word if !stdarg_p.
|
||||
(expand_builtin_va_end): Evaluate arg for side effects.
|
||||
* c-common.c (c_common_nodes_and_builtins): Construct a
|
||||
va_list_arg_type_node to handle array decomposition to pointer.
|
||||
|
||||
Mon Jul 26 18:51:34 1999 Richard Henderson <rth@cygnus.com>
|
||||
|
||||
* except.c (start_dynamic_cleanup): Use force_operand on the
|
||||
|
@ -1840,13 +1840,17 @@ stabilize_va_list (valist, was_ptr)
|
||||
if (is_array
|
||||
&& TREE_CODE (valist) == ADDR_EXPR
|
||||
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (valist, 0))) == POINTER_TYPE)
|
||||
valist = TREE_OPERAND (valist, 0);
|
||||
|
||||
if (TREE_SIDE_EFFECTS (valist))
|
||||
valist = save_expr (valist);
|
||||
|
||||
if (! is_array)
|
||||
valist = fold (build1 (INDIRECT_REF, va_list_type_node, valist));
|
||||
{
|
||||
valist = TREE_OPERAND (valist, 0);
|
||||
if (TREE_SIDE_EFFECTS (valist))
|
||||
valist = save_expr (valist);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TREE_SIDE_EFFECTS (valist))
|
||||
valist = save_expr (valist);
|
||||
valist = fold (build1 (INDIRECT_REF, va_list_type_node, valist));
|
||||
}
|
||||
}
|
||||
else if (TREE_SIDE_EFFECTS (valist))
|
||||
{
|
||||
@ -1875,6 +1879,9 @@ std_expand_builtin_va_start (stdarg_p, valist, nextarg)
|
||||
{
|
||||
tree t;
|
||||
|
||||
if (!stdarg_p)
|
||||
nextarg = plus_constant (nextarg, -UNITS_PER_WORD);
|
||||
|
||||
t = build (MODIFY_EXPR, TREE_TYPE (valist), valist,
|
||||
make_tree (ptr_type_node, nextarg));
|
||||
TREE_SIDE_EFFECTS (t) = 1;
|
||||
@ -2002,12 +2009,18 @@ expand_builtin_va_arg (valist, type)
|
||||
/* Expand ARGLIST, from a call to __builtin_va_end. */
|
||||
static rtx
|
||||
expand_builtin_va_end (arglist)
|
||||
tree arglist ATTRIBUTE_UNUSED;
|
||||
tree arglist;
|
||||
{
|
||||
tree valist = TREE_VALUE (arglist);
|
||||
|
||||
#ifdef EXPAND_BUILTIN_VA_END
|
||||
tree valist = TREE_VALUE (arglist, 0);
|
||||
valist = stabilize_va_list (valist, 0);
|
||||
EXPAND_BUILTIN_VA_END(arglist);
|
||||
#else
|
||||
/* Evaluate for side effects, if needed. I hate macros that don't
|
||||
do that. */
|
||||
if (TREE_SIDE_EFFECTS (valist))
|
||||
expand_expr (valist, const0_rtx, VOIDmode, EXPAND_NORMAL);
|
||||
#endif
|
||||
|
||||
return const0_rtx;
|
||||
|
@ -3435,6 +3435,7 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
|
||||
/* Either char* or void*. */
|
||||
tree traditional_ptr_type_node;
|
||||
tree va_list_ptr_type_node;
|
||||
tree va_list_arg_type_node;
|
||||
|
||||
#ifdef BUILD_VA_LIST_TYPE
|
||||
BUILD_VA_LIST_TYPE(va_list_type_node);
|
||||
@ -3443,8 +3444,14 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
|
||||
#endif
|
||||
pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
|
||||
va_list_type_node));
|
||||
|
||||
va_list_ptr_type_node = build_pointer_type (va_list_type_node);
|
||||
|
||||
if (TREE_CODE (va_list_type_node) == ARRAY_TYPE)
|
||||
va_list_arg_type_node = build_pointer_type (TREE_TYPE (va_list_type_node));
|
||||
else
|
||||
va_list_arg_type_node = va_list_type_node;
|
||||
|
||||
endlink = void_list_node;
|
||||
int_endlink = tree_cons (NULL_TREE, integer_type_node, endlink);
|
||||
double_endlink = tree_cons (NULL_TREE, double_type_node, endlink);
|
||||
@ -3636,7 +3643,7 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
|
||||
builtin_function ("__builtin_va_end",
|
||||
build_function_type (void_type_node,
|
||||
tree_cons (NULL_TREE,
|
||||
va_list_type_node,
|
||||
va_list_arg_type_node,
|
||||
endlink)),
|
||||
BUILT_IN_VA_END, NULL_PTR);
|
||||
|
||||
@ -3645,7 +3652,7 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
|
||||
tree_cons (NULL_TREE,
|
||||
va_list_ptr_type_node,
|
||||
tree_cons (NULL_TREE,
|
||||
va_list_type_node,
|
||||
va_list_arg_type_node,
|
||||
endlink))),
|
||||
BUILT_IN_VA_COPY, NULL_PTR);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user