This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tuples] va_arg sequence changes
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: dnovillo at acm dot org, rth at redhat dot com, amacleod at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Fri, 4 May 2007 09:05:46 -0400
- Subject: [tuples] va_arg sequence changes
Ok, yesterday's patch was abysmal. I'm splitting it all up, and committing
the non controversial bits. Hopefully I can get this done before Richard
and Diego wake up.
These are some mechanical changes so the *va_arg* gimplifying functions
use sequences, and pass the correct number of arguments to gimplify_expr.
Committed to branch.
Aldy
* tree.h (std_gimplify_va_arg_expr): Change tree * to a sequence
in prototype.
(gimplify_parameters): Return a sequence.
* target.h (gimplify_va_arg_expr): Change tree * to a sequence.
* builtins.c (std_gimplify_va_arg_expr): Same.
Pass additional argument to gimplify_expr.
(gimplify_va_arg_expr): Change tree * to a sequence.
Change append_to_statement_list call to gimplify_and_add.
Pass additional argument to gimplify_expr calls.
Index: tree.h
===================================================================
--- tree.h (revision 124007)
+++ tree.h (working copy)
@@ -4513,7 +4513,7 @@ extern tree build_call_expr (tree, int,
extern tree mathfn_built_in (tree, enum built_in_function fn);
extern tree strip_float_extensions (tree);
extern tree c_strlen (tree, int);
-extern tree std_gimplify_va_arg_expr (tree, tree, tree *, tree *);
+extern tree std_gimplify_va_arg_expr (tree, tree, gs_seq, gs_seq);
extern tree build_va_arg_indirect_ref (tree);
extern tree build_string_literal (int, const char *);
extern bool validate_arglist (tree, ...);
@@ -4611,7 +4611,7 @@ extern void push_function_context (void)
extern void pop_function_context (void);
extern void push_function_context_to (tree);
extern void pop_function_context_from (tree);
-extern tree gimplify_parameters (void);
+extern struct gs_sequence gimplify_parameters (void);
/* In print-rtl.c */
#ifdef BUFSIZ
Index: target.h
===================================================================
--- target.h (revision 124007)
+++ target.h (working copy)
@@ -638,8 +638,8 @@ struct gcc_target
tree (* build_builtin_va_list) (void);
/* Gimplifies a VA_ARG_EXPR. */
- tree (* gimplify_va_arg_expr) (tree valist, tree type, tree *pre_p,
- tree *post_p);
+ tree (* gimplify_va_arg_expr) (tree valist, tree type,
+ gs_seq pre_p, gs_seq post_p);
/* Validity-checking routines for PCH files, target-specific.
get_pch_validity returns a pointer to the data to be stored,
Index: builtins.c
===================================================================
--- builtins.c (revision 124007)
+++ builtins.c (working copy)
@@ -4657,7 +4657,7 @@ expand_builtin_va_start (tree exp)
current (padded) address and increment by the (padded) size. */
tree
-std_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
+std_gimplify_va_arg_expr (tree valist, tree type, gs_seq pre_p, gs_seq post_p)
{
tree addr, t, type_size, rounded_size, valist_tmp;
unsigned HOST_WIDE_INT align, boundary;
@@ -4713,7 +4713,8 @@ std_gimplify_va_arg_expr (tree valist, t
rounded_size = round_up (type_size, align);
/* Reduce rounded_size so it's sharable with the postqueue. */
- gimplify_expr (&rounded_size, pre_p, post_p, is_gimple_val, fb_rvalue);
+ gimplify_expr (&rounded_size, NULL, pre_p, post_p,
+ is_gimple_val, fb_rvalue);
/* Get AP. */
addr = valist_tmp;
@@ -4768,7 +4769,7 @@ dummy_object (tree type)
builtin function, but a very special sort of operator. */
enum gimplify_status
-gimplify_va_arg_expr (tree *expr_p, tree *pre_p, tree *post_p)
+gimplify_va_arg_expr (tree *expr_p, gs_seq pre_p, gs_seq post_p)
{
tree promoted_type, want_va_type, have_va_type;
tree valist = TREE_OPERAND (*expr_p, 0);
@@ -4825,7 +4826,7 @@ gimplify_va_arg_expr (tree *expr_p, tree
Call abort to encourage the user to fix the program. */
inform ("if this code is reached, the program will abort");
t = build_call_expr (implicit_built_in_decls[BUILT_IN_TRAP], 0);
- append_to_statement_list (t, pre_p);
+ gimplify_and_add (t, pre_p);
/* This is dead code, but go ahead and finish so that the
mode of the result comes out right. */
@@ -4847,10 +4848,12 @@ gimplify_va_arg_expr (tree *expr_p, tree
tree p1 = build_pointer_type (TREE_TYPE (va_list_type_node));
valist = build_fold_addr_expr_with_type (valist, p1);
}
- gimplify_expr (&valist, pre_p, post_p, is_gimple_val, fb_rvalue);
+ gimplify_expr (&valist, NULL, pre_p, post_p,
+ is_gimple_val, fb_rvalue);
}
else
- gimplify_expr (&valist, pre_p, post_p, is_gimple_min_lval, fb_lvalue);
+ gimplify_expr (&valist, NULL, pre_p, post_p,
+ is_gimple_min_lval, fb_lvalue);
if (!targetm.gimplify_va_arg_expr)
/* FIXME:Once most targets are converted we should merely