summaryrefslogtreecommitdiff
path: root/gcc/gimple-match.h
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-22 08:42:37 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-22 08:42:37 +0000
commit2165588a33dc7d63840774b2aac61be999ef17ae (patch)
treeb44c5fbbe45ceabde1404a524b10797087c153bb /gcc/gimple-match.h
parent6e154e02514032b673c74fa03a7412ec69c69ce9 (diff)
downloadgcc-2165588a33dc7d63840774b2aac61be999ef17ae.tar.gz
2014-10-22 Richard Biener <rguenther@suse.de>
Prathamesh Kulkarni <bilbotheelffriend@gmail.com> * Makefile.in (OBJS): Add gimple-match.o and generic-match.o. (MOSTLYCLEANFILES): Add gimple-match.c and generic-match.c. (gimple-match.c): Generate by triggering s-match. (generic-match.c): Likewise. (s-match): Rule to build gimple-match.c and generic-match.c by running the genmatch generator program. (build/hash-table.o): Dependencies to build hash-table.c for the host. (build/genmatch.o): Dependencies to build genmatch. (genprog): Add match. (build/genmatch): Likewise. (TEXI_GCCINT_FILES): Add match-and-simplify.texi. * generic-match-head.c: New file. * gimple-match-head.c: Likewise. * gimple-match.h: Likewise. * genmatch.c: Likewise. * match.pd: Likewise. * builtins.h (fold_builtin_n): Export. * builtins.c (fold_builtin_n): Likewise. * gimple-fold.h (gimple_build): Declare various overloads. (gimple_simplify): Likewise. (gimple_convert): Re-implement in terms of gimple_build. * gimple-fold.c (gimple_convert): Remove. (gimple_build): New functions. * doc/match-and-simplify.texi: New file. * doc/gccint.texi: Add menu item Match and Simplify and include match-and-simplify.texi. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216542 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-match.h')
-rw-r--r--gcc/gimple-match.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc/gimple-match.h b/gcc/gimple-match.h
new file mode 100644
index 00000000000..571d5fd311e
--- /dev/null
+++ b/gcc/gimple-match.h
@@ -0,0 +1,50 @@
+/* Gimple simplify definitions.
+
+ Copyright (C) 2011-2014 Free Software Foundation, Inc.
+ Contributed by Richard Guenther <rguenther@suse.de>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_GIMPLE_MATCH_H
+#define GCC_GIMPLE_MATCH_H
+
+
+/* Helper to transparently allow tree codes and builtin function codes
+ exist in one storage entity. */
+class code_helper
+{
+public:
+ code_helper () {}
+ code_helper (tree_code code) : rep ((int) code) {}
+ code_helper (built_in_function fn) : rep (-(int) fn) {}
+ operator tree_code () const { return (tree_code) rep; }
+ operator built_in_function () const { return (built_in_function) -rep; }
+ bool is_tree_code () const { return rep > 0; }
+ bool is_fn_code () const { return rep < 0; }
+ int get_rep () const { return rep; }
+private:
+ int rep;
+};
+
+bool gimple_simplify (gimple, code_helper *, tree *, gimple_seq *,
+ tree (*)(tree));
+tree maybe_push_res_to_seq (code_helper, tree, tree *,
+ gimple_seq *, tree res = NULL_TREE);
+void maybe_build_generic_op (enum tree_code, tree, tree *, tree, tree);
+
+
+#endif /* GCC_GIMPLE_MATCH_H */