aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-fold.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2018-05-17 10:51:42 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-05-17 10:51:42 +0000
commiteb69361d0c5e98423e7ad7a537bc3250e083de4a (patch)
tree6167d8b0e00393370c16fa3632d0a6e8cb756eb6 /gcc/gimple-fold.c
parent40659769b2b49e5ebea3ceee26ee73bdc0ff1efc (diff)
downloadgcc-eb69361d0c5e98423e7ad7a537bc3250e083de4a.zip
gcc-eb69361d0c5e98423e7ad7a537bc3250e083de4a.tar.gz
gcc-eb69361d0c5e98423e7ad7a537bc3250e083de4a.tar.bz2
Allow gimple_build with internal functions
This patch makes the function versions of gimple_build and gimple_simplify take combined_fns rather than built_in_codes, so that they work with internal functions too. The old gimple_builds were unused, so no existing callers need to be updated. 2018-05-17 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * gimple-fold.h (gimple_build): Make the function forms take combined_fn rather than built_in_function. (gimple_simplify): Likewise. * gimple-match-head.c (gimple_simplify): Likewise. * gimple-fold.c (gimple_build): Likewise. * tree-vect-loop.c (get_initial_def_for_reduction): Use gimple_build rather than gimple_build_call_internal. (get_initial_defs_for_reduction): Likewise. (vect_create_epilog_for_reduction): Likewise. (vectorizable_live_operation): Likewise. From-SVN: r260315
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r--gcc/gimple-fold.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index bd8c44a..4d8842e 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -7204,14 +7204,20 @@ gimple_build (gimple_seq *seq, location_t loc,
statements possibly defining it to SEQ. */
tree
-gimple_build (gimple_seq *seq, location_t loc,
- enum built_in_function fn, tree type, tree arg0)
+gimple_build (gimple_seq *seq, location_t loc, combined_fn fn,
+ tree type, tree arg0)
{
tree res = gimple_simplify (fn, type, arg0, seq, gimple_build_valueize);
if (!res)
{
- tree decl = builtin_decl_implicit (fn);
- gimple *stmt = gimple_build_call (decl, 1, arg0);
+ gcall *stmt;
+ if (internal_fn_p (fn))
+ stmt = gimple_build_call_internal (as_internal_fn (fn), 1, arg0);
+ else
+ {
+ tree decl = builtin_decl_implicit (as_builtin_fn (fn));
+ stmt = gimple_build_call (decl, 1, arg0);
+ }
if (!VOID_TYPE_P (type))
{
res = create_tmp_reg_or_ssa_name (type);
@@ -7230,14 +7236,20 @@ gimple_build (gimple_seq *seq, location_t loc,
statements possibly defining it to SEQ. */
tree
-gimple_build (gimple_seq *seq, location_t loc,
- enum built_in_function fn, tree type, tree arg0, tree arg1)
+gimple_build (gimple_seq *seq, location_t loc, combined_fn fn,
+ tree type, tree arg0, tree arg1)
{
tree res = gimple_simplify (fn, type, arg0, arg1, seq, gimple_build_valueize);
if (!res)
{
- tree decl = builtin_decl_implicit (fn);
- gimple *stmt = gimple_build_call (decl, 2, arg0, arg1);
+ gcall *stmt;
+ if (internal_fn_p (fn))
+ stmt = gimple_build_call_internal (as_internal_fn (fn), 2, arg0, arg1);
+ else
+ {
+ tree decl = builtin_decl_implicit (as_builtin_fn (fn));
+ stmt = gimple_build_call (decl, 2, arg0, arg1);
+ }
if (!VOID_TYPE_P (type))
{
res = create_tmp_reg_or_ssa_name (type);
@@ -7256,16 +7268,22 @@ gimple_build (gimple_seq *seq, location_t loc,
statements possibly defining it to SEQ. */
tree
-gimple_build (gimple_seq *seq, location_t loc,
- enum built_in_function fn, tree type,
- tree arg0, tree arg1, tree arg2)
+gimple_build (gimple_seq *seq, location_t loc, combined_fn fn,
+ tree type, tree arg0, tree arg1, tree arg2)
{
tree res = gimple_simplify (fn, type, arg0, arg1, arg2,
seq, gimple_build_valueize);
if (!res)
{
- tree decl = builtin_decl_implicit (fn);
- gimple *stmt = gimple_build_call (decl, 3, arg0, arg1, arg2);
+ gcall *stmt;
+ if (internal_fn_p (fn))
+ stmt = gimple_build_call_internal (as_internal_fn (fn),
+ 3, arg0, arg1, arg2);
+ else
+ {
+ tree decl = builtin_decl_implicit (as_builtin_fn (fn));
+ stmt = gimple_build_call (decl, 3, arg0, arg1, arg2);
+ }
if (!VOID_TYPE_P (type))
{
res = create_tmp_reg_or_ssa_name (type);