Commit aa493694 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 8ab7d796
2010-06-14 Jakub Jelinek <jakub@redhat.com> 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 PR tree-optimization/44508
* tree-ssa-propagate.h (substitute_and_fold): Add DO_DCE * tree-ssa-propagate.h (substitute_and_fold): Add DO_DCE
argument. argument.
......
...@@ -2521,8 +2521,6 @@ build_call_nofold_loc (location_t loc, tree fndecl, int n, ...) ...@@ -2521,8 +2521,6 @@ build_call_nofold_loc (location_t loc, tree fndecl, int n, ...)
SET_EXPR_LOCATION (fn, loc); SET_EXPR_LOCATION (fn, loc);
return fn; 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 /* Expand a call to one of the builtin rounding functions gcc defines
as an extension (lfloor and lceil). As these are gcc extensions we as an extension (lfloor and lceil). As these are gcc extensions we
...@@ -2640,7 +2638,7 @@ expand_builtin_int_roundingfn (tree exp, rtx target) ...@@ -2640,7 +2638,7 @@ expand_builtin_int_roundingfn (tree exp, rtx target)
fallback_fndecl = build_fn_decl (name, fntype); 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); tmp = expand_normal (exp);
...@@ -3085,7 +3083,8 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget) ...@@ -3085,7 +3083,8 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget)
&& (optab_handler (sqrt_optab, mode)->insn_code && (optab_handler (sqrt_optab, mode)->insn_code
!= CODE_FOR_nothing)))) != 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 /* Use expand_expr in case the newly built call expression
was folded to a non-call. */ was folded to a non-call. */
op = expand_expr (call_expr, subtarget, mode, EXPAND_NORMAL); op = expand_expr (call_expr, subtarget, mode, EXPAND_NORMAL);
...@@ -3137,7 +3136,8 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget) ...@@ -3137,7 +3136,8 @@ expand_builtin_pow (tree exp, rtx target, rtx subtarget)
&& powi_cost (n/3) <= POWI_MAX_MULTS) && powi_cost (n/3) <= POWI_MAX_MULTS)
|| n == 1)) || 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); op = expand_builtin (call_expr, NULL_RTX, subtarget, mode, 0);
if (abs (n) % 3 == 2) if (abs (n) % 3 == 2)
op = expand_simple_binop (mode, MULT, op, op, op, op = expand_simple_binop (mode, MULT, op, op, op,
...@@ -3471,7 +3471,8 @@ expand_builtin_mempcpy_args (tree dest, tree src, tree len, ...@@ -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]) if (target == const0_rtx && implicit_built_in_decls[BUILT_IN_MEMCPY])
{ {
tree fn = 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); return expand_expr (result, target, mode, EXPAND_NORMAL);
} }
else else
...@@ -3652,7 +3653,7 @@ expand_builtin_stpcpy (tree exp, rtx target, enum machine_mode mode) ...@@ -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]) if (target == const0_rtx && implicit_built_in_decls[BUILT_IN_STRCPY])
{ {
tree fn = 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); return expand_expr (result, target, mode, EXPAND_NORMAL);
} }
else else
...@@ -3955,9 +3956,11 @@ expand_builtin_memset_args (tree dest, tree val, tree len, ...@@ -3955,9 +3956,11 @@ expand_builtin_memset_args (tree dest, tree val, tree len,
fndecl = get_callee_fndecl (orig_exp); fndecl = get_callee_fndecl (orig_exp);
fcode = DECL_FUNCTION_CODE (fndecl); fcode = DECL_FUNCTION_CODE (fndecl);
if (fcode == BUILT_IN_MEMSET) 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) 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 else
gcc_unreachable (); gcc_unreachable ();
gcc_assert (TREE_CODE (fn) == CALL_EXPR); gcc_assert (TREE_CODE (fn) == CALL_EXPR);
...@@ -4230,7 +4233,7 @@ expand_builtin_strcmp (tree exp, ATTRIBUTE_UNUSED rtx target) ...@@ -4230,7 +4233,7 @@ expand_builtin_strcmp (tree exp, ATTRIBUTE_UNUSED rtx target)
do_libcall: do_libcall:
#endif #endif
fndecl = get_callee_fndecl (exp); 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); gcc_assert (TREE_CODE (fn) == CALL_EXPR);
CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp); CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp);
return expand_call (fn, target, target == const0_rtx); return expand_call (fn, target, target == const0_rtx);
...@@ -4352,7 +4355,8 @@ expand_builtin_strncmp (tree exp, ATTRIBUTE_UNUSED rtx target, ...@@ -4352,7 +4355,8 @@ expand_builtin_strncmp (tree exp, ATTRIBUTE_UNUSED rtx target,
/* Expand the library call ourselves using a stabilized argument /* Expand the library call ourselves using a stabilized argument
list to avoid re-evaluating the function's arguments twice. */ list to avoid re-evaluating the function's arguments twice. */
fndecl = get_callee_fndecl (exp); 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); gcc_assert (TREE_CODE (fn) == CALL_EXPR);
CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp); CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp);
return expand_call (fn, target, target == const0_rtx); return expand_call (fn, target, target == const0_rtx);
...@@ -10758,6 +10762,26 @@ build_call_expr_loc (location_t loc, tree fndecl, int n, ...) ...@@ -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); 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. /* Construct a CALL_EXPR with type TYPE with FN as the function expression.
N arguments are passed in the array ARGARRAY. */ N arguments are passed in the array ARGARRAY. */
...@@ -11848,7 +11872,7 @@ expand_builtin_memory_chk (tree exp, rtx target, enum machine_mode mode, ...@@ -11848,7 +11872,7 @@ expand_builtin_memory_chk (tree exp, rtx target, enum machine_mode mode,
if (! fn) if (! fn)
return NULL_RTX; 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); gcc_assert (TREE_CODE (fn) == CALL_EXPR);
CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp); CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp);
return expand_expr (fn, target, mode, EXPAND_NORMAL); return expand_expr (fn, target, mode, EXPAND_NORMAL);
...@@ -11896,7 +11920,8 @@ expand_builtin_memory_chk (tree exp, rtx target, enum machine_mode mode, ...@@ -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]; tree fn = built_in_decls[BUILT_IN_MEMCPY_CHK];
if (!fn) if (!fn)
return NULL_RTX; 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); gcc_assert (TREE_CODE (fn) == CALL_EXPR);
CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp); CALL_EXPR_TAILCALL (fn) = CALL_EXPR_TAILCALL (exp);
return expand_expr (fn, target, mode, EXPAND_NORMAL); return expand_expr (fn, target, mode, EXPAND_NORMAL);
......
...@@ -5017,9 +5017,8 @@ extern bool fold_builtin_next_arg (tree, bool); ...@@ -5017,9 +5017,8 @@ extern bool fold_builtin_next_arg (tree, bool);
extern enum built_in_function builtin_mathfn_code (const_tree); extern enum built_in_function builtin_mathfn_code (const_tree);
extern tree build_function_call_expr (location_t, tree, tree); extern tree build_function_call_expr (location_t, tree, tree);
extern tree fold_builtin_call_array (location_t, tree, tree, int, 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_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 mathfn_built_in (tree, enum built_in_function fn);
extern tree c_strlen (tree, int); extern tree c_strlen (tree, int);
extern tree std_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); extern tree std_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment