summaryrefslogtreecommitdiff
path: root/gcc/gimple-match.h
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-17 18:47:44 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2015-11-17 18:47:44 +0000
commit3a18d05c6e55490e20387ffed5a7a41582cd4f38 (patch)
tree85646c7ff97526585c06596877a86bf8c493a6b3 /gcc/gimple-match.h
parente3240774da4f4334cd5ab34579770788a99d17f1 (diff)
downloadgcc-3a18d05c6e55490e20387ffed5a7a41582cd4f38.tar.gz
Add genmatch support for internal functions
This patch makes genmatch match calls based on combined_fn rather than built_in_function and extends the matching to internal functions. It also uses fold_const_call to fold the calls to a constant, rather than going through fold_builtin_n. In order to slightly simplify the code and remove potential ambiguity, the patch enforces lower case for tree codes (foo->FOO_EXPR), caps for functions (no built_in_hypot->BUILT_IN_HYPOT) and requires an exact match for user-defined identifiers. The first two were already met in practice but there were a couple of cases where operator lists were defined in one case and used in another. Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. gcc/ * match.pd: Use HYPOT and COS rather than hypot and cos. Use CASE_CFN_* macros. Guard log/exp folds with SCALAR_FLOAT_TYPE_P. * genmatch.c (internal_fn): New enum. (fn_id::fn): Change to an unsigned int. (fn_id::fn_id): Accept internal_fn too. (add_builtin): Rename to... (add_function): ...this and turn into a template. (get_operator): Only try one variation if the original name fails. Only add _EXPR if the original name was all lower case. Try converting internal and built-in function names to their CFN equivalents. (expr::gen_transform): Use maybe_build_call_expr_loc for generic. (dt_simplify::gen_1): Likewise. (dt_node::gen_kids_1): Use gimple_call_combined_fn for gimple and get_call_combined_fn for generic. (dt_simplify::gen): Use combined_fn as the type of fn_ids. (decision_tree::gen): Likewise. (main): Use lower case in the strings for {VIEW_,}CONVERT[012]. Use add_function rather than add_builtin. Register internal functions too. * generic-match-head.c: Include case-cfn-macros.h. * gimple-fold.c (replace_stmt_with_simplification): Use gimple_call_combined_fn to test whether we can keep an existing call. * gimple-match.h (code_helper): Replace built_in_function with combined_fn. * gimple-match-head.c: Include fold-const-call.h, internal-fn.h and case-fn-macros.h. (gimple_resimplify1): Use fold_const_call. (gimple_resimplify2, gimple_resimplify3): Likewise. (build_call_internal, build_call): New functions. (maybe_push_res_to_seq): Use them. (gimple_simplify): Use fold_const_call. Set *rcode to a combined_fn rather than a built-in function. * tree.h (build_call_expr_internal_loc): Declare. (maybe_build_call_expr_loc): Likewise. * tree.c (build_call_expr_internal_loc_array): New function. (maybe_build_call_expr_loc): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230484 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-match.h')
-rw-r--r--gcc/gimple-match.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/gimple-match.h b/gcc/gimple-match.h
index 632e9a53d1c..1d5e444a376 100644
--- a/gcc/gimple-match.h
+++ b/gcc/gimple-match.h
@@ -30,9 +30,9 @@ class code_helper
public:
code_helper () {}
code_helper (tree_code code) : rep ((int) code) {}
- code_helper (built_in_function fn) : rep (-(int) fn) {}
+ code_helper (combined_fn fn) : rep (-(int) fn) {}
operator tree_code () const { return (tree_code) rep; }
- operator built_in_function () const { return (built_in_function) -rep; }
+ operator combined_fn () const { return (combined_fn) -rep; }
bool is_tree_code () const { return rep > 0; }
bool is_fn_code () const { return rep < 0; }
int get_rep () const { return rep; }