summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-26 21:21:34 +0000
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-26 21:21:34 +0000
commit49d00087091a73bd5ed4e29ea8afd093cac6c58f (patch)
tree2b44df571f1322c6e8919fb2cb0153a1b07bc292 /gcc
parentb5b8d5d10f38daca6cd6b592e4d63a5d809fbe82 (diff)
downloadgcc-49d00087091a73bd5ed4e29ea8afd093cac6c58f.tar.gz
* builtins.c, c-common.c, c-convert.c, c-decl.c, c-typeck.c,
convert.c, lambda-code.c, predict.c, tree-cfg.c, tree-complex.c, tree-data-ref.c, tree-if-conv.c, tree-mudflap.c, tree-scalar-evolution.c, tree-ssa-ccp.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-manip.c, tree-ssa-phiopt.c, tree-ssa-pre.c, tree-vect-analyze.c, tree-vect-transform.c, tree-vectorizer.c, tree.c: Use fold_buildN instead of fold (buildN (...)). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101338 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/builtins.c150
-rw-r--r--gcc/c-common.c14
-rw-r--r--gcc/c-convert.c6
-rw-r--r--gcc/c-decl.c8
-rw-r--r--gcc/c-typeck.c8
-rw-r--r--gcc/convert.c50
-rw-r--r--gcc/lambda-code.c6
-rw-r--r--gcc/predict.c4
-rw-r--r--gcc/tree-cfg.c6
-rw-r--r--gcc/tree-complex.c2
-rw-r--r--gcc/tree-data-ref.c21
-rw-r--r--gcc/tree-if-conv.c4
-rw-r--r--gcc/tree-mudflap.c36
-rw-r--r--gcc/tree-scalar-evolution.c8
-rw-r--r--gcc/tree-ssa-ccp.c8
-rw-r--r--gcc/tree-ssa-loop-ivcanon.c10
-rw-r--r--gcc/tree-ssa-loop-ivopts.c14
-rw-r--r--gcc/tree-ssa-loop-manip.c4
-rw-r--r--gcc/tree-ssa-phiopt.c16
-rw-r--r--gcc/tree-ssa-pre.c12
-rw-r--r--gcc/tree-vect-analyze.c6
-rw-r--r--gcc/tree-vect-transform.c22
-rw-r--r--gcc/tree-vectorizer.c4
-rw-r--r--gcc/tree.c30
25 files changed, 234 insertions, 224 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4454822e1d0..305ab250f53 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -3,6 +3,15 @@
* cfg.c, tree-vect-transform.c, tree.def: Fix comment typos.
* doc/invoke.texi: Fix typos.
+ * builtins.c, c-common.c, c-convert.c, c-decl.c, c-typeck.c,
+ convert.c, lambda-code.c, predict.c, tree-cfg.c,
+ tree-complex.c, tree-data-ref.c, tree-if-conv.c,
+ tree-mudflap.c, tree-scalar-evolution.c, tree-ssa-ccp.c,
+ tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c,
+ tree-ssa-loop-manip.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
+ tree-vect-analyze.c, tree-vect-transform.c, tree-vectorizer.c,
+ tree.c: Use fold_buildN instead of fold (buildN (...)).
+
2005-06-26 Gerald Pfeifer <gerald@pfeifer.com>
* doc/install.texi (Specific): Do not specify the concrete
diff --git a/gcc/builtins.c b/gcc/builtins.c
index c56c7b17ec1..c966c0e0da3 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -3342,7 +3342,7 @@ expand_builtin_memset (tree arglist, rtx target, enum machine_mode mode,
&c, dest_align))
return 0;
- val = fold (build1 (CONVERT_EXPR, unsigned_char_type_node, val));
+ val = fold_build1 (CONVERT_EXPR, unsigned_char_type_node, val);
val_rtx = expand_expr (val, NULL_RTX, VOIDmode, 0);
val_rtx = force_reg (TYPE_MODE (unsigned_char_type_node),
val_rtx);
@@ -3727,8 +3727,8 @@ expand_builtin_strncmp (tree exp, rtx target, enum machine_mode mode)
return 0;
/* The actual new length parameter is MIN(len,arg3). */
- len = fold (build2 (MIN_EXPR, TREE_TYPE (len), len,
- fold_convert (TREE_TYPE (len), arg3)));
+ len = fold_build2 (MIN_EXPR, TREE_TYPE (len), len,
+ fold_convert (TREE_TYPE (len), arg3));
/* If we don't have POINTER_TYPE, call the function. */
if (arg1_align == 0 || arg2_align == 0)
@@ -3825,7 +3825,7 @@ expand_builtin_strcat (tree arglist, tree type, rtx target, enum machine_mode mo
dst)));
/* Create (dst + (cast) strlen (dst)). */
newdst = fold_convert (TREE_TYPE (dst), newdst);
- newdst = fold (build2 (PLUS_EXPR, TREE_TYPE (dst), dst, newdst));
+ newdst = fold_build2 (PLUS_EXPR, TREE_TYPE (dst), dst, newdst);
/* Prepend the new dst argument. */
arglist = tree_cons (NULL_TREE, newdst, arglist);
@@ -4009,7 +4009,7 @@ stabilize_va_list (tree valist, int needs_lvalue)
return valist;
pt = build_pointer_type (va_list_type_node);
- valist = fold (build1 (ADDR_EXPR, pt, valist));
+ valist = fold_build1 (ADDR_EXPR, pt, valist);
TREE_SIDE_EFFECTS (valist) = 1;
}
@@ -4141,11 +4141,11 @@ std_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
if (PAD_VARARGS_DOWN && !integer_zerop (rounded_size))
{
/* Small args are padded downward. */
- t = fold (build2 (GT_EXPR, sizetype, rounded_size, size_int (align)));
- t = fold (build3 (COND_EXPR, sizetype, t, size_zero_node,
- size_binop (MINUS_EXPR, rounded_size, type_size)));
+ t = fold_build2 (GT_EXPR, sizetype, rounded_size, size_int (align));
+ t = fold_build3 (COND_EXPR, sizetype, t, size_zero_node,
+ size_binop (MINUS_EXPR, rounded_size, type_size));
t = fold_convert (TREE_TYPE (addr), t);
- addr = fold (build2 (PLUS_EXPR, TREE_TYPE (addr), addr, t));
+ addr = fold_build2 (PLUS_EXPR, TREE_TYPE (addr), addr, t);
}
/* Compute new value for AP. */
@@ -5129,8 +5129,8 @@ expand_builtin_signbit (tree exp, rtx target)
if (fmt->has_signed_zero && HONOR_SIGNED_ZEROS (fmode))
return 0;
- arg = fold (build2 (LT_EXPR, TREE_TYPE (exp), arg,
- build_real (TREE_TYPE (arg), dconst0)));
+ arg = fold_build2 (LT_EXPR, TREE_TYPE (exp), arg,
+ build_real (TREE_TYPE (arg), dconst0));
return expand_expr (arg, target, VOIDmode, EXPAND_NORMAL);
}
@@ -6626,7 +6626,7 @@ fold_fixed_mathfn (tree fndecl, tree arglist)
/* If argument is already integer valued, and we don't need to worry
about setting errno, there's no need to perform rounding. */
if (! flag_errno_math && integer_valued_real_p (arg))
- return fold (build1 (FIX_TRUNC_EXPR, TREE_TYPE (TREE_TYPE (fndecl)), arg));
+ return fold_build1 (FIX_TRUNC_EXPR, TREE_TYPE (TREE_TYPE (fndecl)), arg);
if (optimize)
{
@@ -6687,10 +6687,10 @@ fold_builtin_cabs (tree arglist, tree type)
/* If either part is zero, cabs is fabs of the other. */
if (TREE_CODE (arg) == COMPLEX_EXPR
&& real_zerop (TREE_OPERAND (arg, 0)))
- return fold (build1 (ABS_EXPR, type, TREE_OPERAND (arg, 1)));
+ return fold_build1 (ABS_EXPR, type, TREE_OPERAND (arg, 1));
if (TREE_CODE (arg) == COMPLEX_EXPR
&& real_zerop (TREE_OPERAND (arg, 1)))
- return fold (build1 (ABS_EXPR, type, TREE_OPERAND (arg, 0)));
+ return fold_build1 (ABS_EXPR, type, TREE_OPERAND (arg, 0));
/* Don't do this when optimizing for size. */
if (flag_unsafe_math_optimizations
@@ -6704,17 +6704,17 @@ fold_builtin_cabs (tree arglist, tree type)
arg = builtin_save_expr (arg);
- rpart = fold (build1 (REALPART_EXPR, type, arg));
- ipart = fold (build1 (IMAGPART_EXPR, type, arg));
+ rpart = fold_build1 (REALPART_EXPR, type, arg);
+ ipart = fold_build1 (IMAGPART_EXPR, type, arg);
rpart = builtin_save_expr (rpart);
ipart = builtin_save_expr (ipart);
- result = fold (build2 (PLUS_EXPR, type,
- fold (build2 (MULT_EXPR, type,
- rpart, rpart)),
- fold (build2 (MULT_EXPR, type,
- ipart, ipart))));
+ result = fold_build2 (PLUS_EXPR, type,
+ fold_build2 (MULT_EXPR, type,
+ rpart, rpart),
+ fold_build2 (MULT_EXPR, type,
+ ipart, ipart));
arglist = build_tree_list (NULL_TREE, result);
return build_function_call_expr (sqrtfn, arglist);
@@ -6754,9 +6754,9 @@ fold_builtin_sqrt (tree arglist, tree type)
if (flag_unsafe_math_optimizations && BUILTIN_EXPONENT_P (fcode))
{
tree expfn = TREE_OPERAND (TREE_OPERAND (arg, 0), 0);
- arg = fold (build2 (MULT_EXPR, type,
- TREE_VALUE (TREE_OPERAND (arg, 1)),
- build_real (type, dconsthalf)));
+ arg = fold_build2 (MULT_EXPR, type,
+ TREE_VALUE (TREE_OPERAND (arg, 1)),
+ build_real (type, dconsthalf));
arglist = build_tree_list (NULL_TREE, arg);
return build_function_call_expr (expfn, arglist);
}
@@ -6796,8 +6796,8 @@ fold_builtin_sqrt (tree arglist, tree type)
tree narg1;
if (!tree_expr_nonnegative_p (arg0))
arg0 = build1 (ABS_EXPR, type, arg0);
- narg1 = fold (build2 (MULT_EXPR, type, arg1,
- build_real (type, dconsthalf)));
+ narg1 = fold_build2 (MULT_EXPR, type, arg1,
+ build_real (type, dconsthalf));
arglist = tree_cons (NULL_TREE, arg0,
build_tree_list (NULL_TREE, narg1));
return build_function_call_expr (powfn, arglist);
@@ -6829,9 +6829,9 @@ fold_builtin_cbrt (tree arglist, tree type)
tree expfn = TREE_OPERAND (TREE_OPERAND (arg, 0), 0);
const REAL_VALUE_TYPE third_trunc =
real_value_truncate (TYPE_MODE (type), dconstthird);
- arg = fold (build2 (MULT_EXPR, type,
- TREE_VALUE (TREE_OPERAND (arg, 1)),
- build_real (type, third_trunc)));
+ arg = fold_build2 (MULT_EXPR, type,
+ TREE_VALUE (TREE_OPERAND (arg, 1)),
+ build_real (type, third_trunc));
arglist = build_tree_list (NULL_TREE, arg);
return build_function_call_expr (expfn, arglist);
}
@@ -6890,8 +6890,8 @@ fold_builtin_cbrt (tree arglist, tree type)
tree powfn = TREE_OPERAND (TREE_OPERAND (arg, 0), 0);
const REAL_VALUE_TYPE dconstroot
= real_value_truncate (TYPE_MODE (type), dconstthird);
- tree narg01 = fold (build2 (MULT_EXPR, type, arg01,
- build_real (type, dconstroot)));
+ tree narg01 = fold_build2 (MULT_EXPR, type, arg01,
+ build_real (type, dconstroot));
arglist = tree_cons (NULL_TREE, arg00,
build_tree_list (NULL_TREE, narg01));
return build_function_call_expr (powfn, arglist);
@@ -7412,7 +7412,7 @@ fold_builtin_logarithm (tree fndecl, tree arglist,
tree logfn;
arglist = build_tree_list (NULL_TREE, x);
logfn = build_function_call_expr (fndecl, arglist);
- return fold (build2 (MULT_EXPR, type, exponent, logfn));
+ return fold_build2 (MULT_EXPR, type, exponent, logfn);
}
}
}
@@ -7455,8 +7455,8 @@ fold_builtin_pow (tree fndecl, tree arglist, tree type)
/* Optimize pow(x,-1.0) = 1.0/x. */
if (REAL_VALUES_EQUAL (c, dconstm1))
- return fold (build2 (RDIV_EXPR, type,
- build_real (type, dconst1), arg0));
+ return fold_build2 (RDIV_EXPR, type,
+ build_real (type, dconst1), arg0);
/* Optimize pow(x,0.5) = sqrt(x). */
if (flag_unsafe_math_optimizations
@@ -7512,7 +7512,7 @@ fold_builtin_pow (tree fndecl, tree arglist, tree type)
{
tree expfn = TREE_OPERAND (TREE_OPERAND (arg0, 0), 0);
tree arg = TREE_VALUE (TREE_OPERAND (arg0, 1));
- arg = fold (build2 (MULT_EXPR, type, arg, arg1));
+ arg = fold_build2 (MULT_EXPR, type, arg, arg1);
arglist = build_tree_list (NULL_TREE, arg);
return build_function_call_expr (expfn, arglist);
}
@@ -7521,8 +7521,8 @@ fold_builtin_pow (tree fndecl, tree arglist, tree type)
if (BUILTIN_SQRT_P (fcode))
{
tree narg0 = TREE_VALUE (TREE_OPERAND (arg0, 1));
- tree narg1 = fold (build2 (MULT_EXPR, type, arg1,
- build_real (type, dconsthalf)));
+ tree narg1 = fold_build2 (MULT_EXPR, type, arg1,
+ build_real (type, dconsthalf));
arglist = tree_cons (NULL_TREE, narg0,
build_tree_list (NULL_TREE, narg1));
@@ -7537,8 +7537,8 @@ fold_builtin_pow (tree fndecl, tree arglist, tree type)
{
const REAL_VALUE_TYPE dconstroot
= real_value_truncate (TYPE_MODE (type), dconstthird);
- tree narg1 = fold (build2 (MULT_EXPR, type, arg1,
- build_real (type, dconstroot)));
+ tree narg1 = fold_build2 (MULT_EXPR, type, arg1,
+ build_real (type, dconstroot));
arglist = tree_cons (NULL_TREE, arg,
build_tree_list (NULL_TREE, narg1));
return build_function_call_expr (fndecl, arglist);
@@ -7551,7 +7551,7 @@ fold_builtin_pow (tree fndecl, tree arglist, tree type)
{
tree arg00 = TREE_VALUE (TREE_OPERAND (arg0, 1));
tree arg01 = TREE_VALUE (TREE_CHAIN (TREE_OPERAND (arg0, 1)));
- tree narg1 = fold (build2 (MULT_EXPR, type, arg01, arg1));
+ tree narg1 = fold_build2 (MULT_EXPR, type, arg01, arg1);
arglist = tree_cons (NULL_TREE, arg00,
build_tree_list (NULL_TREE, narg1));
return build_function_call_expr (fndecl, arglist);
@@ -7601,8 +7601,8 @@ fold_builtin_powi (tree fndecl ATTRIBUTE_UNUSED, tree arglist, tree type)
/* Optimize pow(x,-1) = 1.0/x. */
if (c == -1)
- return fold (build2 (RDIV_EXPR, type,
- build_real (type, dconst1), arg0));
+ return fold_build2 (RDIV_EXPR, type,
+ build_real (type, dconst1), arg0);
}
return NULL_TREE;
@@ -7731,11 +7731,11 @@ fold_builtin_mempcpy (tree arglist, tree type, int endp)
return omit_one_operand (type, dest, len);
if (endp == 2)
- len = fold (build2 (MINUS_EXPR, TREE_TYPE (len), len,
- ssize_int (1)));
+ len = fold_build2 (MINUS_EXPR, TREE_TYPE (len), len,
+ ssize_int (1));
len = fold_convert (TREE_TYPE (dest), len);
- len = fold (build2 (PLUS_EXPR, TREE_TYPE (dest), dest, len));
+ len = fold_build2 (PLUS_EXPR, TREE_TYPE (dest), dest, len);
return fold_convert (type, len);
}
}
@@ -7919,7 +7919,7 @@ fold_builtin_memcmp (tree arglist)
build1 (INDIRECT_REF, cst_uchar_node,
fold_convert (cst_uchar_ptr_node,
arg2)));
- return fold (build2 (MINUS_EXPR, integer_type_node, ind1, ind2));
+ return fold_build2 (MINUS_EXPR, integer_type_node, ind1, ind2);
}
return 0;
@@ -7978,7 +7978,7 @@ fold_builtin_strcmp (tree arglist)
build1 (INDIRECT_REF, cst_uchar_node,
fold_convert (cst_uchar_ptr_node,
arg2)));
- return fold (build1 (NEGATE_EXPR, integer_type_node, temp));
+ return fold_build1 (NEGATE_EXPR, integer_type_node, temp);
}
return 0;
@@ -8050,7 +8050,7 @@ fold_builtin_strncmp (tree arglist)
build1 (INDIRECT_REF, cst_uchar_node,
fold_convert (cst_uchar_ptr_node,
arg2)));
- return fold (build1 (NEGATE_EXPR, integer_type_node, temp));
+ return fold_build1 (NEGATE_EXPR, integer_type_node, temp);
}
/* If len parameter is one, return an expression corresponding to
@@ -8067,7 +8067,7 @@ fold_builtin_strncmp (tree arglist)
build1 (INDIRECT_REF, cst_uchar_node,
fold_convert (cst_uchar_ptr_node,
arg2)));
- return fold (build2 (MINUS_EXPR, integer_type_node, ind1, ind2));
+ return fold_build2 (MINUS_EXPR, integer_type_node, ind1, ind2);
}
return 0;
@@ -8104,8 +8104,8 @@ fold_builtin_signbit (tree fndecl, tree arglist)
/* If ARG's format doesn't have signed zeros, return "arg < 0.0". */
if (!HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg))))
- return fold (build2 (LT_EXPR, type, arg,
- build_real (TREE_TYPE (arg), dconst0)));
+ return fold_build2 (LT_EXPR, type, arg,
+ build_real (TREE_TYPE (arg), dconst0));
return NULL_TREE;
}
@@ -8147,7 +8147,7 @@ fold_builtin_copysign (tree fndecl, tree arglist, tree type)
Remember to evaluate Y for side-effects. */
if (tree_expr_nonnegative_p (arg2))
return omit_one_operand (type,
- fold (build1 (ABS_EXPR, type, arg1)),
+ fold_build1 (ABS_EXPR, type, arg1),
arg2);
/* Strip sign changing operations for the first argument. */
@@ -8176,8 +8176,8 @@ fold_builtin_isascii (tree arglist)
arg = build2 (BIT_AND_EXPR, integer_type_node, arg,
build_int_cst (NULL_TREE,
~ (unsigned HOST_WIDE_INT) 0x7f));
- arg = fold (build2 (EQ_EXPR, integer_type_node,
- arg, integer_zero_node));
+ arg = fold_build2 (EQ_EXPR, integer_type_node,
+ arg, integer_zero_node);
if (in_gimple_form && !TREE_CONSTANT (arg))
return NULL_TREE;
@@ -8198,8 +8198,8 @@ fold_builtin_toascii (tree arglist)
/* Transform toascii(c) -> (c & 0x7f). */
tree arg = TREE_VALUE (arglist);
- return fold (build2 (BIT_AND_EXPR, integer_type_node, arg,
- build_int_cst (NULL_TREE, 0x7f)));
+ return fold_build2 (BIT_AND_EXPR, integer_type_node, arg,
+ build_int_cst (NULL_TREE, 0x7f));
}
}
@@ -8249,7 +8249,7 @@ fold_builtin_fabs (tree arglist, tree type)
arg = fold_convert (type, arg);
if (TREE_CODE (arg) == REAL_CST)
return fold_abs_const (arg, type);
- return fold (build1 (ABS_EXPR, type, arg));
+ return fold_build1 (ABS_EXPR, type, arg);
}
/* Fold a call to abs, labs, llabs or imaxabs. */
@@ -8266,7 +8266,7 @@ fold_builtin_abs (tree arglist, tree type)
arg = fold_convert (type, arg);
if (TREE_CODE (arg) == INTEGER_CST)
return fold_abs_const (arg, type);
- return fold (build1 (ABS_EXPR, type, arg));
+ return fold_build1 (ABS_EXPR, type, arg);
}
/* Fold a call to __builtin_isnan(), __builtin_isinf, __builtin_finite.
@@ -8346,7 +8346,7 @@ fold_builtin_classify (tree fndecl, tree arglist, int builtin_index)
}
arg = builtin_save_expr (arg);
- return fold (build2 (UNORDERED_EXPR, type, arg, arg));
+ return fold_build2 (UNORDERED_EXPR, type, arg, arg);
default:
gcc_unreachable ();
@@ -8421,13 +8421,13 @@ fold_builtin_unordered_cmp (tree fndecl, tree arglist,
{
if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg0))))
return omit_two_operands (type, integer_zero_node, arg0, arg1);
- return fold (build2 (UNORDERED_EXPR, type, arg0, arg1));
+ return fold_build2 (UNORDERED_EXPR, type, arg0, arg1);
}
code = MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg0))) ? unordered_code
: ordered_code;
- return fold (build1 (TRUTH_NOT_EXPR, type,
- fold (build2 (code, type, arg0, arg1))));
+ return fold_build1 (TRUTH_NOT_EXPR, type,
+ fold_build2 (code, type, arg0, arg1));
}
/* Used by constant folding to simplify calls to builtin functions. EXP is
@@ -8536,23 +8536,23 @@ fold_builtin_1 (tree fndecl, tree arglist, bool ignore)
case BUILT_IN_CONJF:
case BUILT_IN_CONJL:
if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE))
- return fold (build1 (CONJ_EXPR, type, TREE_VALUE (arglist)));
+ return fold_build1 (CONJ_EXPR, type, TREE_VALUE (arglist));
break;
case BUILT_IN_CREAL:
case BUILT_IN_CREALF:
case BUILT_IN_CREALL:
if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE))
- return non_lvalue (fold (build1 (REALPART_EXPR, type,
- TREE_VALUE (arglist))));
+ return non_lvalue (fold_build1 (REALPART_EXPR, type,
+ TREE_VALUE (arglist)));
break;
case BUILT_IN_CIMAG:
case BUILT_IN_CIMAGF:
case BUILT_IN_CIMAGL:
if (validate_arglist (arglist, COMPLEX_TYPE, VOID_TYPE))
- return non_lvalue (fold (build1 (IMAGPART_EXPR, type,
- TREE_VALUE (arglist))));
+ return non_lvalue (fold_build1 (IMAGPART_EXPR, type,
+ TREE_VALUE (arglist)));
break;
case BUILT_IN_CABS:
@@ -8961,8 +8961,8 @@ fold_builtin_strstr (tree arglist, tree type)
return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */
- tem = fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
- s1, build_int_cst (TREE_TYPE (s1), r - p1)));
+ tem = fold_build2 (PLUS_EXPR, TREE_TYPE (s1),
+ s1, build_int_cst (TREE_TYPE (s1), r - p1));
return fold_convert (type, tem);
}
@@ -9031,8 +9031,8 @@ fold_builtin_strchr (tree arglist, tree type)
return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */
- tem = fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
- s1, build_int_cst (TREE_TYPE (s1), r - p1)));
+ tem = fold_build2 (PLUS_EXPR, TREE_TYPE (s1),
+ s1, build_int_cst (TREE_TYPE (s1), r - p1));
return fold_convert (type, tem);
}
return 0;
@@ -9086,8 +9086,8 @@ fold_builtin_strrchr (tree arglist, tree type)
return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */
- tem = fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
- s1, build_int_cst (TREE_TYPE (s1), r - p1)));
+ tem = fold_build2 (PLUS_EXPR, TREE_TYPE (s1),
+ s1, build_int_cst (TREE_TYPE (s1), r - p1));
return fold_convert (type, tem);
}
@@ -9145,8 +9145,8 @@ fold_builtin_strpbrk (tree arglist, tree type)
return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */
- tem = fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
- s1, build_int_cst (TREE_TYPE (s1), r - p1)));
+ tem = fold_build2 (PLUS_EXPR, TREE_TYPE (s1),
+ s1, build_int_cst (TREE_TYPE (s1), r - p1));
return fold_convert (type, tem);
}
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 91fba5248ba..6b753dcb5d3 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1812,7 +1812,7 @@ min_precision (tree value, int unsignedp)
a bit-wise negation, so use that operation instead. */
if (tree_int_cst_sgn (value) < 0)
- value = fold (build1 (BIT_NOT_EXPR, TREE_TYPE (value), value));
+ value = fold_build1 (BIT_NOT_EXPR, TREE_TYPE (value), value);
/* Return the number of bits needed, taking into account the fact
that we need one more bit for a signed than unsigned type. */
@@ -2309,7 +2309,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 (build2 (resultcode, result_type, ptrop, intop));
+ return fold_build2 (resultcode, result_type, ptrop, intop);
}
/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
@@ -2425,10 +2425,10 @@ c_common_truthvalue_conversion (tree expr)
case COND_EXPR:
/* Distribute the conversion into the arms of a COND_EXPR. */
- return fold (build3 (COND_EXPR, truthvalue_type_node,
+ return fold_build3 (COND_EXPR, truthvalue_type_node,
TREE_OPERAND (expr, 0),
c_common_truthvalue_conversion (TREE_OPERAND (expr, 1)),
- c_common_truthvalue_conversion (TREE_OPERAND (expr, 2))));
+ c_common_truthvalue_conversion (TREE_OPERAND (expr, 2)));
case CONVERT_EXPR:
/* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE,
@@ -2837,7 +2837,7 @@ c_sizeof_or_alignof_type (tree type, bool is_sizeof, int complain)
TYPE_IS_SIZETYPE means that certain things (like overflow) will
never happen. However, this node should really have type
`size_t', which is just a typedef for an ordinary integer type. */
- value = fold (build1 (NOP_EXPR, size_type_node, value));
+ value = fold_build1 (NOP_EXPR, size_type_node, value);
gcc_assert (!TYPE_IS_SIZETYPE (TREE_TYPE (value)));
return value;
@@ -2887,7 +2887,7 @@ c_alignof_expr (tree expr)
else
return c_alignof (TREE_TYPE (expr));
- return fold (build1 (NOP_EXPR, size_type_node, t));
+ return fold_build1 (NOP_EXPR, size_type_node, t);
}
/* Handle C and C++ default attributes. */
@@ -5759,7 +5759,7 @@ fold_offsetof_1 (tree expr)
if (TREE_CODE (t) == INTEGER_CST && tree_int_cst_sgn (t) < 0)
{
code = MINUS_EXPR;
- t = fold (build1 (NEGATE_EXPR, TREE_TYPE (t), t));
+ t = fold_build1 (NEGATE_EXPR, TREE_TYPE (t), t);
}
t = convert (sizetype, t);
off = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (TREE_TYPE (expr)), t);
diff --git a/gcc/c-convert.c b/gcc/c-convert.c
index 718fd5abfb1..8b783838b1c 100644
--- a/gcc/c-convert.c
+++ b/gcc/c-convert.c
@@ -76,7 +76,7 @@ convert (tree type, tree expr)
return expr;
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr)))
- return fold (build1 (NOP_EXPR, type, expr));
+ return fold_build1 (NOP_EXPR, type, expr);
if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK)
return error_mark_node;
if (TREE_CODE (TREE_TYPE (expr)) == VOID_TYPE)
@@ -103,9 +103,9 @@ convert (tree type, tree expr)
/* If it returns a NOP_EXPR, we must fold it here to avoid
infinite recursion between fold () and convert (). */
if (TREE_CODE (t) == NOP_EXPR)
- return fold (build1 (NOP_EXPR, type, TREE_OPERAND (t, 0)));
+ return fold_build1 (NOP_EXPR, type, TREE_OPERAND (t, 0));
else
- return fold (build1 (NOP_EXPR, type, t));
+ return fold_build1 (NOP_EXPR, type, t);
}
if (code == POINTER_TYPE || code == REFERENCE_TYPE)
return fold (convert_to_pointer (type, e));
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 9ed4ade09b5..4d487926e5c 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -4180,10 +4180,10 @@ grokdeclarator (const struct c_declarator *declarator,
- 1. Do the calculation in index_type, so that
if it is a variable the computations will be
done in the proper mode. */
- itype = fold (build2 (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-typeck.c b/gcc/c-typeck.c
index 15b7e9bebe5..483beb8c7cf 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -2050,7 +2050,7 @@ build_function_call (tree function, tree params)
build_constructor (return_type,
NULL_TREE));
else
- rhs = fold (build1 (NOP_EXPR, return_type, integer_zero_node));
+ rhs = fold_build1 (NOP_EXPR, return_type, integer_zero_node);
return build2 (COMPOUND_EXPR, return_type, trap, rhs);
}
@@ -2477,7 +2477,7 @@ pointer_diff (tree op0, tree op1)
op1 = c_size_in_bytes (target_type);
/* Divide by the size, in easiest possible way. */
- return fold (build2 (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
@@ -2595,7 +2595,7 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
if (TREE_CODE (arg) == COMPLEX_CST)
return TREE_REALPART (arg);
else if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE)
- return fold (build1 (REALPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg));
+ return fold_build1 (REALPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg);
else
return arg;
@@ -2603,7 +2603,7 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
if (TREE_CODE (arg) == COMPLEX_CST)
return TREE_IMAGPART (arg);
else if (TREE_CODE (TREE_TYPE (arg)) == COMPLEX_TYPE)
- return fold (build1 (IMAGPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg));
+ return fold_build1 (IMAGPART_EXPR, TREE_TYPE (TREE_TYPE (arg)), arg);
else
return convert (TREE_TYPE (arg), integer_zero_node);
diff --git a/gcc/convert.c b/gcc/convert.c
index 79fdea0bf53..e3a94783f04 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -290,8 +290,8 @@ convert_to_real (tree type, tree expr)
case COMPLEX_TYPE:
return convert (type,
- fold (build1 (REALPART_EXPR,
- TREE_TYPE (TREE_TYPE (expr)), expr)));
+ fold_build1 (REALPART_EXPR,
+ TREE_TYPE (TREE_TYPE (expr)), expr));
case POINTER_TYPE:
case REFERENCE_TYPE:
@@ -607,9 +607,9 @@ convert_to_integer (tree type, tree expr)
else
typex = lang_hooks.types.signed_type (typex);
return convert (type,
- fold (build2 (ex_form, typex,
- convert (typex, arg0),
- convert (typex, arg1))));
+ fold_build2 (ex_form, typex,
+ convert (typex, arg0),
+ convert (typex, arg1)));
}
}
}
@@ -640,9 +640,9 @@ convert_to_integer (tree type, tree expr)
else
typex = lang_hooks.types.signed_type (typex);
return convert (type,
- fold (build1 (ex_form, typex,
- convert (typex,
- TREE_OPERAND (expr, 0)))));
+ fold_build1 (ex_form, typex,
+ convert (typex,
+ TREE_OPERAND (expr, 0))));
}
}
@@ -660,9 +660,9 @@ convert_to_integer (tree type, tree expr)
case COND_EXPR:
/* It is sometimes worthwhile to push the narrowing down through
the conditional and never loses. */
- return fold (build3 (COND_EXPR, type, TREE_OPERAND (expr, 0),
- convert (type, TREE_OPERAND (expr, 1)),
- convert (type, TREE_OPERAND (expr, 2))));
+ return fold_build3 (COND_EXPR, type, TREE_OPERAND (expr, 0),
+ convert (type, TREE_OPERAND (expr, 1)),
+ convert (type, TREE_OPERAND (expr, 2)));
default:
break;
@@ -675,8 +675,8 @@ convert_to_integer (tree type, tree expr)
case COMPLEX_TYPE:
return convert (type,
- fold (build1 (REALPART_EXPR,
- TREE_TYPE (TREE_TYPE (expr)), expr)));
+ fold_build1 (REALPART_EXPR,
+ TREE_TYPE (TREE_TYPE (expr)), expr));
case VECTOR_TYPE:
if (!tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (TREE_TYPE (expr))))
@@ -716,22 +716,22 @@ convert_to_complex (tree type, tree expr)
if (TYPE_MAIN_VARIANT (elt_type) == TYPE_MAIN_VARIANT (subtype))
return expr;
else if (TREE_CODE (expr) == COMPLEX_EXPR)
- return fold (build2 (COMPLEX_EXPR, type,
- convert (subtype, TREE_OPERAND (expr, 0)),
- convert (subtype, TREE_OPERAND (expr, 1))));
+ return fold_build2 (COMPLEX_EXPR, type,
+ convert (subtype, TREE_OPERAND (expr, 0)),
+ convert (subtype, TREE_OPERAND (expr, 1)));
else
{
expr = save_expr (expr);
return
- fold (build2 (COMPLEX_EXPR, type,
- convert (subtype,
- fold (build1 (REALPART_EXPR,
- TREE_TYPE (TREE_TYPE (expr)),
- expr))),
- convert (subtype,
- fold (build1 (IMAGPART_EXPR,
- TREE_TYPE (TREE_TYPE (expr)),
- expr)))));
+ fold_build2 (COMPLEX_EXPR, type,
+ convert (subtype,
+ fold_build1 (REALPART_EXPR,
+ TREE_TYPE (TREE_TYPE (expr)),
+ expr)),
+ convert (subtype,
+ fold_build1 (IMAGPART_EXPR,
+ TREE_TYPE (TREE_TYPE (expr)),
+ expr)));
}
}
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c
index 12431cb00ea..29b3e5ae708 100644
--- a/gcc/lambda-code.c
+++ b/gcc/lambda-code.c
@@ -1592,7 +1592,7 @@ lbv_to_gcc_expression (lambda_body_vector lbv,
/* newname = coefficient * induction_variable */
coeffmult = build_int_cst (type, LBV_COEFFICIENTS (lbv)[i]);
stmt = build (MODIFY_EXPR, void_type_node, resvar,
- fold (build (MULT_EXPR, type, iv, coeffmult)));
+ fold_build2 (MULT_EXPR, type, iv, coeffmult));
newname = make_ssa_name (resvar, stmt);
TREE_OPERAND (stmt, 0) = newname;
@@ -1694,7 +1694,7 @@ lle_to_gcc_expression (lambda_linear_expression lle,
{
coeff = build_int_cst (type,
LLE_COEFFICIENTS (lle)[i]);
- mult = fold (build (MULT_EXPR, type, iv, coeff));
+ mult = fold_build2 (MULT_EXPR, type, iv, coeff);
}
/* newname = mult */
@@ -1735,7 +1735,7 @@ lle_to_gcc_expression (lambda_linear_expression lle,
else
{
coeff = build_int_cst (type, invcoeff);
- mult = fold (build (MULT_EXPR, type, invar, coeff));
+ mult = fold_build2 (MULT_EXPR, type, invar, coeff);
}
/* newname = mult */
diff --git a/gcc/predict.c b/gcc/predict.c
index 792acb8ab14..305ada6c4f2 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -994,7 +994,7 @@ expr_expected_value (tree expr, bitmap visited)
op1 = expr_expected_value (TREE_OPERAND (expr, 1), visited);
if (!op1)
return NULL;
- res = fold (build (TREE_CODE (expr), TREE_TYPE (expr), op0, op1));
+ res = fold_build2 (TREE_CODE (expr), TREE_TYPE (expr), op0, op1);
if (TREE_CONSTANT (res))
return res;
return NULL;
@@ -1005,7 +1005,7 @@ expr_expected_value (tree expr, bitmap visited)
op0 = expr_expected_value (TREE_OPERAND (expr, 0), visited);
if (!op0)
return NULL;
- res = fold (build1 (TREE_CODE (expr), TREE_TYPE (expr), op0));
+ res = fold_build1 (TREE_CODE (expr), TREE_TYPE (expr), op0);
if (TREE_CONSTANT (res))
return res;
return NULL;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index ba40328542f..42dabb9a83e 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -4965,7 +4965,7 @@ gimplify_build3 (block_stmt_iterator *bsi, enum tree_code code,
{
tree ret;
- ret = fold (build3 (code, type, a, b, c));
+ ret = fold_build3 (code, type, a, b, c);
STRIP_NOPS (ret);
return gimplify_val (bsi, type, ret);
@@ -4980,7 +4980,7 @@ gimplify_build2 (block_stmt_iterator *bsi, enum tree_code code,
{
tree ret;
- ret = fold (build2 (code, type, a, b));
+ ret = fold_build2 (code, type, a, b);
STRIP_NOPS (ret);
return gimplify_val (bsi, type, ret);
@@ -4995,7 +4995,7 @@ gimplify_build1 (block_stmt_iterator *bsi, enum tree_code code, tree type,
{
tree ret;
- ret = fold (build1 (code, type, a));
+ ret = fold_build1 (code, type, a);
STRIP_NOPS (ret);
return gimplify_val (bsi, type, ret);
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 8938f5e9010..8be916ab94a 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -938,7 +938,7 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type,
/* Examine |br| < |bi|, and branch. */
t1 = gimplify_build1 (bsi, ABS_EXPR, inner_type, br);
t2 = gimplify_build1 (bsi, ABS_EXPR, inner_type, bi);
- cond = fold (build (LT_EXPR, boolean_type_node, t1, t2));
+ cond = fold_build2 (LT_EXPR, boolean_type_node, t1, t2);
STRIP_NOPS (cond);
bb_cond = bb_true = bb_false = bb_join = NULL;
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index dcc85f7af55..d48f020a495 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -190,7 +190,7 @@ tree_fold_divides_p (tree type,
{
/* Determines whether (A == gcd (A, B)). */
return integer_zerop
- (fold (build (MINUS_EXPR, type, a, tree_fold_gcd (a, b))));
+ (fold_build2 (MINUS_EXPR, type, a, tree_fold_gcd (a, b)));
}
/* Compute the greatest common denominator of two numbers using
@@ -487,17 +487,17 @@ estimate_niter_from_size_of_data (struct loop *loop,
|| TREE_CODE (element_size) != INTEGER_CST)
return;
- data_size = fold (build2 (EXACT_DIV_EXPR, integer_type_node,
- array_size, element_size));
+ data_size = fold_build2 (EXACT_DIV_EXPR, integer_type_node,
+ array_size, element_size);
if (init != NULL_TREE
&& step != NULL_TREE
&& TREE_CODE (init) == INTEGER_CST
&& TREE_CODE (step) == INTEGER_CST)
{
- estimation = fold (build2 (CEIL_DIV_EXPR, integer_type_node,
- fold (build2 (MINUS_EXPR, integer_type_node,
- data_size, init)), step));
+ estimation = fold_build2 (CEIL_DIV_EXPR, integer_type_node,
+ fold_build2 (MINUS_EXPR, integer_type_node,
+ data_size, init), step);
record_estimate (loop, estimation, boolean_true_node, stmt);
}
@@ -920,10 +920,11 @@ analyze_siv_subscript_cst_affine (tree chrec_a,
(integer_type_node, CHREC_RIGHT (chrec_b), difference))
{
*overlaps_a = integer_zero_node;
- *overlaps_b = fold
- (build (EXACT_DIV_EXPR, integer_type_node,
- fold (build1 (ABS_EXPR, integer_type_node, difference)),
- CHREC_RIGHT (chrec_b)));
+ *overlaps_b = fold_build2 (EXACT_DIV_EXPR, integer_type_node,
+ fold_build1 (ABS_EXPR,
+ integer_type_node,
+ difference),
+ CHREC_RIGHT (chrec_b));
*last_conflicts = integer_one_node;
return;
}
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 710fbb6e4f9..11f0ca10b7a 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -582,8 +582,8 @@ add_to_predicate_list (basic_block bb, tree new_cond)
tree cond = bb->aux;
if (cond)
- cond = fold (build (TRUTH_OR_EXPR, boolean_type_node,
- unshare_expr (cond), new_cond));
+ cond = fold_build2 (TRUTH_OR_EXPR, boolean_type_node,
+ unshare_expr (cond), new_cond);
else
cond = new_cond;
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index 748f9d35c4c..aa7c8fd2bc7 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -659,9 +659,9 @@ mf_build_check_statement_for (tree base, tree limit,
u = tree_cons (NULL_TREE, dirflag, u);
/* NB: we pass the overall [base..limit] range to mf_check. */
u = tree_cons (NULL_TREE,
- fold (build (PLUS_EXPR, integer_type_node,
- fold (build (MINUS_EXPR, mf_uintptr_type, mf_limit, mf_base)),
- integer_one_node)),
+ fold_build2 (PLUS_EXPR, integer_type_node,
+ fold_build2 (MINUS_EXPR, mf_uintptr_type, mf_limit, mf_base),
+ integer_one_node),
u);
u = tree_cons (NULL_TREE, mf_base, u);
t = build_function_call_expr (mf_check_fndecl, u);
@@ -812,27 +812,27 @@ mf_xform_derefs_1 (block_stmt_iterator *iter, tree *tp,
if (elt)
elt = build1 (ADDR_EXPR, build_pointer_type TREE_TYPE (elt), elt);
addr = fold_convert (ptr_type_node, elt ? elt : base);
- addr = fold (build (PLUS_EXPR, ptr_type_node,
- addr, fold_convert (ptr_type_node,
- byte_position (field))));
+ addr = fold_build2 (PLUS_EXPR, ptr_type_node,
+ addr, fold_convert (ptr_type_node,
+ byte_position (field)));
}
else
addr = build1 (ADDR_EXPR, build_pointer_type (type), t);
- limit = fold (build (MINUS_EXPR, mf_uintptr_type,
- fold (build2 (PLUS_EXPR, mf_uintptr_type,
- convert (mf_uintptr_type, addr),
- size)),
- integer_one_node));
+ limit = fold_build2 (MINUS_EXPR, mf_uintptr_type,
+ fold_build2 (PLUS_EXPR, mf_uintptr_type,
+ convert (mf_uintptr_type, addr),
+ size),
+ integer_one_node);
}
break;
case INDIRECT_REF:
addr = TREE_OPERAND (t, 0);
base = addr;
- limit = fold (build (MINUS_EXPR, ptr_type_node,
- fold (build (PLUS_EXPR, ptr_type_node, base, size)),
- integer_one_node));
+ limit = fold_build2 (MINUS_EXPR, ptr_type_node,
+ fold_build2 (PLUS_EXPR, ptr_type_node, base, size),
+ integer_one_node);
break;
case TARGET_MEM_REF:
@@ -869,12 +869,12 @@ mf_xform_derefs_1 (block_stmt_iterator *iter, tree *tp,
addr = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
addr = convert (ptr_type_node, addr);
- addr = fold (build (PLUS_EXPR, ptr_type_node, addr, ofs));
+ addr = fold_build2 (PLUS_EXPR, ptr_type_node, addr, ofs);
base = addr;
- limit = fold (build (MINUS_EXPR, ptr_type_node,
- fold (build (PLUS_EXPR, ptr_type_node, base, size)),
- integer_one_node));
+ limit = fold_build2 (MINUS_EXPR, ptr_type_node,
+ fold_build2 (PLUS_EXPR, ptr_type_node, base, size),
+ integer_one_node);
}
break;
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index 120a2b43877..2470cc1b51b 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -2109,8 +2109,8 @@ instantiate_parameters_1 (struct loop *loop, tree chrec,
&& op2 == TREE_OPERAND (chrec, 2))
return chrec;
- return fold (build (TREE_CODE (chrec),
- TREE_TYPE (chrec), op0, op1, op2));
+ return fold_build3 (TREE_CODE (chrec),
+ TREE_TYPE (chrec), op0, op1, op2);
case 2:
op0 = instantiate_parameters_1 (loop, TREE_OPERAND (chrec, 0),
@@ -2126,7 +2126,7 @@ instantiate_parameters_1 (struct loop *loop, tree chrec,
if (op0 == TREE_OPERAND (chrec, 0)
&& op1 == TREE_OPERAND (chrec, 1))
return chrec;
- return fold (build (TREE_CODE (chrec), TREE_TYPE (chrec), op0, op1));
+ return fold_build2 (TREE_CODE (chrec), TREE_TYPE (chrec), op0, op1);
case 1:
op0 = instantiate_parameters_1 (loop, TREE_OPERAND (chrec, 0),
@@ -2135,7 +2135,7 @@ instantiate_parameters_1 (struct loop *loop, tree chrec,
return chrec_dont_know;
if (op0 == TREE_OPERAND (chrec, 0))
return chrec;
- return fold (build1 (TREE_CODE (chrec), TREE_TYPE (chrec), op0));
+ return fold_build1 (TREE_CODE (chrec), TREE_TYPE (chrec), op0);
case 0:
return chrec;
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index cb2314b0a84..71385ddeffd 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1145,9 +1145,9 @@ visit_assignment (tree stmt, tree *output_p)
if (TREE_CODE (orig_lhs) == VIEW_CONVERT_EXPR
&& val.lattice_val == CONSTANT)
{
- tree w = fold (build1 (VIEW_CONVERT_EXPR,
- TREE_TYPE (TREE_OPERAND (orig_lhs, 0)),
- val.value));
+ tree w = fold_build1 (VIEW_CONVERT_EXPR,
+ TREE_TYPE (TREE_OPERAND (orig_lhs, 0)),
+ val.value);
orig_lhs = TREE_OPERAND (orig_lhs, 0);
if (w && is_gimple_min_invariant (w))
@@ -1855,7 +1855,7 @@ maybe_fold_stmt_addition (tree expr)
{
if (TYPE_UNSIGNED (TREE_TYPE (op1)))
return NULL;
- op1 = fold (build1 (NEGATE_EXPR, TREE_TYPE (op1), op1));
+ op1 = fold_build1 (NEGATE_EXPR, TREE_TYPE (op1), op1);
/* ??? In theory fold should always produce another integer. */
if (TREE_CODE (op1) != INTEGER_CST)
return NULL;
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 1a86ee76589..f4f44759f9b 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -95,9 +95,9 @@ create_canonical_iv (struct loop *loop, edge exit, tree niter)
with a modulo arithmetics. */
type = TREE_TYPE (niter);
- niter = fold (build2 (PLUS_EXPR, type,
- niter,
- build_int_cst (type, 1)));
+ niter = fold_build2 (PLUS_EXPR, type,
+ niter,
+ build_int_cst (type, 1));
incr_at = bsi_last (in->src);
create_iv (niter,
fold_convert (type, integer_minus_one_node),
@@ -275,8 +275,8 @@ canonicalize_loop_induction_variables (struct loops *loops, struct loop *loop,
/* The result of number_of_iterations_in_loop is by one higher than
we expect (i.e. it returns number of executions of the exit
condition, not of the loop latch edge). */
- niter = fold (build2 (MINUS_EXPR, TREE_TYPE (niter), niter,
- build_int_cst (TREE_TYPE (niter), 1)));
+ niter = fold_build2 (MINUS_EXPR, TREE_TYPE (niter), niter,
+ build_int_cst (TREE_TYPE (niter), 1));
}
else
{
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 5ef9c241b66..acc1ae9c4f0 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -3053,7 +3053,7 @@ get_computation_aff (struct loop *loop,
/* We may need to shift the value if we are after the increment. */
if (stmt_after_increment (loop, cand, at))
- cbase = fold (build2 (PLUS_EXPR, uutype, cbase, cstep));
+ cbase = fold_build2 (PLUS_EXPR, uutype, cbase, cstep);
/* use = ubase - ratio * cbase + ratio * var.
@@ -3913,9 +3913,9 @@ iv_value (struct iv *iv, tree niter)
tree type = TREE_TYPE (iv->base);
niter = fold_convert (type, niter);
- val = fold (build2 (MULT_EXPR, type, iv->step, niter));
+ val = fold_build2 (MULT_EXPR, type, iv->step, niter);
- return fold (build2 (PLUS_EXPR, type, iv->base, val));
+ return fold_build2 (PLUS_EXPR, type, iv->base, val);
}
/* Computes value of candidate CAND at position AT in iteration NITER. */
@@ -3927,7 +3927,7 @@ cand_value_at (struct loop *loop, struct iv_cand *cand, tree at, tree niter)
tree type = TREE_TYPE (cand->iv->base);
if (stmt_after_increment (loop, cand, at))
- val = fold (build2 (PLUS_EXPR, type, val, cand->iv->step));
+ val = fold_build2 (PLUS_EXPR, type, val, cand->iv->step);
return val;
}
@@ -4026,9 +4026,9 @@ may_eliminate_iv (struct ivopts_data *data,
else
wider_type = nit_type;
- if (!integer_nonzerop (fold (build2 (GE_EXPR, boolean_type_node,
- fold_convert (wider_type, period),
- fold_convert (wider_type, nit)))))
+ if (!integer_nonzerop (fold_build2 (GE_EXPR, boolean_type_node,
+ fold_convert (wider_type, period),
+ fold_convert (wider_type, nit))))
return false;
*bound = cand_value_at (loop, cand, use->stmt, nit);
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index bbee7e65edf..cbd03b73061 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -75,7 +75,7 @@ create_iv (tree base, tree step, tree var, struct loop *loop,
{
if (TYPE_UNSIGNED (TREE_TYPE (step)))
{
- step1 = fold (build1 (NEGATE_EXPR, TREE_TYPE (step), step));
+ step1 = fold_build1 (NEGATE_EXPR, TREE_TYPE (step), step);
if (tree_int_cst_lt (step1, step))
{
incr_op = MINUS_EXPR;
@@ -88,7 +88,7 @@ create_iv (tree base, tree step, tree var, struct loop *loop,
&& may_negate_without_overflow_p (step))
{
incr_op = MINUS_EXPR;
- step = fold (build1 (NEGATE_EXPR, TREE_TYPE (step), step));
+ step = fold_build1 (NEGATE_EXPR, TREE_TYPE (step), step);
}
}
}
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index e7d048f5387..2f859486691 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -724,8 +724,8 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
return false;
/* We need BOUND <= LARGER. */
- if (!integer_nonzerop (fold (build2 (LE_EXPR, boolean_type_node,
- bound, larger))))
+ if (!integer_nonzerop (fold_build2 (LE_EXPR, boolean_type_node,
+ bound, larger)))
return false;
}
else if (operand_equal_for_phi_arg_p (arg_false, smaller))
@@ -749,8 +749,8 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
return false;
/* We need BOUND >= SMALLER. */
- if (!integer_nonzerop (fold (build2 (GE_EXPR, boolean_type_node,
- bound, smaller))))
+ if (!integer_nonzerop (fold_build2 (GE_EXPR, boolean_type_node,
+ bound, smaller)))
return false;
}
else
@@ -783,8 +783,8 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
return false;
/* We need BOUND >= LARGER. */
- if (!integer_nonzerop (fold (build2 (GE_EXPR, boolean_type_node,
- bound, larger))))
+ if (!integer_nonzerop (fold_build2 (GE_EXPR, boolean_type_node,
+ bound, larger)))
return false;
}
else if (operand_equal_for_phi_arg_p (arg_true, smaller))
@@ -808,8 +808,8 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
return false;
/* We need BOUND <= SMALLER. */
- if (!integer_nonzerop (fold (build2 (LE_EXPR, boolean_type_node,
- bound, smaller))))
+ if (!integer_nonzerop (fold_build2 (LE_EXPR, boolean_type_node,
+ bound, smaller)))
return false;
}
else
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index bb194c10c51..eab18d34a16 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -1528,8 +1528,8 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts)
if (op2)
genop2 = find_or_generate_expression (block, op2, stmts);
- folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr),
- genop0, genarglist, genop2));
+ folded = fold_build3 (TREE_CODE (expr), TREE_TYPE (expr),
+ genop0, genarglist, genop2);
break;
@@ -1543,8 +1543,8 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts)
tree op2 = TREE_OPERAND (expr, 1);
tree genop1 = find_or_generate_expression (block, op1, stmts);
tree genop2 = find_or_generate_expression (block, op2, stmts);
- folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr),
- genop1, genop2));
+ folded = fold_build2 (TREE_CODE (expr), TREE_TYPE (expr),
+ genop1, genop2);
break;
}
@@ -1552,8 +1552,8 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts)
{
tree op1 = TREE_OPERAND (expr, 0);
tree genop1 = find_or_generate_expression (block, op1, stmts);
- folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr),
- genop1));
+ folded = fold_build1 (TREE_CODE (expr), TREE_TYPE (expr),
+ genop1);
break;
}
diff --git a/gcc/tree-vect-analyze.c b/gcc/tree-vect-analyze.c
index 9d4fc5d358b..f37b7311150 100644
--- a/gcc/tree-vect-analyze.c
+++ b/gcc/tree-vect-analyze.c
@@ -279,9 +279,9 @@ vect_analyze_offset_expr (tree expr,
/* Compute offset. */
*initial_offset = fold_convert (ssizetype,
- fold (build2 (code, TREE_TYPE (left_offset),
- left_offset,
- right_offset)));
+ fold_build2 (code, TREE_TYPE (left_offset),
+ left_offset,
+ right_offset));
return true;
}
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c
index 3ea602952d6..2de9ce63d2d 100644
--- a/gcc/tree-vect-transform.c
+++ b/gcc/tree-vect-transform.c
@@ -210,17 +210,17 @@ vect_create_addr_base_for_vector_ref (tree stmt,
{
tree tmp = create_tmp_var (TREE_TYPE (base_offset), "offset");
add_referenced_tmp_var (tmp);
- offset = fold (build2 (MULT_EXPR, TREE_TYPE (offset), offset,
- STMT_VINFO_VECT_STEP (stmt_info)));
- base_offset = fold (build2 (PLUS_EXPR, TREE_TYPE (base_offset),
- base_offset, offset));
+ offset = fold_build2 (MULT_EXPR, TREE_TYPE (offset), offset,
+ STMT_VINFO_VECT_STEP (stmt_info));
+ base_offset = fold_build2 (PLUS_EXPR, TREE_TYPE (base_offset),
+ base_offset, offset);
base_offset = force_gimple_operand (base_offset, &new_stmt, false, tmp);
append_to_statement_list_force (new_stmt, new_stmt_list);
}
/* base + base_offset */
- addr_base = fold (build2 (PLUS_EXPR, TREE_TYPE (data_ref_base), data_ref_base,
- base_offset));
+ addr_base = fold_build2 (PLUS_EXPR, TREE_TYPE (data_ref_base), data_ref_base,
+ base_offset);
/* addr_expr = addr_base */
addr_expr = vect_get_new_vect_var (scalar_ptr_type, vect_pointer_var,
@@ -2601,9 +2601,9 @@ vect_update_init_of_dr (struct data_reference *dr, tree niters)
stmt_vec_info stmt_info = vinfo_for_stmt (DR_STMT (dr));
tree offset = STMT_VINFO_VECT_INIT_OFFSET (stmt_info);
- niters = fold (build2 (MULT_EXPR, TREE_TYPE (niters), niters,
- STMT_VINFO_VECT_STEP (stmt_info)));
- offset = fold (build2 (PLUS_EXPR, TREE_TYPE (offset), offset, niters));
+ niters = fold_build2 (MULT_EXPR, TREE_TYPE (niters), niters,
+ STMT_VINFO_VECT_STEP (stmt_info));
+ offset = fold_build2 (PLUS_EXPR, TREE_TYPE (offset), offset, niters);
STMT_VINFO_VECT_INIT_OFFSET (stmt_info) = offset;
}
@@ -2675,8 +2675,8 @@ vect_do_peeling_for_alignment (loop_vec_info loop_vinfo, struct loops *loops)
/* Update number of times loop executes. */
n_iters = LOOP_VINFO_NITERS (loop_vinfo);
- LOOP_VINFO_NITERS (loop_vinfo) = fold (build2 (MINUS_EXPR,
- TREE_TYPE (n_iters), n_iters, niters_of_prolog_loop));
+ LOOP_VINFO_NITERS (loop_vinfo) = fold_build2 (MINUS_EXPR,
+ TREE_TYPE (n_iters), n_iters, niters_of_prolog_loop);
/* Update the init conditions of the access functions of all data refs. */
vect_update_inits_of_drs (loop_vinfo, niters_of_prolog_loop);
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 6ad78582182..cf16f66628a 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -1139,7 +1139,7 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop, struct loops *loops,
add_bb_to_loop (bb_before_second_loop, first_loop->outer);
pre_condition =
- fold (build2 (LE_EXPR, boolean_type_node, first_niters, integer_zero_node));
+ fold_build2 (LE_EXPR, boolean_type_node, first_niters, integer_zero_node);
skip_e = slpeel_add_loop_guard (bb_before_first_loop, pre_condition,
bb_before_second_loop, bb_before_first_loop);
slpeel_update_phi_nodes_for_guard1 (skip_e, first_loop,
@@ -1178,7 +1178,7 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop, struct loops *loops,
add_bb_to_loop (bb_after_second_loop, second_loop->outer);
pre_condition =
- fold (build2 (EQ_EXPR, boolean_type_node, first_niters, niters));
+ fold_build2 (EQ_EXPR, boolean_type_node, first_niters, niters);
skip_e = slpeel_add_loop_guard (bb_between_loops, pre_condition,
bb_after_second_loop, bb_before_first_loop);
slpeel_update_phi_nodes_for_guard2 (skip_e, second_loop,
diff --git a/gcc/tree.c b/gcc/tree.c
index c19e3cc43f5..e7565e2cd74 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1632,7 +1632,7 @@ array_type_nelts (tree type)
return (integer_zerop (min)
? max
- : fold (build2 (MINUS_EXPR, TREE_TYPE (max), max, min)));
+ : fold_build2 (MINUS_EXPR, TREE_TYPE (max), max, min));
}
/* If arg is static -- a reference to an object in static storage -- then
@@ -2053,8 +2053,8 @@ substitute_in_expr (tree exp, tree f, tree r)
if (op0 == TREE_OPERAND (exp, 0))
return exp;
- new = fold (build3 (COMPONENT_REF, TREE_TYPE (exp),
- op0, TREE_OPERAND (exp, 1), NULL_TREE));
+ new = fold_build3 (COMPONENT_REF, TREE_TYPE (exp),
+ op0, TREE_OPERAND (exp, 1), NULL_TREE);
}
else
switch (TREE_CODE_CLASS (code))
@@ -2079,7 +2079,7 @@ substitute_in_expr (tree exp, tree f, tree r)
if (op0 == TREE_OPERAND (exp, 0))
return exp;
- new = fold (build1 (code, TREE_TYPE (exp), op0));
+ new = fold_build1 (code, TREE_TYPE (exp), op0);
break;
case 2:
@@ -2089,7 +2089,7 @@ substitute_in_expr (tree exp, tree f, tree r)
if (op0 == TREE_OPERAND (exp, 0) && op1 == TREE_OPERAND (exp, 1))
return exp;
- new = fold (build2 (code, TREE_TYPE (exp), op0, op1));
+ new = fold_build2 (code, TREE_TYPE (exp), op0, op1);
break;
case 3:
@@ -2101,7 +2101,7 @@ substitute_in_expr (tree exp, tree f, tree r)
&& op2 == TREE_OPERAND (exp, 2))
return exp;
- new = fold (build3 (code, TREE_TYPE (exp), op0, op1, op2));
+ new = fold_build3 (code, TREE_TYPE (exp), op0, op1, op2);
break;
default:
@@ -2157,7 +2157,7 @@ substitute_placeholder_in_expr (tree exp, tree obj)
if (POINTER_TYPE_P (TREE_TYPE (elt))
&& (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (elt)))
== need_type))
- return fold (build1 (INDIRECT_REF, need_type, elt));
+ return fold_build1 (INDIRECT_REF, need_type, elt);
/* If we didn't find it, return the original PLACEHOLDER_EXPR. If it
survives until RTL generation, there will be an error. */
@@ -2199,7 +2199,7 @@ substitute_placeholder_in_expr (tree exp, tree obj)
if (op0 == TREE_OPERAND (exp, 0))
return exp;
else
- return fold (build1 (code, TREE_TYPE (exp), op0));
+ return fold_build1 (code, TREE_TYPE (exp), op0);
case 2:
op0 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (TREE_OPERAND (exp, 0), obj);
@@ -2208,7 +2208,7 @@ substitute_placeholder_in_expr (tree exp, tree obj)
if (op0 == TREE_OPERAND (exp, 0) && op1 == TREE_OPERAND (exp, 1))
return exp;
else
- return fold (build2 (code, TREE_TYPE (exp), op0, op1));
+ return fold_build2 (code, TREE_TYPE (exp), op0, op1);
case 3:
op0 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (TREE_OPERAND (exp, 0), obj);
@@ -2219,7 +2219,7 @@ substitute_placeholder_in_expr (tree exp, tree obj)
&& op2 == TREE_OPERAND (exp, 2))
return exp;
else
- return fold (build3 (code, TREE_TYPE (exp), op0, op1, op2));
+ return fold_build3 (code, TREE_TYPE (exp), op0, op1, op2);
case 4:
op0 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (TREE_OPERAND (exp, 0), obj);
@@ -6371,16 +6371,16 @@ tree_fold_gcd (tree a, tree b)
return a;
if (tree_int_cst_sgn (a) == -1)
- a = fold (build2 (MULT_EXPR, type, a,
- convert (type, integer_minus_one_node)));
+ a = fold_build2 (MULT_EXPR, type, a,
+ convert (type, integer_minus_one_node));
if (tree_int_cst_sgn (b) == -1)
- b = fold (build2 (MULT_EXPR, type, b,
- convert (type, integer_minus_one_node)));
+ b = fold_build2 (MULT_EXPR, type, b,
+ convert (type, integer_minus_one_node));
while (1)
{
- a_mod_b = fold (build2 (FLOOR_MOD_EXPR, type, a, b));
+ a_mod_b = fold_build2 (FLOOR_MOD_EXPR, type, a, b);
if (!TREE_INT_CST_LOW (a_mod_b)
&& !TREE_INT_CST_HIGH (a_mod_b))