aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-06-14 17:53:38 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2010-06-14 17:53:38 +0200
commitaa4936945e79262bad9152c984cadb387d342fb6 (patch)
tree91a5d9bb63c37b00e41718726e4713eb049e5990
parent8ab7d796d82889397ac6b74477be99fc5ee76831 (diff)
downloadgcc-aa4936945e79262bad9152c984cadb387d342fb6.zip
gcc-aa4936945e79262bad9152c984cadb387d342fb6.tar.gz
gcc-aa4936945e79262bad9152c984cadb387d342fb6.tar.bz2
re PR bootstrap/44426 (gcc 4.5.0 requires c9x compiler to build)
PR bootstrap/44426 * tree.h (build_call_expr): Don't define as vararg macro, instead add a prototype. * builtins.c (build_call_nofold): Remove. (expand_builtin_int_roundingfn, expand_builtin_pow, expand_builtin_mempcpy_args, expand_builtin_stpcpy, expand_builtin_memset_args, expand_builtin_strcmp, expand_builtin_strncmp, expand_builtin_memory_chk): Use build_call_nofold_loc instead of build_call_nofold. (build_call_expr): New function. From-SVN: r160754
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/builtins.c51
-rw-r--r--gcc/tree.h3
3 files changed, 50 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b7c8aec..8dc51e6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,16 @@
2010-06-14 Jakub Jelinek <jakub@redhat.com>
+ PR bootstrap/44426
+ * tree.h (build_call_expr): Don't define as vararg macro, instead
+ add a prototype.
+ * builtins.c (build_call_nofold): Remove.
+ (expand_builtin_int_roundingfn, expand_builtin_pow,
+ expand_builtin_mempcpy_args, expand_builtin_stpcpy,
+ expand_builtin_memset_args, expand_builtin_strcmp,
+ expand_builtin_strncmp, expand_builtin_memory_chk): Use
+ build_call_nofold_loc instead of build_call_nofold.
+ (build_call_expr): New function.
+
PR tree-optimization/44508
* tree-ssa-propagate.h (substitute_and_fold): Add DO_DCE
argument.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index e57449dd..35e8e252 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -2521,8 +2521,6 @@ build_call_nofold_loc (location_t loc, tree fndecl, int n, ...)
SET_EXPR_LOCATION (fn, loc);
return fn;
}
-#define build_call_nofold(...) \
- build_call_nofold_loc (UNKNOWN_LOCATION, __VA_ARGS__)
/* Expand a call to one of the builtin rounding functions gcc defines
as an extension (lfloor and lceil). As these are gcc extensions we
@@ -2640,7 +2638,7 @@ expand_builtin_int_roundingfn (tree exp, rtx target)
fallback_fndecl = build_fn_decl (name, fntype);
}
- exp = build_call_nofold (fallback_fndecl, 1, arg);
+ exp = build_call_nofold_loc (EXPR_LOCATION (exp), fallback_fndecl, 1, arg);
tmp = expand_normal (exp);
@@ -3085,7 +3083,8 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget)
&& (optab_handler (sqrt_optab, mode)->insn_code
!= CODE_FOR_nothing))))
{
- tree call_expr = build_call_nofold (fn, 1, narg0);
+ tree call_expr = build_call_nofold_loc (EXPR_LOCATION (exp), fn, 1,
+ narg0);
/* Use expand_expr in case the newly built call expression
was folded to a non-call. */
op = expand_expr (call_expr, subtarget, mode, EXPAND_NORMAL);
@@ -3137,7 +3136,8 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget)
&& powi_cost (n/3) <= POWI_MAX_MULTS)
|| n == 1))
{
- tree call_expr = build_call_nofold (fn, 1,narg0);
+ tree call_expr = build_call_nofold_loc (EXPR_LOCATION (exp), fn, 1,
+ narg0);
op = expand_builtin (call_expr, NULL_RTX, subtarget, mode, 0);
if (abs (n) % 3 == 2)
op = expand_simple_binop (mode, MULT, op, op, op,
@@ -3471,7 +3471,8 @@ expand_builtin_mempcpy_args (tree dest, tree src, tree len,
if (target == const0_rtx && implicit_built_in_decls[BUILT_IN_MEMCPY])
{
tree fn = implicit_built_in_decls[BUILT_IN_MEMCPY];
- tree result = build_call_nofold (fn, 3, dest, src, len);
+ tree result = build_call_nofold_loc (UNKNOWN_LOCATION, fn, 3,
+ dest, src, len);
return expand_expr (result, target, mode, EXPAND_NORMAL);
}
else
@@ -3652,7 +3653,7 @@ expand_builtin_stpcpy (tree exp, rtx target, enum machine_mode mode)
if (target == const0_rtx && implicit_built_in_decls[BUILT_IN_STRCPY])
{
tree fn = implicit_built_in_decls[BUILT_IN_STRCPY];
- tree result = build_call_nofold (fn, 2, dst, src);
+ tree result = build_call_nofold_loc (loc, fn, 2, dst, src);
return expand_expr (result, target, mode, EXPAND_NORMAL);
}
else
@@ -3955,9 +3956,11 @@ expand_builtin_memset_args (tree dest, tree val, tree len,
fndecl = get_callee_fndecl (orig_exp);
fcode = DECL_FUNCTION_CODE (fndecl);
if (fcode == BUILT_IN_MEMSET)
- fn = build_call_nofold (fndecl, 3, dest, val, len);
+ fn = build_call_nofold_loc (EXPR_LOCATION (orig_exp), fndecl, 3,
+ dest, val, len);
else if (fcode == BUILT_IN_BZERO)
- fn = build_call_nofold (fndecl, 2, dest, len);
+ fn = build_call_nofold_loc (EXPR_LOCATION (orig_exp), fndecl, 2,
+ dest, len);
else
gcc_unreachable ();
gcc_assert (TREE_CODE (fn) == CALL_EXPR);
@@ -4230,7 +4233,7 @@ expand_builtin_strcmp (tree exp, ATTRIBUTE_UNUSED rtx target)
do_libcall:
#endif
fndecl = get_callee_fndecl (exp);
- fn = build_call_nofold (fndecl, 2, arg1, arg2);
+ fn = build_call_nofold_loc (EXPR_LOCATION (exp), fndecl, 2, arg1, arg2);
gcc_assert (TREE_CODE (fn) == CALL_EXPR);
CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp);
return expand_call (fn, target, target == const0_rtx);
@@ -4352,7 +4355,8 @@ expand_builtin_strncmp (tree exp, ATTRIBUTE_UNUSED rtx target,
/* Expand the library call ourselves using a stabilized argument
list to avoid re-evaluating the function's arguments twice. */
fndecl = get_callee_fndecl (exp);
- fn = build_call_nofold (fndecl, 3, arg1, arg2, len);
+ fn = build_call_nofold_loc (EXPR_LOCATION (exp), fndecl, 3,
+ arg1, arg2, len);
gcc_assert (TREE_CODE (fn) == CALL_EXPR);
CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp);
return expand_call (fn, target, target == const0_rtx);
@@ -10758,6 +10762,26 @@ build_call_expr_loc (location_t loc, tree fndecl, int n, ...)
return fold_builtin_call_array (loc, TREE_TYPE (fntype), fn, n, argarray);
}
+/* Like build_call_expr_loc (UNKNOWN_LOCATION, ...). Duplicated because
+ varargs macros aren't supported by all bootstrap compilers. */
+
+tree
+build_call_expr (tree fndecl, int n, ...)
+{
+ va_list ap;
+ tree fntype = TREE_TYPE (fndecl);
+ tree fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
+ tree *argarray = (tree *) alloca (n * sizeof (tree));
+ int i;
+
+ va_start (ap, n);
+ for (i = 0; i < n; i++)
+ argarray[i] = va_arg (ap, tree);
+ va_end (ap);
+ return fold_builtin_call_array (UNKNOWN_LOCATION, TREE_TYPE (fntype),
+ fn, n, argarray);
+}
+
/* Construct a CALL_EXPR with type TYPE with FN as the function expression.
N arguments are passed in the array ARGARRAY. */
@@ -11848,7 +11872,7 @@ expand_builtin_memory_chk (tree exp, rtx target, enum machine_mode mode,
if (! fn)
return NULL_RTX;
- fn = build_call_nofold (fn, 3, dest, src, len);
+ fn = build_call_nofold_loc (EXPR_LOCATION (exp), fn, 3, dest, src, len);
gcc_assert (TREE_CODE (fn) == CALL_EXPR);
CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp);
return expand_expr (fn, target, mode, EXPAND_NORMAL);
@@ -11896,7 +11920,8 @@ expand_builtin_memory_chk (tree exp, rtx target, enum machine_mode mode,
tree fn = built_in_decls[BUILT_IN_MEMCPY_CHK];
if (!fn)
return NULL_RTX;
- fn = build_call_nofold (fn, 4, dest, src, len, size);
+ fn = build_call_nofold_loc (EXPR_LOCATION (exp), fn, 4,
+ dest, src, len, size);
gcc_assert (TREE_CODE (fn) == CALL_EXPR);
CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp);
return expand_expr (fn, target, mode, EXPAND_NORMAL);
diff --git a/gcc/tree.h b/gcc/tree.h
index bd86f44..1a2ac3a 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -5017,9 +5017,8 @@ extern bool fold_builtin_next_arg (tree, bool);
extern enum built_in_function builtin_mathfn_code (const_tree);
extern tree build_function_call_expr (location_t, tree, tree);
extern tree fold_builtin_call_array (location_t, tree, tree, int, tree *);
-#define build_call_expr(...)\
- build_call_expr_loc (UNKNOWN_LOCATION, __VA_ARGS__)
extern tree build_call_expr_loc (location_t, tree, int, ...);
+extern tree build_call_expr (tree, int, ...);
extern tree mathfn_built_in (tree, enum built_in_function fn);
extern tree c_strlen (tree, int);
extern tree std_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);