aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/utils2.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2007-02-16 23:40:52 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2007-02-16 23:40:52 +0000
commit9f3432b8a677aa18c1e12cdd9604f533b0745e2c (patch)
treef2b1452445646bd9dfaa1a7a6c7e058bcdedd189 /gcc/ada/utils2.c
parent599b39ce9dcaba10e1c53934e50cca5f671a7f6e (diff)
downloadgcc-9f3432b8a677aa18c1e12cdd9604f533b0745e2c.zip
gcc-9f3432b8a677aa18c1e12cdd9604f533b0745e2c.tar.gz
gcc-9f3432b8a677aa18c1e12cdd9604f533b0745e2c.tar.bz2
trans.c (call_to_gnu): Use build_call_list instead of build3 to build the call expression.
* trans.c (call_to_gnu): Use build_call_list instead of build3 to build the call expression. (gnat_stabilize_reference_1): Handle tcc_vl_exp. * utils.c (max_size) <tcc_exceptional>: Delete. <tcc_vl_exp>: New case. <tcc_expression>: Delete CALL_EXPR subcase. (build_global_cdtor): Use build_call_nary instead of build3. * utils2.c (build_call_1_expr): Likewise. (build_call_2_expr): Likewise. (build_call_0_expr): Likewise. (build_call_alloc_dealloc): Likewise. Co-Authored-By: Sandra Loosemore <sandra@codesourcery.com> From-SVN: r122058
Diffstat (limited to 'gcc/ada/utils2.c')
-rw-r--r--gcc/ada/utils2.c78
1 files changed, 28 insertions, 50 deletions
diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c
index e987fa9..31b0c6d 100644
--- a/gcc/ada/utils2.c
+++ b/gcc/ada/utils2.c
@@ -1394,13 +1394,10 @@ build_return_expr (tree result_decl, tree ret_val)
tree
build_call_1_expr (tree fundecl, tree arg)
{
- tree call = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fundecl)),
- build_unary_op (ADDR_EXPR, NULL_TREE, fundecl),
- chainon (NULL_TREE, build_tree_list (NULL_TREE, arg)),
- NULL_TREE);
-
+ tree call = build_call_nary (TREE_TYPE (TREE_TYPE (fundecl)),
+ build_unary_op (ADDR_EXPR, NULL_TREE, fundecl),
+ 1, arg);
TREE_SIDE_EFFECTS (call) = 1;
-
return call;
}
@@ -1410,15 +1407,10 @@ build_call_1_expr (tree fundecl, tree arg)
tree
build_call_2_expr (tree fundecl, tree arg1, tree arg2)
{
- tree call = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fundecl)),
- build_unary_op (ADDR_EXPR, NULL_TREE, fundecl),
- chainon (chainon (NULL_TREE,
- build_tree_list (NULL_TREE, arg1)),
- build_tree_list (NULL_TREE, arg2)),
- NULL_TREE);
-
+ tree call = build_call_nary (TREE_TYPE (TREE_TYPE (fundecl)),
+ build_unary_op (ADDR_EXPR, NULL_TREE, fundecl),
+ 2, arg1, arg2);
TREE_SIDE_EFFECTS (call) = 1;
-
return call;
}
@@ -1427,13 +1419,11 @@ build_call_2_expr (tree fundecl, tree arg1, tree arg2)
tree
build_call_0_expr (tree fundecl)
{
- tree call = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (fundecl)),
- build_unary_op (ADDR_EXPR, NULL_TREE, fundecl),
- NULL_TREE, NULL_TREE);
-
- /* We rely on build3 to compute TREE_SIDE_EFFECTS. This makes it possible
- to propagate the DECL_IS_PURE flag on parameterless functions. */
-
+ /* We rely on build_call_nary to compute TREE_SIDE_EFFECTS. This makes
+ it possible to propagate DECL_IS_PURE on parameterless functions. */
+ tree call = build_call_nary (TREE_TYPE (TREE_TYPE (fundecl)),
+ build_unary_op (ADDR_EXPR, NULL_TREE, fundecl),
+ 0);
return call;
}
@@ -1721,30 +1711,22 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align,
tree gnu_proc_addr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_proc);
tree gnu_pool = gnat_to_gnu (gnat_pool);
tree gnu_pool_addr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_pool);
- tree gnu_args = NULL_TREE;
tree gnu_call;
+ gnu_size = convert (gnu_size_type, gnu_size);
+ gnu_align = convert (gnu_size_type, gnu_align);
+
/* The first arg is always the address of the storage pool; next
comes the address of the object, for a deallocator, then the
size and alignment. */
- gnu_args
- = chainon (gnu_args, build_tree_list (NULL_TREE, gnu_pool_addr));
-
if (gnu_obj)
- gnu_args
- = chainon (gnu_args, build_tree_list (NULL_TREE, gnu_obj));
-
- gnu_args
- = chainon (gnu_args,
- build_tree_list (NULL_TREE,
- convert (gnu_size_type, gnu_size)));
- gnu_args
- = chainon (gnu_args,
- build_tree_list (NULL_TREE,
- convert (gnu_size_type, gnu_align)));
-
- gnu_call = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (gnu_proc)),
- gnu_proc_addr, gnu_args, NULL_TREE);
+ gnu_call = build_call_nary (TREE_TYPE (TREE_TYPE (gnu_proc)),
+ gnu_proc_addr, 4, gnu_pool_addr,
+ gnu_obj, gnu_size, gnu_align);
+ else
+ gnu_call = build_call_nary (TREE_TYPE (TREE_TYPE (gnu_proc)),
+ gnu_proc_addr, 3, gnu_pool_addr,
+ gnu_size, gnu_align);
TREE_SIDE_EFFECTS (gnu_call) = 1;
return gnu_call;
}
@@ -1758,22 +1740,18 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align,
tree gnu_size_type = gnat_to_gnu_type (gnat_size_type);
tree gnu_proc = gnat_to_gnu (gnat_proc);
tree gnu_proc_addr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_proc);
- tree gnu_args = NULL_TREE;
tree gnu_call;
+ gnu_size = convert (gnu_size_type, gnu_size);
+
/* The first arg is the address of the object, for a
deallocator, then the size */
if (gnu_obj)
- gnu_args
- = chainon (gnu_args, build_tree_list (NULL_TREE, gnu_obj));
-
- gnu_args
- = chainon (gnu_args,
- build_tree_list (NULL_TREE,
- convert (gnu_size_type, gnu_size)));
-
- gnu_call = build3 (CALL_EXPR, TREE_TYPE (TREE_TYPE (gnu_proc)),
- gnu_proc_addr, gnu_args, NULL_TREE);
+ gnu_call = build_call_nary (TREE_TYPE (TREE_TYPE (gnu_proc)),
+ gnu_proc_addr, 2, gnu_obj, gnu_size);
+ else
+ gnu_call = build_call_nary (TREE_TYPE (TREE_TYPE (gnu_proc)),
+ gnu_proc_addr, 1, gnu_size);
TREE_SIDE_EFFECTS (gnu_call) = 1;
return gnu_call;
}