We use unshare_expr in many places now outside of gimple
even. So it makes sense to move the decl to tree.h.
A few sources can now even not need to include gimplify.h;
I have not checked all of them just a few which seemed
like including gimplify.h didn't make sense.
Bootstrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
* cfgrtl.cc: Don't include gimplify.h or gimplify-me.h.
* cgraphbuild.cc: Likewise.
* emit-rtl.cc: Likewie.
* tree-ssa-dom.cc: Likewise.
* tree-ssa-dse.cc: Likewise.
* tree-ssa-loop-im.cc: Likewise.
* tree-ssa-loop-niter.cc: Likewise.
* tree-ssa-loop-unswitch.cc: Likewise.
* tree-ssa-math-opts.cc: Likewise.
* tree-ssa-phiopt.cc: Likewise.
* tree-ssa-phiprop.cc: Likewise.
* tree-ssa-pre.cc: Likewise.
* tree-ssa-propagate.cc: Likewise.
* tree-ssa-sccvn.cc: Likewise.
* gimplify.h (unshare_expr): Remove.
(unshare_expr_without_location): Remove.
* tree.h (unshare_expr): New decl.
(unshare_expr_without_location): Likewise.
Signed-off-by: Andrew Pinski <[email protected]>
---
gcc/cfgrtl.cc | 1 -
gcc/cgraphbuild.cc | 1 -
gcc/emit-rtl.cc | 1 -
gcc/gimplify.h | 2 --
gcc/tree-ssa-dom.cc | 1 -
gcc/tree-ssa-dse.cc | 1 -
gcc/tree-ssa-loop-im.cc | 1 -
gcc/tree-ssa-loop-niter.cc | 1 -
gcc/tree-ssa-loop-unswitch.cc | 1 -
gcc/tree-ssa-math-opts.cc | 2 --
gcc/tree-ssa-phiopt.cc | 2 --
gcc/tree-ssa-phiprop.cc | 1 -
gcc/tree-ssa-pre.cc | 1 -
gcc/tree-ssa-propagate.cc | 1 -
gcc/tree-ssa-sccvn.cc | 1 -
gcc/tree.h | 7 +++++++
16 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/gcc/cfgrtl.cc b/gcc/cfgrtl.cc
index 7714e5548c2..0ec72f08fa8 100644
--- a/gcc/cfgrtl.cc
+++ b/gcc/cfgrtl.cc
@@ -62,7 +62,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "print-rtl.h"
#include "rtl-iter.h"
-#include "gimplify.h"
#include "profile.h"
#include "sreal.h"
diff --git a/gcc/cgraphbuild.cc b/gcc/cgraphbuild.cc
index e33a414310b..3faf8395db5 100644
--- a/gcc/cgraphbuild.cc
+++ b/gcc/cgraphbuild.cc
@@ -31,7 +31,6 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-walk.h"
#include "ipa-utils.h"
#include "except.h"
-#include "gimplify.h"
/* Context of record_reference. */
struct record_reference_ctx
diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc
index e41ec2283b8..7f5d267341a 100644
--- a/gcc/emit-rtl.cc
+++ b/gcc/emit-rtl.cc
@@ -63,7 +63,6 @@ along with GCC; see the file COPYING3. If not see
#include "rtx-vector-builder.h"
#include "gimple.h"
#include "gimple-ssa.h"
-#include "gimplify.h"
#include "bbitmap.h"
struct target_rtl default_target_rtl;
diff --git a/gcc/gimplify.h b/gcc/gimplify.h
index caa35b426bd..4906ebc391a 100644
--- a/gcc/gimplify.h
+++ b/gcc/gimplify.h
@@ -63,8 +63,6 @@ extern void declare_vars (tree, gimple *, bool);
extern void gimple_add_tmp_var (tree);
extern void gimple_add_tmp_var_fn (struct function *, tree);
extern void copy_if_shared (tree *, void * = NULL);
-extern tree unshare_expr (tree);
-extern tree unshare_expr_without_location (tree);
extern tree voidify_wrapper_expr (tree, tree);
extern tree build_and_jump (tree *);
extern enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *,
diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc
index 3be7979f528..37a29697319 100644
--- a/gcc/tree-ssa-dom.cc
+++ b/gcc/tree-ssa-dom.cc
@@ -42,7 +42,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-scopedtables.h"
#include "tree-ssa-threadedge.h"
#include "tree-ssa-dom.h"
-#include "gimplify.h"
#include "tree-cfgcleanup.h"
#include "dbgcnt.h"
#include "alloc-pool.h"
diff --git a/gcc/tree-ssa-dse.cc b/gcc/tree-ssa-dse.cc
index 58cfa9ec129..2f97d6d1a1a 100644
--- a/gcc/tree-ssa-dse.cc
+++ b/gcc/tree-ssa-dse.cc
@@ -37,7 +37,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-dse.h"
#include "builtins.h"
#include "gimple-fold.h"
-#include "gimplify.h"
#include "tree-eh.h"
#include "cfganal.h"
#include "cgraph.h"
diff --git a/gcc/tree-ssa-loop-im.cc b/gcc/tree-ssa-loop-im.cc
index 4f7401e2d5d..2651e3919e3 100644
--- a/gcc/tree-ssa-loop-im.cc
+++ b/gcc/tree-ssa-loop-im.cc
@@ -30,7 +30,6 @@ along with GCC; see the file COPYING3. If not see
#include "fold-const.h"
#include "cfganal.h"
#include "tree-eh.h"
-#include "gimplify.h"
#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-ssa-loop-manip.h"
diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc
index c39401147ae..f179be1ffc7 100644
--- a/gcc/tree-ssa-loop-niter.cc
+++ b/gcc/tree-ssa-loop-niter.cc
@@ -32,7 +32,6 @@ along with GCC; see the file COPYING3. If not see
#include "fold-const.h"
#include "calls.h"
#include "intl.h"
-#include "gimplify.h"
#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-ssa-loop-ivopts.h"
diff --git a/gcc/tree-ssa-loop-unswitch.cc b/gcc/tree-ssa-loop-unswitch.cc
index 96680bc64ea..a18c9ccfffa 100644
--- a/gcc/tree-ssa-loop-unswitch.cc
+++ b/gcc/tree-ssa-loop-unswitch.cc
@@ -26,7 +26,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "ssa.h"
#include "fold-const.h"
-#include "gimplify.h"
#include "tree-cfg.h"
#include "tree-ssa.h"
#include "tree-ssa-loop-niter.h"
diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc
index cd3fd2fc8fb..72f6dbd1a99 100644
--- a/gcc/tree-ssa-math-opts.cc
+++ b/gcc/tree-ssa-math-opts.cc
@@ -102,8 +102,6 @@ along with GCC; see the file COPYING3. If not see
#include "fold-const.h"
#include "gimple-iterator.h"
#include "gimple-fold.h"
-#include "gimplify.h"
-#include "gimplify-me.h"
#include "stor-layout.h"
#include "tree-cfg.h"
#include "tree-dfa.h"
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index e654e823636..18b5f284eee 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -35,9 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "fold-const.h"
#include "stor-layout.h"
#include "cfganal.h"
-#include "gimplify.h"
#include "gimple-iterator.h"
-#include "gimplify-me.h"
#include "tree-cfg.h"
#include "tree-dfa.h"
#include "domwalk.h"
diff --git a/gcc/tree-ssa-phiprop.cc b/gcc/tree-ssa-phiprop.cc
index 54f3ad8d9f8..7e7a4534eb2 100644
--- a/gcc/tree-ssa-phiprop.cc
+++ b/gcc/tree-ssa-phiprop.cc
@@ -29,7 +29,6 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-pretty-print.h"
#include "fold-const.h"
#include "tree-eh.h"
-#include "gimplify.h"
#include "gimple-iterator.h"
#include "stor-layout.h"
#include "tree-ssa-loop.h"
diff --git a/gcc/tree-ssa-pre.cc b/gcc/tree-ssa-pre.cc
index 0e5eaf86bc7..5ded68443dd 100644
--- a/gcc/tree-ssa-pre.cc
+++ b/gcc/tree-ssa-pre.cc
@@ -37,7 +37,6 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
-#include "gimplify.h"
#include "tree-cfg.h"
#include "tree-into-ssa.h"
#include "tree-dfa.h"
diff --git a/gcc/tree-ssa-propagate.cc b/gcc/tree-ssa-propagate.cc
index a87c45d3a12..992b4243670 100644
--- a/gcc/tree-ssa-propagate.cc
+++ b/gcc/tree-ssa-propagate.cc
@@ -30,7 +30,6 @@
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
-#include "gimplify.h"
#include "tree-cfg.h"
#include "tree-ssa.h"
#include "tree-ssa-propagate.h"
diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index e19beb439d2..79b6b465294 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -42,7 +42,6 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
-#include "gimplify.h"
#include "flags.h"
#include "dojump.h"
#include "explow.h"
diff --git a/gcc/tree.h b/gcc/tree.h
index 3b012d0fd6a..08a05f7d90c 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -7204,4 +7204,11 @@ extern bool disjoint_version_decls (tree, tree);
/* Checks if two overlapping decls are not mergeable. */
extern bool diagnose_versioned_decls (tree, tree);
+/* Unshare tree if needed. */
+extern tree unshare_expr (tree);
+
+/* Unshare tree if needed.
+ Removing the locations if an expr. */
+extern tree unshare_expr_without_location (tree);
+
#endif /* GCC_TREE_H */
--
2.43.0