This adds a generic-match.h header to cover these (even though they
are not public API).

Richard.

2014-10-22  Richard Biener  <rguent...@suse.de>

        * generic-match.h: New file.
        * generic-match-head.c: Include generic-match.h, not gimple-match.h.
        * fold-const.c: Include generic-match.h.
        (fold_unary_loc): Remove local prototype of generic_simplify.
        (fold_binary_loc): Likewise.
        (fold_ternary_loc): Likewise.

Index: gcc/generic-match.h
===================================================================
--- gcc/generic-match.h (revision 0)
+++ gcc/generic-match.h (working copy)
@@ -0,0 +1,33 @@
+/* Generic simplify definitions.
+
+   Copyright (C) 2011-2014 Free Software Foundation, Inc.
+   Contributed by Richard Guenther <rguent...@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_GENERIC_MATCH_H
+#define GCC_GENERIC_MATCH_H
+
+/* Note the following functions are supposed to be only used from
+   fold_unary_loc, fold_binary_loc and fold_ternary_loc respectively.
+   They are not considered a public API.  */
+
+tree generic_simplify (location_t, enum tree_code, tree, tree);
+tree generic_simplify (location_t, enum tree_code, tree, tree, tree);
+tree generic_simplify (location_t, enum tree_code, tree, tree, tree, tree);
+
+#endif  /* GCC_GENERIC_MATCH_H */
Index: gcc/generic-match-head.c
===================================================================
--- gcc/generic-match-head.c    (revision 216542)
+++ gcc/generic-match-head.c    (working copy)
@@ -43,6 +43,6 @@ along with GCC; see the file COPYING3.
 #include "tree-phinodes.h"
 #include "ssa-iterators.h"
 #include "dumpfile.h"
-#include "gimple-match.h"
+#include "generic-match.h"
 
 
Index: gcc/fold-const.c
===================================================================
--- gcc/fold-const.c    (revision 216542)
+++ gcc/fold-const.c    (working copy)
@@ -70,6 +70,7 @@ along with GCC; see the file COPYING3.
 #include "hash-table.h"  /* Required for ENABLE_FOLD_CHECKING.  */
 #include "builtins.h"
 #include "cgraph.h"
+#include "generic-match.h"
 
 /* Nonzero if we are folding constants inside an initializer; zero
    otherwise.  */
@@ -7564,8 +7565,7 @@ fold_unary_loc (location_t loc, enum tre
   gcc_assert (IS_EXPR_CODE_CLASS (kind)
              && TREE_CODE_LENGTH (code) == 1);
 
-  extern tree generic_simplify (enum tree_code, tree, tree);
-  tem = generic_simplify (code, type, op0);
+  tem = generic_simplify (loc, code, type, op0);
   if (tem)
     return tem;
 
@@ -9918,8 +9918,7 @@ fold_binary_loc (location_t loc,
       && tree_swap_operands_p (arg0, arg1, true))
     return fold_build2_loc (loc, swap_tree_comparison (code), type, op1, op0);
 
-  extern tree generic_simplify (enum tree_code, tree, tree, tree);
-  tem = generic_simplify (code, type, op0, op1);
+  tem = generic_simplify (loc, code, type, op0, op1);
   if (tem)
     return tem;
 
@@ -13813,8 +13762,7 @@ fold_ternary_loc (location_t loc, enum t
       && tree_swap_operands_p (op0, op1, true))
     return fold_build3_loc (loc, code, type, op1, op0, op2);
 
-  extern tree generic_simplify (enum tree_code, tree, tree, tree, tree);
-  tem = generic_simplify (code, type, op0, op1, op2);
+  tem = generic_simplify (loc, code, type, op0, op1, op2);
   if (tem)
     return tem;
 

Reply via email to