Commit d7ebef06 by Richard Sandiford Committed by Richard Sandiford

Extend fold_const_call to combined_fn

This patch extends fold_const_call so that it can handle internal
as well as built-in functions.

Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.

gcc/
	* fold-const-call.h (fold_const_call): Replace built_in_function
	arguments with combined_fn arguments.
	* fold-const-call.c: Include case-cfn-macros.h.
	(fold_const_call_ss, fold_const_call_cs, fold_const_call_sc)
	(fold_const_call_cc, fold_const_call_sss, fold_const_call_ccc)
	(fold_const_call_ssss, fold_const_call_1, fold_const_call): Replace
	built_in_function arguments with combined_fn arguments.
	* builtins.c (fold_builtin_sincos, fold_builtin_1, fold_builtin_2)
	(fold_builtin_3): Update calls to fold_const_call.

From-SVN: r230477
parent 6bac43d7
2015-11-17 Richard Sandiford <richard.sandiford@arm.com> 2015-11-17 Richard Sandiford <richard.sandiford@arm.com>
* fold-const-call.h (fold_const_call): Replace built_in_function
arguments with combined_fn arguments.
* fold-const-call.c: Include case-cfn-macros.h.
(fold_const_call_ss, fold_const_call_cs, fold_const_call_sc)
(fold_const_call_cc, fold_const_call_sss, fold_const_call_ccc)
(fold_const_call_ssss, fold_const_call_1, fold_const_call): Replace
built_in_function arguments with combined_fn arguments.
* builtins.c (fold_builtin_sincos, fold_builtin_1, fold_builtin_2)
(fold_builtin_3): Update calls to fold_const_call.
2015-11-17 Richard Sandiford <richard.sandiford@arm.com>
* Makefile.in (HASH_TABLE_H): Add GGC_H. * Makefile.in (HASH_TABLE_H): Add GGC_H.
(MOSTLYCLEANFILES, generated_files): Add case-fn-macros.h. (MOSTLYCLEANFILES, generated_files): Add case-fn-macros.h.
(s-case-cfn-macros, case-cfn-macros.h, build/gencfn-macros.o) (s-case-cfn-macros, case-cfn-macros.h, build/gencfn-macros.o)
...@@ -7348,7 +7348,7 @@ fold_builtin_sincos (location_t loc, ...@@ -7348,7 +7348,7 @@ fold_builtin_sincos (location_t loc,
if (TREE_CODE (arg0) == REAL_CST) if (TREE_CODE (arg0) == REAL_CST)
{ {
tree complex_type = build_complex_type (type); tree complex_type = build_complex_type (type);
call = fold_const_call (fn, complex_type, arg0); call = fold_const_call (as_combined_fn (fn), complex_type, arg0);
} }
if (!call) if (!call)
{ {
...@@ -8193,7 +8193,7 @@ fold_builtin_1 (location_t loc, tree fndecl, tree arg0) ...@@ -8193,7 +8193,7 @@ fold_builtin_1 (location_t loc, tree fndecl, tree arg0)
if (TREE_CODE (arg0) == ERROR_MARK) if (TREE_CODE (arg0) == ERROR_MARK)
return NULL_TREE; return NULL_TREE;
if (tree ret = fold_const_call (fcode, type, arg0)) if (tree ret = fold_const_call (as_combined_fn (fcode), type, arg0))
return ret; return ret;
switch (fcode) switch (fcode)
...@@ -8320,7 +8320,7 @@ fold_builtin_2 (location_t loc, tree fndecl, tree arg0, tree arg1) ...@@ -8320,7 +8320,7 @@ fold_builtin_2 (location_t loc, tree fndecl, tree arg0, tree arg1)
|| TREE_CODE (arg1) == ERROR_MARK) || TREE_CODE (arg1) == ERROR_MARK)
return NULL_TREE; return NULL_TREE;
if (tree ret = fold_const_call (fcode, type, arg0, arg1)) if (tree ret = fold_const_call (as_combined_fn (fcode), type, arg0, arg1))
return ret; return ret;
switch (fcode) switch (fcode)
...@@ -8419,7 +8419,8 @@ fold_builtin_3 (location_t loc, tree fndecl, ...@@ -8419,7 +8419,8 @@ fold_builtin_3 (location_t loc, tree fndecl,
|| TREE_CODE (arg2) == ERROR_MARK) || TREE_CODE (arg2) == ERROR_MARK)
return NULL_TREE; return NULL_TREE;
if (tree ret = fold_const_call (fcode, type, arg0, arg1, arg2)) if (tree ret = fold_const_call (as_combined_fn (fcode), type,
arg0, arg1, arg2))
return ret; return ret;
switch (fcode) switch (fcode)
......
...@@ -20,9 +20,9 @@ along with GCC; see the file COPYING3. If not see ...@@ -20,9 +20,9 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_FOLD_CONST_CALL_H #ifndef GCC_FOLD_CONST_CALL_H
#define GCC_FOLD_CONST_CALL_H #define GCC_FOLD_CONST_CALL_H
tree fold_const_call (built_in_function, tree, tree); tree fold_const_call (combined_fn, tree, tree);
tree fold_const_call (built_in_function, tree, tree, tree); tree fold_const_call (combined_fn, tree, tree, tree);
tree fold_const_call (built_in_function, tree, tree, tree, tree); tree fold_const_call (combined_fn, tree, tree, tree, tree);
tree fold_fma (location_t, tree, tree, tree, tree); tree fold_fma (location_t, tree, tree, tree, tree);
#endif #endif
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