diff mbox

Re-factor inclusion of tree.h

Message ID 20131021165218.GA18836@google.com
State New
Headers show

Commit Message

Diego Novillo Oct. 21, 2013, 4:52 p.m. UTC
This moves tree.h out of every header. This exposes dependencies of
tree.h in files that should probably not need it after tree and gimple
are separated.

After this change, no header should include tree.h directly. It should
only be included by a .c file. Unfortunately, I did not find an
automatic way of forcing this.

Tested on x86_64 with all languages enabled and using
contrib/config-list.mk.

Andrew, I think that some of the inclusions of tree-core.h can
actually go away. Last time we chatted about this, I think we
decided that including tree-core.h from a header file is OK. Not
sure if that's still the case.

I plan to commit this by tomorrow, unless there are objections.

Diego.


	* asan.c: Include tree.h
	* bb-reorder.c: Likewise.
	* cfgcleanup.c: Likewise.
	* cfgloopmanip.c: Likewise.
	* data-streamer-in.c: Likewise.
	* data-streamer-out.c: Likewise.
	* data-streamer.c: Likewise.
	* dwarf2cfi.c: Likewise.
	* graphite-blocking.c: Likewise.
	* graphite-clast-to-gimple.c: Likewise.
	* graphite-dependences.c: Likewise.
	* graphite-interchange.c: Likewise.
	* graphite-optimize-isl.c: Likewise.
	* graphite-poly.c: Likewise.
	* graphite-scop-detection.c: Likewise.
	* graphite-sese-to-poly.c: Likewise.
	* graphite.c: Likewise.
	* ipa-devirt.c: Likewise.
	* ipa-profile.c: Likewise.
	* ipa.c: Likewise.
	* ira.c: Likewise.
	* loop-init.c: Likewise.
	* loop-unroll.c: Likewise.
	* lower-subreg.c: Likewise.
	* lto/lto-object.c: Likewise.
	* recog.c: Likewise.
	* reginfo.c: Likewise.
	* tree-loop-distribution.c: Likewise.
	* tree-parloops.c: Likewise.
	* tree-ssa-strlen.c: Likewise.
	* tree-streamer.c: Likewise.
	* value-prof.c: Likewise.
	* expr.h: Include tree-core.h instead of tree.h.
	* gimple.h: Likewise.
	* ipa-prop.h: Likewise.
	* ipa-utils.h: Likewise.
	* lto-streamer.h: Likewise.
	* streamer-hooks.h: Likewise.
	* ipa-reference.h: Include cgraph.h instead of tree.h.
	* cgraph.h: Include basic-block.h instead of tree.h.
	* tree-streamer.h: Do not include tree.h.

testsuite/ChangeLog

	* g++.dg/plugin/selfassign.c: Include tree.h.
	* gcc.dg/plugin/finish_unit_plugin.c: Likewise.
	* gcc.dg/plugin/ggcplug.c: Likewise.
	* gcc.dg/plugin/one_time_plugin.c: Likewise.
	* gcc.dg/plugin/selfassign.c: Likewise.
	* gcc.dg/plugin/start_unit_plugin.c: Likewise.
---
 gcc/ChangeLog                                    | 44 ++++++++++++++++++++++++
 gcc/asan.c                                       |  1 +
 gcc/bb-reorder.c                                 |  1 +
 gcc/cfgcleanup.c                                 |  1 +
 gcc/cfgloopmanip.c                               |  1 +
 gcc/cgraph.h                                     |  2 +-
 gcc/data-streamer-in.c                           |  1 +
 gcc/data-streamer-out.c                          |  1 +
 gcc/data-streamer.c                              |  1 +
 gcc/dwarf2cfi.c                                  |  1 +
 gcc/expr.h                                       |  2 +-
 gcc/gimple.h                                     |  2 +-
 gcc/graphite-blocking.c                          |  1 +
 gcc/graphite-clast-to-gimple.c                   |  1 +
 gcc/graphite-dependences.c                       |  1 +
 gcc/graphite-interchange.c                       |  1 +
 gcc/graphite-optimize-isl.c                      |  1 +
 gcc/graphite-poly.c                              |  1 +
 gcc/graphite-scop-detection.c                    |  1 +
 gcc/graphite-sese-to-poly.c                      |  1 +
 gcc/graphite.c                                   |  1 +
 gcc/ipa-devirt.c                                 |  1 +
 gcc/ipa-profile.c                                |  1 +
 gcc/ipa-prop.h                                   |  2 +-
 gcc/ipa-reference.h                              |  2 +-
 gcc/ipa-utils.h                                  |  2 +-
 gcc/ipa.c                                        |  1 +
 gcc/ira.c                                        |  1 +
 gcc/loop-init.c                                  |  1 +
 gcc/loop-unroll.c                                |  1 +
 gcc/lower-subreg.c                               |  1 +
 gcc/lto-streamer.h                               |  2 +-
 gcc/lto/lto-object.c                             |  1 +
 gcc/recog.c                                      |  1 +
 gcc/reginfo.c                                    |  1 +
 gcc/streamer-hooks.h                             |  2 +-
 gcc/testsuite/ChangeLog                          |  9 +++++
 gcc/testsuite/g++.dg/plugin/selfassign.c         |  1 +
 gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c |  1 +
 gcc/testsuite/gcc.dg/plugin/ggcplug.c            |  1 +
 gcc/testsuite/gcc.dg/plugin/one_time_plugin.c    |  1 +
 gcc/testsuite/gcc.dg/plugin/selfassign.c         |  1 +
 gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c  |  1 +
 gcc/tree-loop-distribution.c                     |  1 +
 gcc/tree-parloops.c                              |  1 +
 gcc/tree-ssa-strlen.c                            |  1 +
 gcc/tree-streamer.c                              |  1 +
 gcc/tree-streamer.h                              |  1 -
 gcc/value-prof.c                                 |  1 +
 49 files changed, 99 insertions(+), 9 deletions(-)

Comments

Jeff Law Oct. 21, 2013, 4:57 p.m. UTC | #1
On 10/21/13 10:52, Diego Novillo wrote:
> This moves tree.h out of every header. This exposes dependencies of
> tree.h in files that should probably not need it after tree and gimple
> are separated.
>
> After this change, no header should include tree.h directly. It should
> only be included by a .c file. Unfortunately, I did not find an
> automatic way of forcing this.
>
> Tested on x86_64 with all languages enabled and using
> contrib/config-list.mk.
>
> Andrew, I think that some of the inclusions of tree-core.h can
> actually go away. Last time we chatted about this, I think we
> decided that including tree-core.h from a header file is OK. Not
> sure if that's still the case.
>
> I plan to commit this by tomorrow, unless there are objections.
I can't think of a good reason to even bother waiting :-)

jeff
diff mbox

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e839517..dfac4ec 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -88,6 +88,50 @@ 
 	(ix86_expand_movmem): Call ix86_expand_set_or_movmem.
 	(ix86_expand_setmem): Call ix86_expand_set_or_movmem.
 
+2013-10-21  Diego Novillo  <dnovillo@google.com>
+
+	* asan.c: Include tree.h
+	* bb-reorder.c: Likewise.
+	* cfgcleanup.c: Likewise.
+	* cfgloopmanip.c: Likewise.
+	* data-streamer-in.c: Likewise.
+	* data-streamer-out.c: Likewise.
+	* data-streamer.c: Likewise.
+	* dwarf2cfi.c: Likewise.
+	* graphite-blocking.c: Likewise.
+	* graphite-clast-to-gimple.c: Likewise.
+	* graphite-dependences.c: Likewise.
+	* graphite-interchange.c: Likewise.
+	* graphite-optimize-isl.c: Likewise.
+	* graphite-poly.c: Likewise.
+	* graphite-scop-detection.c: Likewise.
+	* graphite-sese-to-poly.c: Likewise.
+	* graphite.c: Likewise.
+	* ipa-devirt.c: Likewise.
+	* ipa-profile.c: Likewise.
+	* ipa.c: Likewise.
+	* ira.c: Likewise.
+	* loop-init.c: Likewise.
+	* loop-unroll.c: Likewise.
+	* lower-subreg.c: Likewise.
+	* lto/lto-object.c: Likewise.
+	* recog.c: Likewise.
+	* reginfo.c: Likewise.
+	* tree-loop-distribution.c: Likewise.
+	* tree-parloops.c: Likewise.
+	* tree-ssa-strlen.c: Likewise.
+	* tree-streamer.c: Likewise.
+	* value-prof.c: Likewise.
+	* expr.h: Include tree-core.h instead of tree.h.
+	* gimple.h: Likewise.
+	* ipa-prop.h: Likewise.
+	* ipa-utils.h: Likewise.
+	* lto-streamer.h: Likewise.
+	* streamer-hooks.h: Likewise.
+	* ipa-reference.h: Include cgraph.h instead of tree.h.
+	* cgraph.h: Include basic-block.h instead of tree.h.
+	* tree-streamer.h: Do not include tree.h.
+
 2013-10-20  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
 	* config/rs6000/altivec.md (vec_unpacku_hi_v16qi): Adjust for
diff --git a/gcc/asan.c b/gcc/asan.c
index c037ebf..a5978df 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "gimple.h"
 #include "tree-iterator.h"
 #include "tree-ssa.h"
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index c5a42d3..8e2348f 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -82,6 +82,7 @@ 
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "tree.h"
 #include "rtl.h"
 #include "regs.h"
 #include "flags.h"
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 53a9975..5161190 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -34,6 +34,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"
 #include "rtl.h"
+#include "tree.h"
 #include "hard-reg-set.h"
 #include "regs.h"
 #include "insn-config.h"
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index b4840dc..cf9a7fc 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "basic-block.h"
 #include "cfgloop.h"
+#include "tree.h"
 #include "tree-ssa.h"
 #include "dumpfile.h"
 
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 69adf4d..7706419 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -24,7 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "is-a.h"
 #include "plugin-api.h"
 #include "vec.h"
-#include "tree.h"
+#include "basic-block.h"
 #include "function.h"
 #include "ipa-ref.h"
 
diff --git a/gcc/data-streamer-in.c b/gcc/data-streamer-in.c
index 93fe2ff..84db7cf 100644
--- a/gcc/data-streamer-in.c
+++ b/gcc/data-streamer-in.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "diagnostic.h"
+#include "tree.h"
 #include "data-streamer.h"
 
 /* Read a string from the string table in DATA_IN using input block
diff --git a/gcc/data-streamer-out.c b/gcc/data-streamer-out.c
index 247ff63..2e55e3d 100644
--- a/gcc/data-streamer-out.c
+++ b/gcc/data-streamer-out.c
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "data-streamer.h"
 
 /* Return index used to reference STRING of LEN characters in the string table
diff --git a/gcc/data-streamer.c b/gcc/data-streamer.c
index cbd1cb9..5915a41 100644
--- a/gcc/data-streamer.c
+++ b/gcc/data-streamer.c
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "data-streamer.h"
 
 /* Pack WORK into BP in a variant of uleb format.  */
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 5a096ad..e0f85ed 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "version.h"
 #include "flags.h"
 #include "rtl.h"
+#include "tree.h"
 #include "function.h"
 #include "basic-block.h"
 #include "dwarf2.h"
diff --git a/gcc/expr.h b/gcc/expr.h
index 2189844..56f504a 100644
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -28,7 +28,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "flags.h"
 /* For host_integerp, tree_low_cst, fold_convert, size_binop, ssize_int,
    TREE_CODE, TYPE_SIZE, int_size_in_bytes,    */
-#include "tree.h"
+#include "tree-core.h"
 /* For GET_MODE_BITSIZE, word_mode */
 #include "machmode.h"
 
diff --git a/gcc/gimple.h b/gcc/gimple.h
index d8528ac..fef64cd 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -27,7 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "vec.h"
 #include "ggc.h"
 #include "basic-block.h"
-#include "tree.h"
+#include "tree-core.h"
 #include "tree-ssa-alias.h"
 #include "internal-fn.h"
 #include "gimple-fold.h"
diff --git a/gcc/graphite-blocking.c b/gcc/graphite-blocking.c
index 9226da0..491c815 100644
--- a/gcc/graphite-blocking.c
+++ b/gcc/graphite-blocking.c
@@ -34,6 +34,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "tree-ssa.h"
 #include "dumpfile.h"
 #include "cfgloop.h"
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index d0e2302..7db4da6 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -35,6 +35,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "diagnostic-core.h"
+#include "tree.h"
 #include "tree-ssa.h"
 #include "tree-pass.h"
 #include "cfgloop.h"
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index 5139e69..a561d25 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -33,6 +33,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "tree-ssa.h"
 #include "tree-pass.h"
 #include "cfgloop.h"
diff --git a/gcc/graphite-interchange.c b/gcc/graphite-interchange.c
index 289c1d9..060ec8f 100644
--- a/gcc/graphite-interchange.c
+++ b/gcc/graphite-interchange.c
@@ -35,6 +35,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "tree-ssa.h"
 #include "dumpfile.h"
 #include "cfgloop.h"
diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c
index b9b2156..856402f 100644
--- a/gcc/graphite-optimize-isl.c
+++ b/gcc/graphite-optimize-isl.c
@@ -32,6 +32,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "tree-ssa.h"
 #include "dumpfile.h"
 #include "cfgloop.h"
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index 35fe3ba..e1a4207 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -35,6 +35,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "diagnostic-core.h"
+#include "tree.h"
 #include "tree-ssa.h"
 #include "dumpfile.h"
 #include "gimple-pretty-print.h"
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 91d3d85..d7266f8 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -31,6 +31,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "tree-ssa.h"
 #include "cfgloop.h"
 #include "tree-chrec.h"
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 3e5541a..70e0126 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -33,6 +33,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "tree-ssa.h"
 #include "tree-pass.h"
 #include "cfgloop.h"
diff --git a/gcc/graphite.c b/gcc/graphite.c
index b26c520..cb8cc7e 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -47,6 +47,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "diagnostic-core.h"
+#include "tree.h"
 #include "tree-ssa.h"
 #include "tree-dump.h"
 #include "cfgloop.h"
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 10499e1..0d7c39b 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -109,6 +109,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "tree.h"
 #include "cgraph.h"
 #include "tree-pass.h"
 #include "ggc.h"
diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c
index bae9aec..d19d6df 100644
--- a/gcc/ipa-profile.c
+++ b/gcc/ipa-profile.c
@@ -48,6 +48,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "tree.h"
 #include "cgraph.h"
 #include "tree-pass.h"
 #include "gimple.h"
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index 48634d2..363d035 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -20,7 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 #ifndef IPA_PROP_H
 #define IPA_PROP_H
 
-#include "tree.h"
+#include "tree-core.h"
 #include "vec.h"
 #include "cgraph.h"
 #include "gimple.h"
diff --git a/gcc/ipa-reference.h b/gcc/ipa-reference.h
index c1e910e..317ebb0 100644
--- a/gcc/ipa-reference.h
+++ b/gcc/ipa-reference.h
@@ -21,7 +21,7 @@  along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_IPA_REFERENCE_H
 #define GCC_IPA_REFERENCE_H
 #include "bitmap.h"
-#include "tree.h"
+#include "cgraph.h"
 
 /* In ipa-reference.c  */
 bitmap ipa_reference_get_not_read_global (struct cgraph_node *fn);
diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h
index 374ac2a..d2424f7 100644
--- a/gcc/ipa-utils.h
+++ b/gcc/ipa-utils.h
@@ -20,7 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #ifndef GCC_IPA_UTILS_H
 #define GCC_IPA_UTILS_H
-#include "tree.h"
+#include "tree-core.h"
 #include "cgraph.h"
 
 struct ipa_dfs_info {
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 92343fb2..80a97ba 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -21,6 +21,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "tree.h"
 #include "cgraph.h"
 #include "tree-pass.h"
 #include "gimple.h"
diff --git a/gcc/ira.c b/gcc/ira.c
index 203fbff..d959109 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -361,6 +361,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"
 #include "regs.h"
+#include "tree.h"
 #include "rtl.h"
 #include "tm_p.h"
 #include "target.h"
diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index c7aee1d..b381745 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"
 #include "rtl.h"
+#include "tree.h"
 #include "regs.h"
 #include "obstack.h"
 #include "basic-block.h"
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 568fd7b..40f06db 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"
 #include "rtl.h"
+#include "tree.h"
 #include "hard-reg-set.h"
 #include "obstack.h"
 #include "basic-block.h"
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 57b4b3c..8ff5fc3 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "machmode.h"
 #include "tm.h"
+#include "tree.h"
 #include "rtl.h"
 #include "tm_p.h"
 #include "flags.h"
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index 13a9593..de42892 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -25,7 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 
 #include "plugin-api.h"
 #include "hash-table.h"
-#include "tree.h"
+#include "tree-core.h"
 #include "gimple.h"
 #include "target.h"
 #include "cgraph.h"
diff --git a/gcc/lto/lto-object.c b/gcc/lto/lto-object.c
index 77be1fb..2f51952 100644
--- a/gcc/lto/lto-object.c
+++ b/gcc/lto/lto-object.c
@@ -21,6 +21,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "diagnostic-core.h"
 #include "lto.h"
 #include "tm.h"
diff --git a/gcc/recog.c b/gcc/recog.c
index a3ca98c..9ab90b5 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "tree.h"
 #include "rtl-error.h"
 #include "tm_p.h"
 #include "insn-config.h"
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index 26318dc..db66a09 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -30,6 +30,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"
 #include "hard-reg-set.h"
+#include "tree.h"
 #include "rtl.h"
 #include "expr.h"
 #include "tm_p.h"
diff --git a/gcc/streamer-hooks.h b/gcc/streamer-hooks.h
index d989cc9..aeb86b9 100644
--- a/gcc/streamer-hooks.h
+++ b/gcc/streamer-hooks.h
@@ -23,7 +23,7 @@  along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_STREAMER_HOOKS_H
 #define GCC_STREAMER_HOOKS_H
 
-#include "tree.h"
+#include "tree-core.h"
 
 /* Forward declarations to avoid including unnecessary headers.  */
 struct output_block;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0293a77..4c07ab1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -14,6 +14,15 @@ 
 	* gcc.target/i386/memset-vector_loop-1.c: New test.
 	* gcc.target/i386/memset-vector_loop-2.c: New test.
 
+2013-10-21  Diego Novillo  <dnovillo@google.com>
+
+	* g++.dg/plugin/selfassign.c: Include tree.h.
+	* gcc.dg/plugin/finish_unit_plugin.c: Likewise.
+	* gcc.dg/plugin/ggcplug.c: Likewise.
+	* gcc.dg/plugin/one_time_plugin.c: Likewise.
+	* gcc.dg/plugin/selfassign.c: Likewise.
+	* gcc.dg/plugin/start_unit_plugin.c: Likewise.
+
 2013-10-20  Richard Sandiford  <rdsandiford@googlemail.com>
 
 	* gcc.target/mips/mips-ps-5.c: Add alignment attributes.
diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c
index 7235089..5331f79 100644
--- a/gcc/testsuite/g++.dg/plugin/selfassign.c
+++ b/gcc/testsuite/g++.dg/plugin/selfassign.c
@@ -7,6 +7,7 @@ 
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "tree.h"
 #include "toplev.h"
 #include "basic-block.h"
 #include "gimple.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c b/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c
index 26496a2..72d7240 100644
--- a/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c
@@ -6,6 +6,7 @@ 
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "tree.h"
 #include "toplev.h"
 #include "basic-block.h"
 #include "gimple.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/ggcplug.c b/gcc/testsuite/gcc.dg/plugin/ggcplug.c
index 3094b2e..eb61ece 100644
--- a/gcc/testsuite/gcc.dg/plugin/ggcplug.c
+++ b/gcc/testsuite/gcc.dg/plugin/ggcplug.c
@@ -5,6 +5,7 @@ 
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "tree.h"
 #include "toplev.h"
 #include "basic-block.h"
 #include "gimple.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
index c4dace5..1e601a6 100644
--- a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
@@ -3,6 +3,7 @@ 
 #include "gcc-plugin.h"
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "tm.h"
 #include "toplev.h"
 #include "gimple.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c
index 7235089..5331f79 100644
--- a/gcc/testsuite/gcc.dg/plugin/selfassign.c
+++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c
@@ -7,6 +7,7 @@ 
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "tree.h"
 #include "toplev.h"
 #include "basic-block.h"
 #include "gimple.h"
diff --git a/gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c b/gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c
index 852ab88..257aad8 100644
--- a/gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c
+++ b/gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c
@@ -10,6 +10,7 @@ 
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "tree.h"
 #include "toplev.h"
 #include "basic-block.h"
 #include "gimple.h"
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 015b50d..9b6936d 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -44,6 +44,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "tree-ssa.h"
 #include "cfgloop.h"
 #include "tree-chrec.h"
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index cdef5c6..1119310 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "tree-ssa.h"
 #include "cfgloop.h"
 #include "tree-data-ref.h"
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index 5df1ddf..1c0db14 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -21,6 +21,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "hash-table.h"
 #include "tree-ssa.h"
 #include "tree-pass.h"
diff --git a/gcc/tree-streamer.c b/gcc/tree-streamer.c
index 8d532d9..55c9ad5 100644
--- a/gcc/tree-streamer.c
+++ b/gcc/tree-streamer.c
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "tree.h"
 #include "streamer-hooks.h"
 #include "tree-streamer.h"
 
diff --git a/gcc/tree-streamer.h b/gcc/tree-streamer.h
index 02f8f51..1ed215c 100644
--- a/gcc/tree-streamer.h
+++ b/gcc/tree-streamer.h
@@ -22,7 +22,6 @@  along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_TREE_STREAMER_H
 #define GCC_TREE_STREAMER_H
 
-#include "tree.h"
 #include "streamer-hooks.h"
 #include "lto-streamer.h"
 
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index b19aefb..0364c48 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -21,6 +21,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "tree.h"
 #include "rtl.h"
 #include "expr.h"
 #include "hard-reg-set.h"