diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e4de1bbd5cb27799394927d01c89182a2716f7ce..fbd970e082783a952bc48263733fe63251bc797e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,46 @@
+2010-05-15  Steven Bosscher  <steven@gcc.gnu.org>
+
+	* vecir.h: New file with VEC primitives for tree, gimple, and rtl.
+	* Makefile.in: Add it.
+	Fix all other Makefile dependencies for changes below.
+	* tree.h: Include it instead of defining VEC primitives here.
+	* gimple.h: Likewise.
+	* rtl.h: Likewise.
+	* tree-inline.h: Inlclude vecir.h instead of gimple.h.
+	* except.h: Include vecir.h, break dependence on tree.h.
+
+	* gimplify.c (append_to_statement_list_1, append_to_statement_list):
+	Move from here...
+	* tree-iterator.c: ...to here.
+	* tree-iterator.h: Fix file introduction comment.  Add extern markers.
+
+	* c-lex.c: Include fixed-value.h instead of rtl.h.  Do not include
+	tm_p.h.
+	* c-cppbuiltin.c: Explain why debug.h and tm_p.h are included.
+	* c-objc-common.h: Do not include tm.h, rtl.h, insn-config.h,
+	integrate.h, function.h, toplev.h, tree-inline.h, ggc.h,
+	tree-mudflap.h, and target.h.
+	* c-semantics.c: Do not include except.h, ggc.h, rtl.h, timevar.h,
+	predict.h, tree-inline.h, gimple.h, and langhooks.h.
+	* c-decl.c: Do not include expr.h, ggc.h, libfuncs.h, except.h.
+	Add FIXME for why gimple.h is still included (should be unnecessary
+	since GCC 4.5 gimplification unit-at-a-time).
+	* c-typeck.c: Do not include rtl.h, tm_p.h, ggc.h, and gimple.h.
+	* c-pragma.c: Add FIXME for why function.h needs to be included just
+	for cfun, at front-end level.
+	Add note that REGISTER_TARGET_PRAGMAS should probably be a target hook.
+	Do not include ggc.h, but include vecprim.h for VEC(char).
+	* c-opts.c: Do not include tm.h, tree-inline.h, and tm_p.h.
+	Explain why target.h is included.
+	* c-omp.h: Do not include tm.h, function.h, and bitmap.h.
+	Explain why gimple.h is included.
+	* c-ppoutput.c: Do not include tm.h.
+	* c-common.c: Do not include gimple.h.  Explain why expr.h is included.
+	* c-parses.c: Explain why rtl.h is included, and that this (and only
+	this) is also why tm.h must be included.
+	Do not include except.h.
+	* c-lang.c: Do not include ggc.h.
+
 2010-05-15  Uros Bizjak  <ubizjak@gmail.com>
 
 	* targhooks.c (GO_IF_MODE_DEPENDENT_ADDRESS): Use CONST_CAST_RTX.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index d3f450f1e12cfb78913e22df678330d65c9cbc88..91ea5088021b7ed9677988dfc57779d1b45dbf5d 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -858,7 +858,7 @@ REVISION_s  := "\"\""
 endif
 
 # Shorthand variables for dependency lists.
-EXCEPT_H = except.h sbitmap.h vecprim.h
+EXCEPT_H = except.h sbitmap.h vecprim.h vecir.h
 TOPLEV_H = toplev.h $(INPUT_H) bversion.h
 TARGET_H = $(TM_H) target.h insn-modes.h
 MACHMODE_H = machmode.h mode-classes.def insn-modes.h
@@ -869,19 +869,19 @@ TARGET_DEF_H = target-def.h $(HOOKS_H) targhooks.h
 RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) reg-notes.def insn-notes.def \
   $(INPUT_H) $(REAL_H) statistics.h vec.h $(FIXED_VALUE_H) alias.h
 FIXED_VALUE_H = fixed-value.h $(MACHMODE_H) double-int.h
-RTL_H = $(RTL_BASE_H) genrtl.h
+RTL_H = $(RTL_BASE_H) genrtl.h vecir.h
 PARAMS_H = params.h params.def
 BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def
 TREE_H = tree.h all-tree.def tree.def c-common.def $(lang_tree_files) \
           $(MACHMODE_H) tree-check.h $(BUILTINS_DEF) \
           $(INPUT_H) statistics.h vec.h treestruct.def $(HASHTAB_H) \
-          double-int.h alias.h $(SYMTAB_H) options.h
+          double-int.h alias.h $(SYMTAB_H) options.h vecir.h
 BASIC_BLOCK_H = basic-block.h $(BITMAP_H) sbitmap.h $(PARTITION_H) \
           hard-reg-set.h $(PREDICT_H) vec.h $(FUNCTION_H) \
           cfghooks.h $(OBSTACK_H)
 GIMPLE_H = gimple.h gimple.def gsstruct.def pointer-set.h vec.h \
 	$(GGC_H) $(BASIC_BLOCK_H) $(TM_H) $(TARGET_H) tree-ssa-operands.h \
-	tree-ssa-alias.h
+	tree-ssa-alias.h vecir.h
 GCOV_IO_H = gcov-io.h gcov-iov.h auto-host.h
 COVERAGE_H = coverage.h $(GCOV_IO_H)
 DEMANGLE_H = $(srcdir)/../include/demangle.h
@@ -944,7 +944,7 @@ C_PRETTY_PRINT_H = c-pretty-print.h $(PRETTY_PRINT_H) $(C_COMMON_H) $(TREE_H)
 SCEV_H = tree-scalar-evolution.h $(GGC_H) tree-chrec.h $(PARAMS_H)
 LAMBDA_H = lambda.h $(TREE_H) vec.h $(GGC_H)
 TREE_DATA_REF_H = tree-data-ref.h $(LAMBDA_H) omega.h graphds.h $(SCEV_H)
-TREE_INLINE_H = tree-inline.h $(GIMPLE_H)
+TREE_INLINE_H = tree-inline.h vecir.h
 REAL_H = real.h $(MACHMODE_H)
 IRA_INT_H = ira.h ira-int.h $(CFGLOOP_H) alloc-pool.h
 DBGCNT_H = dbgcnt.h dbgcnt.def
@@ -1959,7 +1959,7 @@ c-errors.o: c-errors.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
 c-parser.o : c-parser.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
     $(GGC_H) $(TIMEVAR_H) $(C_TREE_H) $(INPUT_H) $(FLAGS_H) $(TOPLEV_H) output.h \
     $(CPPLIB_H) gt-c-parser.h $(RTL_H) langhooks.h $(C_COMMON_H) $(C_PRAGMA_H) \
-    vec.h $(TARGET_H) $(CGRAPH_H) $(PLUGIN_H) $(EXCEPT_H)
+    vec.h $(TARGET_H) $(CGRAPH_H) $(PLUGIN_H)
 
 srcextra: gcc.srcextra lang.srcextra
 
@@ -1972,39 +1972,36 @@ incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
 
 c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
     $(RTL_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) $(FUNCTION_H) output.h \
-    $(EXPR_H) debug.h $(TOPLEV_H) intl.h $(TM_P_H) $(TREE_INLINE_H) $(TIMEVAR_H) \
+    debug.h $(TOPLEV_H) intl.h $(TM_P_H) $(TREE_INLINE_H) $(TIMEVAR_H) \
     opts.h $(C_PRAGMA_H) gt-c-decl.h $(CGRAPH_H) $(HASHTAB_H) libfuncs.h \
     $(EXCEPT_H) $(LANGHOOKS_DEF_H) $(TREE_DUMP_H) $(C_COMMON_H) $(CPPLIB_H) \
-    $(DIAGNOSTIC_H) $(INPUT_H) langhooks.h $(GIMPLE_H) tree-mudflap.h  \
-    pointer-set.h $(BASIC_BLOCK_H) $(GIMPLE_H) tree-iterator.h c-lang.h $(PLUGIN_H)
+    $(DIAGNOSTIC_H) $(INPUT_H) langhooks.h tree-mudflap.h  \
+    pointer-set.h tree-iterator.h c-lang.h $(PLUGIN_H)
 c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
     $(TREE_H) $(C_TREE_H) $(TARGET_H) $(FLAGS_H) intl.h output.h $(EXPR_H) \
-    $(RTL_H) $(TOPLEV_H) $(TM_P_H) langhooks.h $(GGC_H) $(TREE_FLOW_H) \
-    $(GIMPLE_H) tree-iterator.h c-lang.h
+    $(TOPLEV_H) langhooks.h $(TREE_FLOW_H) tree-iterator.h c-lang.h
 c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
     $(C_TREE_H) $(DIAGNOSTIC_H) \
-    $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-c.h \
+    langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-c.h \
     c-objc-common.h $(C_PRAGMA_H) c-common.def $(TREE_INLINE_H)
 stub-objc.o : stub-objc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
     $(C_COMMON_H)
 c-lex.o : c-lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
-    $(RTL_H) debug.h $(C_TREE_H) $(C_COMMON_H) $(REAL_H) $(SPLAY_TREE_H) \
+    $(FIXED_VALUE_H) debug.h $(C_TREE_H) $(C_COMMON_H) $(REAL_H) $(SPLAY_TREE_H) \
     $(C_PRAGMA_H) $(INPUT_H) intl.h $(FLAGS_H) $(TOPLEV_H) output.h \
-    $(CPPLIB_H) $(TARGET_H) $(TIMEVAR_H) $(TM_P_H)
-c-ppoutput.o : c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+    $(CPPLIB_H) $(TARGET_H) $(TIMEVAR_H)
+c-ppoutput.o : c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
     $(C_COMMON_H) $(TREE_H) $(CPPLIB_H) $(CPP_INTERNAL_H) $(C_PRAGMA_H)
 c-objc-common.o : c-objc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
-    $(TM_H) $(TREE_H) $(C_TREE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) \
-    $(FUNCTION_H) $(FLAGS_H) $(TOPLEV_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) \
-    langhooks.h $(GGC_H) $(TARGET_H) $(C_PRETTY_PRINT_H) c-objc-common.h \
-    tree-mudflap.h intl.h
+    $(TREE_H) $(C_TREE_H) $(FLAGS_H) $(DIAGNOSTIC_H) \
+    langhooks.h $(GGC_H) $(C_PRETTY_PRINT_H) c-objc-common.h intl.h
 c-aux-info.o : c-aux-info.c  $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
     $(C_TREE_H) $(FLAGS_H) $(TOPLEV_H)
 c-convert.o : c-convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
     $(TREE_H) $(FLAGS_H) $(TOPLEV_H) $(C_COMMON_H) convert.h $(C_TREE_H) \
     langhooks.h $(TARGET_H)
 c-pragma.o: c-pragma.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
-    $(TREE_H) $(FUNCTION_H) $(C_PRAGMA_H) $(TOPLEV_H) output.h $(GGC_H) $(TM_P_H) \
+    $(TREE_H) $(FUNCTION_H) $(C_PRAGMA_H) $(TOPLEV_H) output.h $(TM_P_H) \
     $(C_COMMON_H) $(TARGET_H) gt-c-pragma.h $(CPPLIB_H) $(FLAGS_H) $(DIAGNOSTIC_H) \
     opts.h $(PLUGINS_H)
 graph.o: graph.c $(SYSTEM_H) coretypes.h $(TM_H) $(TOPLEV_H) $(FLAGS_H) output.h \
@@ -2051,17 +2048,16 @@ c-common.o : c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
 	$(TARGET_H) $(C_TREE_H) tree-iterator.h langhooks.h tree-mudflap.h \
 	intl.h opts.h $(REAL_H) $(CPPLIB_H) $(TREE_INLINE_H) $(HASHTAB_H) \
 	$(BUILTINS_DEF) $(CGRAPH_H) $(BASIC_BLOCK_H) $(TARGET_DEF_H) \
-	$(GIMPLE_H) libfuncs.h
+	libfuncs.h
 
 c-pretty-print.o : c-pretty-print.c $(C_PRETTY_PRINT_H) \
 	$(C_TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(REAL_H) \
 	$(DIAGNOSTIC_H) tree-iterator.h fixed-value.h intl.h
 
-c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)		\
-        $(TREE_H) $(C_PRAGMA_H) $(FLAGS_H) $(TOPLEV_H) langhooks.h		\
-        $(TREE_INLINE_H) $(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H)	\
-        opts.h options.h $(MKDEPS_H) incpath.h cppdefault.h $(TARGET_H) \
-	$(TM_P_H) $(C_TREE_H)
+c-opts.o : c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+        $(TREE_H) $(C_PRAGMA_H) $(FLAGS_H) $(TOPLEV_H) langhooks.h \
+        $(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H)	\
+        opts.h options.h $(MKDEPS_H) incpath.h cppdefault.h $(C_TREE_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
 		$< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@
 
@@ -2083,10 +2079,8 @@ c-format.o : c-format.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) la
 	c-format.h
 
 c-semantics.o : c-semantics.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
-	$(TREE_H) $(FLAGS_H) $(TOPLEV_H) output.h $(RTL_H) $(GGC_H) \
-	$(PREDICT_H) $(TREE_INLINE_H) $(C_COMMON_H) $(EXCEPT_H) $(FUNCTION_H) \
-	langhooks.h $(SPLAY_TREE_H) $(TIMEVAR_H) $(GIMPLE_H) \
-	tree-iterator.h
+	$(TREE_H) $(FLAGS_H) $(TOPLEV_H) output.h $(C_COMMON_H) $(FUNCTION_H) \
+	langhooks.h $(SPLAY_TREE_H) $(TIMEVAR_H) tree-iterator.h
 
 c-dump.o : c-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
 	$(C_TREE_H) $(TREE_DUMP_H)
@@ -2099,9 +2093,8 @@ c-pch.o : c-pch.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(CPPLIB_H) $(TREE_H) \
 	  -DHOST_MACHINE=\"$(host)\" -DTARGET_MACHINE=\"$(target)\" \
 	  $< $(OUTPUT_OPTION)
 
-c-omp.o : c-omp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
-	$(FUNCTION_H) $(C_COMMON_H) $(TOPLEV_H) $(GIMPLE_H) $(BITMAP_H) \
-	langhooks.h
+c-omp.o : c-omp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
+	$(C_COMMON_H) $(TOPLEV_H) $(GIMPLE_H) langhooks.h
 
 # Language-independent files.
 
@@ -3585,10 +3578,10 @@ s-constrs-h: $(MD_DEPS) build/genpreds$(build_exeext)
 	$(STAMP) s-constrs-h
 
 GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
+  $(srcdir)/vecprim.h $(srcdir)/vecir.h \
   $(host_xm_file_list) \
   $(tm_file_list) $(HASHTAB_H) $(SPLAY_TREE_H) $(srcdir)/bitmap.h \
   $(srcdir)/alias.h $(srcdir)/coverage.c $(srcdir)/rtl.h \
-  $(srcdir)/vecprim.h \
   $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h $(SYMTAB_H) \
   $(srcdir)/real.h $(srcdir)/function.h $(srcdir)/insn-addr.h $(srcdir)/hwint.h \
   $(srcdir)/fixed-value.h \
diff --git a/gcc/c-common.c b/gcc/c-common.c
index b213671193a80e44ce95818df3fee7841c89609c..720569f722470b1dc2fe086784d256488ffdba55 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "c-pragma.h"
 #include "rtl.h"
 #include "ggc.h"
-#include "expr.h"
+#include "expr.h" /* For vector_mode_valid_p */
 #include "c-common.h"
 #include "tm_p.h"
 #include "obstack.h"
@@ -48,7 +48,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "real.h"
 #include "cgraph.h"
 #include "target-def.h"
-#include "gimple.h"
 #include "fixed-value.h"
 #include "libfuncs.h"
 
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c
index fa4d9a1ca01b739b7e337fcbd0a316c539377843..89646a317c022997442618d2f6a03df50fc8228c 100644
--- a/gcc/c-cppbuiltin.c
+++ b/gcc/c-cppbuiltin.c
@@ -30,9 +30,9 @@ along with GCC; see the file COPYING3.  If not see
 #include "c-pragma.h"
 #include "output.h"
 #include "except.h"		/* For USING_SJLJ_EXCEPTIONS.  */
-#include "debug.h"		/* For dwarf2out_do_frame.  */
+#include "debug.h"		/* For dwarf2out_do_cfi_asm.  */
 #include "toplev.h"
-#include "tm_p.h"		/* Target prototypes.  */
+#include "tm_p.h"		/* For TARGET_CPU_CPP_BUILTINS & friends.  */
 #include "target.h"
 
 #ifndef TARGET_OS_CPP_BUILTINS
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 4bec97f19896c31dbf5a84bdbef3f9d08e2b5531..554817f548300e6ef3817269e8ea18f60fe76852 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -38,10 +38,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "flags.h"
 #include "function.h"
 #include "output.h"
-#include "expr.h"
 #include "c-tree.h"
 #include "toplev.h"
-#include "ggc.h"
 #include "tm_p.h"
 #include "cpplib.h"
 #include "target.h"
@@ -53,17 +51,14 @@ along with GCC; see the file COPYING3.  If not see
 #include "c-lang.h"
 #include "langhooks.h"
 #include "tree-mudflap.h"
-#include "gimple.h"
+#include "gimple.h" /* FIXME: For gimple_set_body and gimple_body, but why?  */
 #include "tree-iterator.h"
 #include "diagnostic.h"
 #include "tree-dump.h"
 #include "cgraph.h"
 #include "hashtab.h"
-#include "libfuncs.h"
-#include "except.h"
 #include "langhooks-def.h"
 #include "pointer-set.h"
-#include "gimple.h"
 #include "plugin.h"
 
 /* In grokdeclarator, distinguish syntactic contexts of declarators.  */
diff --git a/gcc/c-lang.c b/gcc/c-lang.c
index 7e0236d3c2ee21135bf74d8750a11d8a2cee9d9c..31a122fba82c29eddfa19184af41afcf8944fcd1 100644
--- a/gcc/c-lang.c
+++ b/gcc/c-lang.c
@@ -27,7 +27,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "c-tree.h"
 #include "c-common.h"
-#include "ggc.h"
 #include "langhooks.h"
 #include "langhooks-def.h"
 #include "tree-inline.h"
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 5535eaeb42edb0a94da705a8d78e2b5b83170713..53a3b06a63b0ff613a491e39e37561f7daf31db2 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm.h"
 
 #include "real.h"
-#include "rtl.h"
+#include "fixed-value.h"
 #include "tree.h"
 #include "input.h"
 #include "output.h"
@@ -37,7 +37,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "c-pragma.h"
 #include "toplev.h"
 #include "intl.h"
-#include "tm_p.h"
 #include "splay-tree.h"
 #include "debug.h"
 #include "target.h"
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c
index f3cc9375420e560eca13458adf34cb1e95586af6..277e97bcab276979fe2f0aafd49d797570d02ac7 100644
--- a/gcc/c-objc-common.c
+++ b/gcc/c-objc-common.c
@@ -21,23 +21,13 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
 #include "tree.h"
-#include "rtl.h"
-#include "insn-config.h"
-#include "integrate.h"
 #include "c-tree.h"
 #include "intl.h"
 #include "c-pretty-print.h"
-#include "function.h"
 #include "flags.h"
-#include "toplev.h"
 #include "diagnostic.h"
-#include "tree-inline.h"
-#include "ggc.h"
 #include "langhooks.h"
-#include "tree-mudflap.h"
-#include "target.h"
 #include "c-objc-common.h"
 
 static bool c_tree_printer (pretty_printer *, text_info *, const char *,
diff --git a/gcc/c-omp.c b/gcc/c-omp.c
index 012a632b21427f65bea5f1f8b10f47005b084ff9..31970bdeaeebab72a95db3919ff2eeb5caaa7745 100644
--- a/gcc/c-omp.c
+++ b/gcc/c-omp.c
@@ -24,13 +24,10 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
 #include "tree.h"
-#include "function.h"
 #include "c-common.h"
 #include "toplev.h"
-#include "gimple.h"
-#include "bitmap.h"
+#include "gimple.h"		/* For create_tmp_var_raw.  */
 #include "langhooks.h"
 
 
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index d57cf91e355439c30f1dbe1f8917a280aa2b296b..fb2b8e2349e85bafac39d1dbf64558fd14d11c19 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -22,14 +22,12 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
 #include "tree.h"
 #include "c-common.h"
 #include "c-pragma.h"
 #include "flags.h"
 #include "toplev.h"
 #include "langhooks.h"
-#include "tree-inline.h"
 #include "diagnostic.h"
 #include "intl.h"
 #include "cppdefault.h"
@@ -38,8 +36,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "opts.h"
 #include "options.h"
 #include "mkdeps.h"
-#include "target.h"
-#include "tm_p.h"
+#include "target.h"		/* For gcc_targetcm.  */
 #include "c-tree.h"		/* For c_cpp_error.  */
 
 #ifndef DOLLARS_IN_IDENTIFIERS
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index a0f1bea87e54d606f2845303c36f98314b9f6c8f..ea977788bad2bd38fa5f9443aeffd44e97767807 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -40,9 +40,9 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
+#include "tm.h"			/* For rtl.h: needs enum reg_class.  */
 #include "tree.h"
-#include "rtl.h"
+#include "rtl.h"		/* For decl_default_tls_model.  */
 #include "langhooks.h"
 #include "input.h"
 #include "cpplib.h"
@@ -58,7 +58,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "cgraph.h"
 #include "plugin.h"
-#include "except.h"
 
 
 /* Initialization routine for this file.  */
diff --git a/gcc/c-ppoutput.c b/gcc/c-ppoutput.c
index bd9af2aa0f6c9a1bd557863007b312806f8d098c..1700fae3ed01e7bb32c066b88bf3512581cc36ce 100644
--- a/gcc/c-ppoutput.c
+++ b/gcc/c-ppoutput.c
@@ -20,7 +20,6 @@
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
 #include "cpplib.h"
 #include "../libcpp/internal.h"
 #include "tree.h"
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c
index f3cce3e61d5d55ff17b05c646c405ff85df01161..1fc006cf89be67d479bb4e226d7748b98aa92101 100644
--- a/gcc/c-pragma.c
+++ b/gcc/c-pragma.c
@@ -24,16 +24,19 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm.h"
 #include "rtl.h"
 #include "tree.h"
-#include "function.h"
+#include "function.h"		/* For cfun.  FIXME: Does the parser know
+				   when it is inside a function, so that
+				   we don't have to look at cfun?  */
 #include "cpplib.h"
 #include "c-pragma.h"
 #include "flags.h"
 #include "toplev.h"
-#include "ggc.h"
 #include "c-common.h"
 #include "output.h"
-#include "tm_p.h"
+#include "tm_p.h"		/* For REGISTER_TARGET_PRAGMAS (why is
+				   this not a target hook?).  */
 #include "vec.h"
+#include "vecprim.h"
 #include "target.h"
 #include "diagnostic.h"
 #include "opts.h"
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c
index 5111f819c72dc13a67da9c18f33658e06dbe915a..683655f77c01d219034629daa4e1ff2e92ffb9c5 100644
--- a/gcc/c-semantics.c
+++ b/gcc/c-semantics.c
@@ -27,22 +27,14 @@ along with GCC; see the file COPYING3.  If not see
 #include "function.h"
 #include "splay-tree.h"
 #include "c-common.h"
-#include "except.h"
 /* In order for the format checking to accept the C frontend
    diagnostic framework extensions, you must define this token before
    including toplev.h.  */
 #define GCC_DIAG_STYLE __gcc_cdiag__
 #include "toplev.h"
 #include "flags.h"
-#include "ggc.h"
-#include "rtl.h"
 #include "output.h"
-#include "timevar.h"
-#include "predict.h"
-#include "tree-inline.h"
-#include "gimple.h"
 #include "tree-iterator.h"
-#include "langhooks.h"
 
 /* Create an empty statement tree rooted at T.  */
 
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 083b5a15ac33ba9fa861ce64407a5a16dc81d2b2..a9cd10691aca532a6ad5df7d50d84c45a323312c 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -29,21 +29,17 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "rtl.h"
 #include "tree.h"
 #include "langhooks.h"
 #include "c-tree.h"
 #include "c-lang.h"
-#include "tm_p.h"
 #include "flags.h"
 #include "output.h"
 #include "expr.h"
 #include "toplev.h"
 #include "intl.h"
-#include "ggc.h"
 #include "target.h"
 #include "tree-iterator.h"
-#include "gimple.h"
 #include "tree-flow.h"
 
 /* Possible cases of implicit bad conversions.  Used to select
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ce56b0d1fc6d69144a001106a7a1814713092e1d..1f56ae0b503b19a4fd6d74af3177d0961d88609d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-15  Steven Bosscher  <steven@gcc.gnu.org>
+
+	* decl.c: Include tree-iterator.h, as fixup for tree-inline.h changes.
+	* Make-lang.in: Fix dependencies accordingly.
+
 2010-05-14  Jason Merrill  <jason@redhat.com>
 
 	C++ DR 475
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index d9ef1cd4dbff79170097cb6188d953ee7e7b83cf..a65c078301f959535e00f474f0578cd73df8e02a 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -256,7 +256,7 @@ cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \
   output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(RTL_H) \
   cp/operators.def $(TM_P_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(C_PRAGMA_H) \
   debug.h gt-cp-decl.h $(TIMEVAR_H) $(TREE_FLOW_H) $(TARGET_H) $(PLUGIN_H) \
-  intl.h
+  intl.h tree-iterator.h
 cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h $(EXPR_H) \
   output.h except.h toplev.h $(RTL_H) $(C_COMMON_H) gt-cp-decl2.h $(CGRAPH_H) \
   $(C_PRAGMA_H) $(TREE_DUMP_H) intl.h $(TARGET_H) $(GIMPLE_H) $(POINTER_SET_H)
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 05aff918d1e7034dd597d405206fa13a03f0d091..148bcf5d55a05ecb7977e5e9cde0b023f60913f7 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "expr.h"
 #include "flags.h"
 #include "cp-tree.h"
+#include "tree-iterator.h"
 #include "tree-inline.h"
 #include "decl.h"
 #include "intl.h"
diff --git a/gcc/except.h b/gcc/except.h
index 59214e0e7644122c27580dfac8785f3a5d3c05e0..de4fbf79f995d44d501daf005671eb2bc0f79550 100644
--- a/gcc/except.h
+++ b/gcc/except.h
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "sbitmap.h"
 #include "vecprim.h"
+#include "vecir.h"
 
 struct function;
 struct eh_region_d;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index d54550c26948a49037e786ac39a108bf3602ae81..baa839fab6f64b279ac004b9d7b1a62b0f3aae58 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -24,6 +24,8 @@ along with GCC; see the file COPYING3.  If not see
 
 #include "pointer-set.h"
 #include "vec.h"
+#include "vecprim.h"
+#include "vecir.h"
 #include "ggc.h"
 #include "tm.h"
 #include "hard-reg-set.h"
@@ -31,18 +33,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-ssa-operands.h"
 #include "tree-ssa-alias.h"
 
-DEF_VEC_P(gimple);
-DEF_VEC_ALLOC_P(gimple,heap);
-DEF_VEC_ALLOC_P(gimple,gc);
-
-typedef gimple *gimple_p;
-DEF_VEC_P(gimple_p);
-DEF_VEC_ALLOC_P(gimple_p,heap);
-
-DEF_VEC_P(gimple_seq);
-DEF_VEC_ALLOC_P(gimple_seq,gc);
-DEF_VEC_ALLOC_P(gimple_seq,heap);
-
 /* For each block, the PHI nodes that need to be rewritten are stored into
    these vectors.  */
 typedef VEC(gimple, heap) *gimple_vec;
@@ -1048,8 +1038,6 @@ extern gimple gimple_current_bind_expr (void);
 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
 extern tree voidify_wrapper_expr (tree, tree);
 extern tree build_and_jump (tree *);
-extern tree alloc_stmt_list (void);
-extern void free_stmt_list (tree);
 extern tree force_labels_r (tree *, int *, void *);
 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
 						  gimple_seq *);
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 6d00fefe9ad453a55f9b1dbed3aa392ee3abed38..2b402720b1ad512f393c87505cb7003860211f19 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -340,47 +340,6 @@ delete_omp_context (struct gimplify_omp_ctx *c)
 static void omp_add_variable (struct gimplify_omp_ctx *, tree, unsigned int);
 static bool omp_notice_variable (struct gimplify_omp_ctx *, tree, bool);
 
-/* A subroutine of append_to_statement_list{,_force}.  T is not NULL.  */
-
-static void
-append_to_statement_list_1 (tree t, tree *list_p)
-{
-  tree list = *list_p;
-  tree_stmt_iterator i;
-
-  if (!list)
-    {
-      if (t && TREE_CODE (t) == STATEMENT_LIST)
-	{
-	  *list_p = t;
-	  return;
-	}
-      *list_p = list = alloc_stmt_list ();
-    }
-
-  i = tsi_last (list);
-  tsi_link_after (&i, t, TSI_CONTINUE_LINKING);
-}
-
-/* Add T to the end of the list container pointed to by LIST_P.
-   If T is an expression with no effects, it is ignored.  */
-
-void
-append_to_statement_list (tree t, tree *list_p)
-{
-  if (t && TREE_SIDE_EFFECTS (t))
-    append_to_statement_list_1 (t, list_p);
-}
-
-/* Similar, but the statement is always added, regardless of side effects.  */
-
-void
-append_to_statement_list_force (tree t, tree *list_p)
-{
-  if (t != NULL_TREE)
-    append_to_statement_list_1 (t, list_p);
-}
-
 /* Both gimplify the statement T and append it to *SEQ_P.  This function
    behaves exactly as gimplify_stmt, but you don't have to pass T as a
    reference.  */
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 88c0abf6204fafbd6abeb5025d03d9dcaa9203bf..a3e05798d55ec38c705c442653d52bfcf9d15ae6 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "input.h"
 #include "real.h"
 #include "vec.h"
+#include "vecir.h"
 #include "fixed-value.h"
 #include "alias.h"
 
@@ -197,10 +198,6 @@ struct GTY(()) block_symbol {
   HOST_WIDE_INT offset;
 };
 
-DEF_VEC_P(rtx);
-DEF_VEC_ALLOC_P(rtx,heap);
-DEF_VEC_ALLOC_P(rtx,gc);
-
 /* Describes a group of objects that are to be placed together in such
    a way that their relative positions are known.  */
 struct GTY(()) object_block {
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index dba5eb2d8816582c258220a8ab46813341e5da9f..7f62ffc4f10770badbd020d050e29b2a70380b7d 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_TREE_INLINE_H
 #define GCC_TREE_INLINE_H
 
-#include "gimple.h"
+#include "vecir.h" /* For VEC(gimple,heap).  */
 
 struct cgraph_edge;
 
diff --git a/gcc/tree-iterator.c b/gcc/tree-iterator.c
index 43218f6b754a51e63c4831f584b5b9af6effbdc1..d5343b447604c9100a0e734f966347f9e11a91ef 100644
--- a/gcc/tree-iterator.c
+++ b/gcc/tree-iterator.c
@@ -61,6 +61,47 @@ free_stmt_list (tree t)
   stmt_list_cache = t;
 }
 
+/* A subroutine of append_to_statement_list{,_force}.  T is not NULL.  */
+
+static void
+append_to_statement_list_1 (tree t, tree *list_p)
+{
+  tree list = *list_p;
+  tree_stmt_iterator i;
+
+  if (!list)
+    {
+      if (t && TREE_CODE (t) == STATEMENT_LIST)
+	{
+	  *list_p = t;
+	  return;
+	}
+      *list_p = list = alloc_stmt_list ();
+    }
+
+  i = tsi_last (list);
+  tsi_link_after (&i, t, TSI_CONTINUE_LINKING);
+}
+
+/* Add T to the end of the list container pointed to by LIST_P.
+   If T is an expression with no effects, it is ignored.  */
+
+void
+append_to_statement_list (tree t, tree *list_p)
+{
+  if (t && TREE_SIDE_EFFECTS (t))
+    append_to_statement_list_1 (t, list_p);
+}
+
+/* Similar, but the statement is always added, regardless of side effects.  */
+
+void
+append_to_statement_list_force (tree t, tree *list_p)
+{
+  if (t != NULL_TREE)
+    append_to_statement_list_1 (t, list_p);
+}
+
 /* Links a statement, or a chain of statements, before the current stmt.  */
 
 void
diff --git a/gcc/tree-iterator.h b/gcc/tree-iterator.h
index c765bb5575db116aefff624b576463a488243fb3..12a0edb3d00b68ad3df3ae9f61d91cb231375ca1 100644
--- a/gcc/tree-iterator.h
+++ b/gcc/tree-iterator.h
@@ -1,4 +1,4 @@
-/* Iterator routines for manipulating GENERIC and GIMPLE tree statements.
+/* Iterator routines for manipulating GENERIC tree statement list.
    Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
    Contributed by Andrew MacLeod  <amacleod@redhat.com>
 
@@ -111,9 +111,11 @@ extern void tsi_link_before (tree_stmt_iterator *, tree,
 extern void tsi_link_after (tree_stmt_iterator *, tree,
 			    enum tsi_iterator_update);
 
-void tsi_delink (tree_stmt_iterator *);
+extern void tsi_delink (tree_stmt_iterator *);
 
-void append_to_statement_list (tree, tree *);
-void append_to_statement_list_force (tree, tree *);
+extern tree alloc_stmt_list (void);
+extern void free_stmt_list (tree);
+extern void append_to_statement_list (tree, tree *);
+extern void append_to_statement_list_force (tree, tree *);
 
 #endif /* GCC_TREE_ITERATOR_H  */
diff --git a/gcc/tree.h b/gcc/tree.h
index c5747b59541e841614b7fc75e9c81531dc2d7121..a37d81a2b124782d8aa6b1be258ab8c0c73c1f99 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "input.h"
 #include "statistics.h"
 #include "vec.h"
+#include "vecir.h"
 #include "double-int.h"
 #include "alias.h"
 #include "options.h"
@@ -178,11 +179,6 @@ extern const unsigned char tree_code_length[];
 
 extern const char *const tree_code_name[];
 
-/* A vectors of trees.  */
-DEF_VEC_P(tree);
-DEF_VEC_ALLOC_P(tree,gc);
-DEF_VEC_ALLOC_P(tree,heap);
-
 /* We have to be able to tell cgraph about the needed-ness of the target
    of an alias.  This requires that the decl have been defined.  Aliases
    that precede their definition have to be queued for later processing.  */
diff --git a/gcc/vecir.h b/gcc/vecir.h
new file mode 100644
index 0000000000000000000000000000000000000000..97e7b7818409f2de46bdcc7a13b64eda2f892441
--- /dev/null
+++ b/gcc/vecir.h
@@ -0,0 +1,52 @@
+/* VEC types for basic types of the intermediate representations.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+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_VECIR_H
+#define GCC_VECIR_H
+
+#ifndef GCC_CORETYPES_H
+#error "vecir.h must be included after coretypes.h"
+#endif
+
+/* A varray of trees.  */
+DEF_VEC_P(tree);
+DEF_VEC_ALLOC_P(tree,gc);
+DEF_VEC_ALLOC_P(tree,heap);
+
+/* A varray of gimple statements.  */
+DEF_VEC_P(gimple);
+DEF_VEC_ALLOC_P(gimple,heap);
+DEF_VEC_ALLOC_P(gimple,gc);
+
+/* A varray of pointers to gimple statements.  */
+typedef gimple *gimple_p;
+DEF_VEC_P(gimple_p);
+DEF_VEC_ALLOC_P(gimple_p,heap);
+
+/* A varray gimple statement sequences.  */
+DEF_VEC_P(gimple_seq);
+DEF_VEC_ALLOC_P(gimple_seq,gc);
+DEF_VEC_ALLOC_P(gimple_seq,heap);
+
+/* A varray of RTX objects.  */
+DEF_VEC_P(rtx);
+DEF_VEC_ALLOC_P(rtx,heap);
+DEF_VEC_ALLOC_P(rtx,gc);
+
+#endif /* GCC_VECIR_H */