summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-15 02:24:41 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-15 02:24:41 +0000
commit14ae0310f6eb334b3aaebf166802383cee797990 (patch)
treeebacdfeed0851e1d26ae03ca28fdcefe93df6304 /gcc
parent2ef0f9fa590ffb267b6ac9dcc55fdbc76edea9f3 (diff)
downloadgcc-14ae0310f6eb334b3aaebf166802383cee797990.tar.gz
* c-common.c (shorten_compare, pointer_int_sum,
c_common_truthvalue_conversion, boolean_increment): Replace calls to build with calls to buildN. * c-decl.c (complete_array_type, grokdeclarator): Likewise. * c-gimplify.c (c_build_bind_expr, gimplify_c_loop, gimplify_switch_stmt): Likewise. * c-typeck.c (default_function_array_conversion, build_component_ref, build_array_ref, build_function_call, pointer_diff, build_unary_op, build_conditional_expr, build_compound_expr, build_modify_expr, c_finish_goto_label, c_finish_goto_ptr, c_finish_return, c_finish_loop, c_finish_bc_stmt, c_finish_stmt_expr, c_end_compound_stmt, build_binary_op): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86018 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/c-common.c38
-rw-r--r--gcc/c-decl.c12
-rw-r--r--gcc/c-gimplify.c8
-rw-r--r--gcc/c-typeck.c58
5 files changed, 76 insertions, 56 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 43756b22e97..4419c3c458a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,19 @@
+2004-08-14 Roger Sayle <roger@eyesopen.com>
+
+ * c-common.c (shorten_compare, pointer_int_sum,
+ c_common_truthvalue_conversion, boolean_increment): Replace calls
+ to build with calls to buildN.
+ * c-decl.c (complete_array_type, grokdeclarator): Likewise.
+ * c-gimplify.c (c_build_bind_expr, gimplify_c_loop,
+ gimplify_switch_stmt): Likewise.
+ * c-typeck.c (default_function_array_conversion,
+ build_component_ref, build_array_ref, build_function_call,
+ pointer_diff, build_unary_op, build_conditional_expr,
+ build_compound_expr, build_modify_expr, c_finish_goto_label,
+ c_finish_goto_ptr, c_finish_return, c_finish_loop,
+ c_finish_bc_stmt, c_finish_stmt_expr, c_end_compound_stmt,
+ build_binary_op): Likewise.
+
2004-08-15 Steven Bosscher <stevenb@suse.de>
* rtl.c (note_insn_name): Add NOTE_DISABLE_SCHED_OF_BLOCK.
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 1416871cdac..b4c914b4650 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -2114,7 +2114,7 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr,
{
/* Don't forget to evaluate PRIMOP0 if it has side effects. */
if (TREE_SIDE_EFFECTS (primop0))
- return build (COMPOUND_EXPR, TREE_TYPE (val), primop0, val);
+ return build2 (COMPOUND_EXPR, TREE_TYPE (val), primop0, val);
return val;
}
@@ -2198,8 +2198,8 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr,
{
/* Don't forget to evaluate PRIMOP0 if it has side effects. */
if (TREE_SIDE_EFFECTS (primop0))
- return build (COMPOUND_EXPR, TREE_TYPE (value),
- primop0, value);
+ return build2 (COMPOUND_EXPR, TREE_TYPE (value),
+ primop0, value);
return value;
}
}
@@ -2294,7 +2294,7 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
convert (TREE_TYPE (intop), size_exp), 1));
/* Create the sum or difference. */
- return fold (build (resultcode, result_type, ptrop, intop));
+ return fold (build2 (resultcode, result_type, ptrop, intop));
}
/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
@@ -2360,8 +2360,8 @@ c_common_truthvalue_conversion (tree expr)
break;
if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 0)))
- return build (COMPOUND_EXPR, truthvalue_type_node,
- TREE_OPERAND (expr, 0), truthvalue_true_node);
+ return build2 (COMPOUND_EXPR, truthvalue_type_node,
+ TREE_OPERAND (expr, 0), truthvalue_true_node);
else
return truthvalue_true_node;
}
@@ -2384,14 +2384,16 @@ c_common_truthvalue_conversion (tree expr)
/* These don't change whether an object is zero or nonzero, but
we can't ignore them if their second arg has side-effects. */
if (TREE_SIDE_EFFECTS (TREE_OPERAND (expr, 1)))
- return build (COMPOUND_EXPR, truthvalue_type_node, TREE_OPERAND (expr, 1),
- lang_hooks.truthvalue_conversion (TREE_OPERAND (expr, 0)));
+ return build2 (COMPOUND_EXPR, truthvalue_type_node,
+ TREE_OPERAND (expr, 1),
+ lang_hooks.truthvalue_conversion (TREE_OPERAND (expr, 0)));
else
return lang_hooks.truthvalue_conversion (TREE_OPERAND (expr, 0));
case COND_EXPR:
/* Distribute the conversion into the arms of a COND_EXPR. */
- return fold (build (COND_EXPR, truthvalue_type_node, TREE_OPERAND (expr, 0),
+ return fold (build3 (COND_EXPR, truthvalue_type_node,
+ TREE_OPERAND (expr, 0),
lang_hooks.truthvalue_conversion (TREE_OPERAND (expr, 1)),
lang_hooks.truthvalue_conversion (TREE_OPERAND (expr, 2))));
@@ -3855,22 +3857,24 @@ boolean_increment (enum tree_code code, tree arg)
switch (code)
{
case PREINCREMENT_EXPR:
- val = build (MODIFY_EXPR, TREE_TYPE (arg), arg, true_res);
+ val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg, true_res);
break;
case POSTINCREMENT_EXPR:
- val = build (MODIFY_EXPR, TREE_TYPE (arg), arg, true_res);
+ val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg, true_res);
arg = save_expr (arg);
- val = build (COMPOUND_EXPR, TREE_TYPE (arg), val, arg);
- val = build (COMPOUND_EXPR, TREE_TYPE (arg), arg, val);
+ val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), val, arg);
+ val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), arg, val);
break;
case PREDECREMENT_EXPR:
- val = build (MODIFY_EXPR, TREE_TYPE (arg), arg, invert_truthvalue (arg));
+ val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg,
+ invert_truthvalue (arg));
break;
case POSTDECREMENT_EXPR:
- val = build (MODIFY_EXPR, TREE_TYPE (arg), arg, invert_truthvalue (arg));
+ val = build2 (MODIFY_EXPR, TREE_TYPE (arg), arg,
+ invert_truthvalue (arg));
arg = save_expr (arg);
- val = build (COMPOUND_EXPR, TREE_TYPE (arg), val, arg);
- val = build (COMPOUND_EXPR, TREE_TYPE (arg), arg, val);
+ val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), val, arg);
+ val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), arg, val);
break;
default:
abort ();
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 82e42f04e66..696fec88f2c 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3072,7 +3072,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
&& STATEMENT_LIST_HAS_LABEL (cur_stmt_list))
{
tree bind;
- bind = build (BIND_EXPR, void_type_node, NULL, NULL, NULL);
+ bind = build3 (BIND_EXPR, void_type_node, NULL, NULL, NULL);
TREE_SIDE_EFFECTS (bind) = 1;
add_stmt (bind);
BIND_EXPR_BODY (bind) = push_stmt_list ();
@@ -3281,8 +3281,8 @@ complete_array_type (tree type, tree initial_value, int do_default)
if (TREE_PURPOSE (elts))
maxindex = TREE_PURPOSE (elts);
else
- maxindex = fold (build (PLUS_EXPR, integer_type_node,
- maxindex, integer_one_node));
+ maxindex = fold (build2 (PLUS_EXPR, integer_type_node,
+ maxindex, integer_one_node));
}
}
else
@@ -4103,9 +4103,9 @@ grokdeclarator (tree declarator, tree declspecs,
Do the calculation in index_type, so that if it is
a variable the computations will be done in the
proper mode. */
- itype = fold (build (MINUS_EXPR, index_type,
- convert (index_type, size),
- convert (index_type, size_one_node)));
+ itype = fold (build2 (MINUS_EXPR, index_type,
+ convert (index_type, size),
+ convert (index_type, size_one_node)));
/* If that overflowed, the array is too big.
??? While a size of INT_MAX+1 technically shouldn't
diff --git a/gcc/c-gimplify.c b/gcc/c-gimplify.c
index 0d92967ff7b..404ea71f0fc 100644
--- a/gcc/c-gimplify.c
+++ b/gcc/c-gimplify.c
@@ -196,7 +196,7 @@ c_build_bind_expr (tree block, tree body)
body = build_empty_stmt ();
if (decls || block)
{
- bind = build (BIND_EXPR, void_type_node, decls, body, block);
+ bind = build3 (BIND_EXPR, void_type_node, decls, body, block);
TREE_SIDE_EFFECTS (bind) = 1;
}
else
@@ -365,7 +365,7 @@ gimplify_c_loop (tree cond, tree body, tree incr, bool cond_is_first)
if (cond)
{
t = build_bc_goto (bc_break);
- exit = build (COND_EXPR, void_type_node, cond, exit, t);
+ exit = build3 (COND_EXPR, void_type_node, cond, exit, t);
exit = fold (exit);
gimplify_stmt (&exit);
}
@@ -456,8 +456,8 @@ gimplify_switch_stmt (tree *stmt_p)
if (!body)
body = build_empty_stmt ();
- *stmt_p = build (SWITCH_EXPR, SWITCH_TYPE (stmt), SWITCH_COND (stmt),
- body, NULL_TREE);
+ *stmt_p = build3 (SWITCH_EXPR, SWITCH_TYPE (stmt), SWITCH_COND (stmt),
+ body, NULL_TREE);
SET_EXPR_LOCATION (*stmt_p, stmt_locus);
gimplify_stmt (stmt_p);
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 44b30123c80..b8a15a00780 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -1217,8 +1217,8 @@ default_function_array_conversion (tree exp)
if (TREE_CODE (exp) == COMPOUND_EXPR)
{
tree op1 = default_conversion (TREE_OPERAND (exp, 1));
- return build (COMPOUND_EXPR, TREE_TYPE (op1),
- TREE_OPERAND (exp, 0), op1);
+ return build2 (COMPOUND_EXPR, TREE_TYPE (op1),
+ TREE_OPERAND (exp, 0), op1);
}
lvalue_array_p = !not_lvalue && lvalue_p (exp);
@@ -1456,8 +1456,8 @@ build_component_ref (tree datum, tree component)
case COMPOUND_EXPR:
{
tree value = build_component_ref (TREE_OPERAND (datum, 1), component);
- return build (COMPOUND_EXPR, TREE_TYPE (value),
- TREE_OPERAND (datum, 0), non_lvalue (value));
+ return build2 (COMPOUND_EXPR, TREE_TYPE (value),
+ TREE_OPERAND (datum, 0), non_lvalue (value));
}
default:
break;
@@ -1495,8 +1495,8 @@ build_component_ref (tree datum, tree component)
if (TREE_TYPE (subdatum) == error_mark_node)
return error_mark_node;
- ref = build (COMPONENT_REF, TREE_TYPE (subdatum), datum, subdatum,
- NULL_TREE);
+ ref = build3 (COMPONENT_REF, TREE_TYPE (subdatum), datum, subdatum,
+ NULL_TREE);
if (TREE_READONLY (datum) || TREE_READONLY (subdatum))
TREE_READONLY (ref) = 1;
if (TREE_THIS_VOLATILE (datum) || TREE_THIS_VOLATILE (subdatum))
@@ -1649,7 +1649,7 @@ build_array_ref (tree array, tree index)
}
type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (array)));
- rval = build (ARRAY_REF, type, array, index, NULL_TREE, NULL_TREE);
+ rval = build4 (ARRAY_REF, type, array, index, NULL_TREE, NULL_TREE);
/* Array ref is const/volatile if the array elements are
or if the array is. */
TREE_READONLY (rval)
@@ -1869,7 +1869,7 @@ build_function_call (tree function, tree params)
else
rhs = fold (build1 (NOP_EXPR, return_type, integer_zero_node));
- return build (COMPOUND_EXPR, return_type, trap, rhs);
+ return build2 (COMPOUND_EXPR, return_type, trap, rhs);
}
}
@@ -1883,8 +1883,8 @@ build_function_call (tree function, tree params)
check_function_arguments (TYPE_ATTRIBUTES (fntype), coerced_params);
- result = build (CALL_EXPR, TREE_TYPE (fntype),
- function, coerced_params, NULL_TREE);
+ result = build3 (CALL_EXPR, TREE_TYPE (fntype),
+ function, coerced_params, NULL_TREE);
TREE_SIDE_EFFECTS (result) = 1;
if (require_constant_value)
@@ -2246,7 +2246,7 @@ pointer_diff (tree op0, tree op1)
op1 = c_size_in_bytes (target_type);
/* Divide by the size, in easiest possible way. */
- return fold (build (EXACT_DIV_EXPR, restype, op0, convert (restype, op1)));
+ return fold (build2 (EXACT_DIV_EXPR, restype, op0, convert (restype, op1)));
}
/* Construct and perhaps optimize a tree representation
@@ -2395,8 +2395,8 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
arg = stabilize_reference (arg);
real = build_unary_op (REALPART_EXPR, arg, 1);
imag = build_unary_op (IMAGPART_EXPR, arg, 1);
- return build (COMPLEX_EXPR, TREE_TYPE (arg),
- build_unary_op (code, real, 1), imag);
+ return build2 (COMPLEX_EXPR, TREE_TYPE (arg),
+ build_unary_op (code, real, 1), imag);
}
/* Report invalid types. */
@@ -2466,7 +2466,7 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE)
val = boolean_increment (code, arg);
else
- val = build (code, TREE_TYPE (arg), arg, inc);
+ val = build2 (code, TREE_TYPE (arg), arg, inc);
TREE_SIDE_EFFECTS (val) = 1;
val = convert (result_type, val);
if (TREE_CODE (val) != code)
@@ -2535,9 +2535,9 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
return error_mark_node;
}
- addr = fold (build (PLUS_EXPR, argtype,
- convert (argtype, addr),
- convert (argtype, byte_position (field))));
+ addr = fold (build2 (PLUS_EXPR, argtype,
+ convert (argtype, addr),
+ convert (argtype, byte_position (field))));
}
else
addr = build1 (code, argtype, arg);
@@ -2867,7 +2867,7 @@ build_conditional_expr (tree ifexp, tree op1, tree op2)
if (TREE_CODE (ifexp) == INTEGER_CST)
return non_lvalue (integer_zerop (ifexp) ? op2 : op1);
- return fold (build (COND_EXPR, result_type, ifexp, op1, op2));
+ return fold (build3 (COND_EXPR, result_type, ifexp, op1, op2));
}
/* Return a compound expression that performs two expressions and
@@ -2901,7 +2901,7 @@ build_compound_expr (tree expr1, tree expr2)
else if (warn_unused_value)
warn_if_unused_value (expr1, input_location);
- return build (COMPOUND_EXPR, TREE_TYPE (expr2), expr1, expr2);
+ return build2 (COMPOUND_EXPR, TREE_TYPE (expr2), expr1, expr2);
}
/* Build an expression representing a cast to type TYPE of expression EXPR. */
@@ -3223,7 +3223,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
/* Scan operands */
- result = build (MODIFY_EXPR, lhstype, lhs, newrhs);
+ result = build2 (MODIFY_EXPR, lhstype, lhs, newrhs);
TREE_SIDE_EFFECTS (result) = 1;
/* If we got the LHS in a different type for storing in,
@@ -6217,7 +6217,7 @@ c_finish_goto_label (tree label)
return NULL_TREE;
TREE_USED (decl) = 1;
- return add_stmt (build (GOTO_EXPR, void_type_node, decl));
+ return add_stmt (build1 (GOTO_EXPR, void_type_node, decl));
}
/* Generate a computed goto statement to EXPR. */
@@ -6228,7 +6228,7 @@ c_finish_goto_ptr (tree expr)
if (pedantic)
pedwarn ("ISO C forbids `goto *expr;'");
expr = convert (ptr_type_node, expr);
- return add_stmt (build (GOTO_EXPR, void_type_node, expr));
+ return add_stmt (build1 (GOTO_EXPR, void_type_node, expr));
}
/* Generate a C `return' statement. RETVAL is the expression for what
@@ -6319,7 +6319,7 @@ c_finish_return (tree retval)
break;
}
- retval = build (MODIFY_EXPR, TREE_TYPE (res), res, t);
+ retval = build2 (MODIFY_EXPR, TREE_TYPE (res), res, t);
}
return add_stmt (build_stmt (RETURN_EXPR, retval));
@@ -6554,7 +6554,7 @@ c_finish_loop (location_t start_locus, tree cond, tree incr, tree body,
}
t = build_and_jump (&blab);
- exit = build (COND_EXPR, void_type_node, cond, exit, t);
+ exit = build3 (COND_EXPR, void_type_node, cond, exit, t);
exit = fold (exit);
if (cond_is_first)
SET_EXPR_LOCATION (exit, start_locus);
@@ -6595,7 +6595,7 @@ c_finish_bc_stmt (tree *label_p, bool is_break)
return NULL_TREE;
}
- return add_stmt (build (GOTO_EXPR, void_type_node, label));
+ return add_stmt (build1 (GOTO_EXPR, void_type_node, label));
}
/* A helper routine for c_process_expr_stmt and c_finish_stmt_expr. */
@@ -6760,10 +6760,10 @@ c_finish_stmt_expr (tree body)
&& TREE_TYPE (val) == TREE_TYPE (TREE_OPERAND (val, 0)))
val = TREE_OPERAND (val, 0);
- *last_p = build (MODIFY_EXPR, void_type_node, tmp, val);
+ *last_p = build2 (MODIFY_EXPR, void_type_node, tmp, val);
SET_EXPR_LOCUS (*last_p, EXPR_LOCUS (last));
- return build (TARGET_EXPR, type, tmp, body, NULL_TREE, NULL_TREE);
+ return build4 (TARGET_EXPR, type, tmp, body, NULL_TREE, NULL_TREE);
}
/* Begin and end compound statements. This is as simple as pushing
@@ -6802,7 +6802,7 @@ c_end_compound_stmt (tree stmt, bool do_scope)
&& STATEMENT_LIST_STMT_EXPR (cur_stmt_list)
&& TREE_CODE (stmt) != BIND_EXPR)
{
- stmt = build (BIND_EXPR, void_type_node, NULL, stmt, NULL);
+ stmt = build3 (BIND_EXPR, void_type_node, NULL, stmt, NULL);
TREE_SIDE_EFFECTS (stmt) = 1;
}
@@ -7553,7 +7553,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
build_type = result_type;
{
- tree result = build (resultcode, build_type, op0, op1);
+ tree result = build2 (resultcode, build_type, op0, op1);
/* Treat expressions in initializers specially as they can't trap. */
result = require_constant_value ? fold_initializer (result)