diff mbox

Move MEMMODEL_* and enum memmodel from coretypes.h to memmodel.h

Message ID 8a3078cc-f8fd-d6aa-4717-b8fdb21af076@foss.arm.com
State New
Headers show

Commit Message

Thomas Preudhomme Oct. 12, 2016, 4:11 p.m. UTC
Hi,

This patch is a follow up of [1] which aims to have all memory model related 
declarations in memmodel.h. To achieve that, this patch moves memory model 
related declaration from coretypes.h into memmodel.h. Note that since memmodel.h 
is now included from libgcc it needs to have a runtime library exception.

[1] https://gcc.gnu.org/ml/gcc-patches/2016-09/msg01550.html

=== Methodology ===

To achieve this, an include "memmodel.h" was added to all files except header 
files using MEMMODEL_* or enum memmodel. For header files, the header files 
including them were searched in turn and the process repeated until no new file 
gets modified (a file can have already be mentionned but a change still 
necessary due to needing the include earlier).


ChangeLog entries are as follow:

*** gcc/ChangeLog ***

2016-10-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

         * coretypes.h: Move MEMMODEL_* macros and enum memmodel definition
         into ...
         * memmodel.h: This file.  Add runtime library exception.
         * alias.c, asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c,
           caller-save.c, calls.c, ccmp.c, cfgbuild.c, cfgcleanup.c,
           cfgexpand.c, cfgloopanal.c, cfgrtl.c, cilk-common.c, combine.c,
           combine-stack-adj.c, common/config/aarch64/aarch64-common.c,
           common/config/arm/arm-common.c, common/config/bfin/bfin-common.c,
           common/config/c6x/c6x-common.c, common/config/i386/i386-common.c,
           common/config/ia64/ia64-common.c, common/config/nvptx/nvptx-common.c,
           compare-elim.c, config/aarch64/aarch64-builtins.c,
           config/aarch64/aarch64-c.c, config/aarch64/cortex-a57-fma-steering.c,
           config/arc/arc.c, config/arc/arc-c.c, config/arm/arm-builtins.c,
           config/arm/arm-c.c, config/avr/avr.c, config/avr/avr-c.c,
           config/avr/avr-log.c, config/bfin/bfin.c, config/c6x/c6x.c,
           config/cr16/cr16.c, config/cris/cris.c, config/darwin-c.c,
           config/darwin.c, config/epiphany/epiphany.c,
           config/epiphany/mode-switch-use.c,
           config/epiphany/resolve-sw-modes.c, config/fr30/fr30.c,
           config/frv/frv.c, config/ft32/ft32.c, config/h8300/h8300.c,
           config/i386/i386-c.c, config/i386/winnt.c, config/iq2000/iq2000.c,
           config/lm32/lm32.c, config/m32c/m32c.c, config/m32r/m32r.c,
           config/m68k/m68k.c, config/mcore/mcore.c,
           config/microblaze/microblaze.c, config/mmix/mmix.c,
           config/mn10300/mn10300.c, config/moxie/moxie.c,
           config/msp430/msp430.c, config/nds32/nds32-cost.c,
           config/nds32/nds32-intrinsic.c, config/nds32/nds32-md-auxiliary.c,
           config/nds32/nds32-memory-manipulation.c,
           config/nds32/nds32-predicates.c, config/nds32/nds32.c,
           config/nios2/nios2.c, config/nvptx/nvptx.c, config/pa/pa.c,
           config/pdp11/pdp11.c, config/rl78/rl78.c, config/rs6000/rs6000-c.c,
           config/rx/rx.c, config/s390/s390-c.c, config/s390/s390.c,
           config/sh/sh.c, config/sh/sh-c.c, config/sh/sh-mem.cc,
           config/sh/sh_treg_combine.cc, config/sol2.c, config/spu/spu.c,
           config/stormy16/stormy16.c, config/tilegx/tilegx.c,
           config/tilepro/tilepro.c, config/v850/v850.c, config/vax/vax.c,
           config/visium/visium.c, config/vms/vms-c.c, config/xtensa/xtensa.c,
           coverage.c, cppbuiltin.c, cprop.c, cse.c, cselib.c, dbxout.c, dce.c,
           df-core.c, df-problems.c, df-scan.c, dojump.c, dse.c, dwarf2asm.c,
           dwarf2cfi.c, dwarf2out.c, emit-rtl.c, except.c, explow.c, expmed.c,
           expr.c, final.c, fold-const.c, function.c, fwprop.c, gcse.c,
           ggc-page.c, haifa-sched.c, hsa-brig.c, hsa-gen.c, hw-doloop.c,
           ifcvt.c, init-regs.c, internal-fn.c, ira-build.c, ira-color.c,
           ira-conflicts.c, ira-costs.c, ira-emit.c, ira-lives.c, ira.c, jump.c,
           loop-doloop.c, loop-invariant.c, loop-iv.c, loop-unroll.c,
           lower-subreg.c, lra.c, lra-assigns.c, lra-coalesce.c,
           lra-constraints.c, lra-eliminations.c, lra-lives.c, lra-remat.c,
           lra-spills.c, mode-switching.c, modulo-sched.c, omp-low.c, passes.c,
           postreload-gcse.c, postreload.c, predict.c, print-rtl-function.c,
           recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regrename.c,
           reload.c, reload1.c, reorg.c, resource.c, rtl-chkp.c, rtl-tests.c,
           rtlanal.c, rtlhooks.c, sched-deps.c, sched-rgn.c, sdbout.c,
           sel-sched-ir.c, sel-sched.c, shrink-wrap.c, simplify-rtx.c,
           stack-ptr-mod.c, stmt.c, stor-layout.c, target-globals.c,
           targhooks.c, toplev.c, tree-nested.c, tree-outof-ssa.c,
           tree-profile.c, tree-ssa-coalesce.c, tree-ssa-ifcombine.c,
           tree-ssa-loop-ivopts.c, tree-ssa-loop.c, tree-ssa-reassoc.c,
           tree-ssa-sccvn.c, tree-vect-data-refs.c, ubsan.c, valtrack.c,
           var-tracking.c, varasm.c: Include memmodel.h.
         * genattrtab.c (write_header): Include memmodel.h in generated file.
         * genautomata.c (main): Likewise.
         * gengtype.c (open_base_files): Likewise.
         * genopinit.c (main): Likewise.
         * genconditions.c (write_header): Include memmodel.h earlier in
         generated file.
         * genemit.c (main): Likewise.
         * genoutput.c (output_prologue): Likewise.
         * genpeep.c (main): Likewise.
         * genpreds.c (write_insn_preds_c): Likewise.
         * genrecog.c (write_header): Likewise.
         * Makefile.in (PLUGIN_HEADERS): Include memmodel.h


*** gcc/ada/ChangeLog ***

2016-10-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

         * gcc-interface/utils2.c: Include memmodel.h.


*** gcc/c/ChangeLog ***

2016-10-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

         * c-typeck.c: Include memmodel.h.


*** gcc/c-family/ChangeLog ***

2016-10-12  Thomas Preud'homme  <thomas.preudhomme@arm.com>

         * c-cppbuiltin.c: Include memmodel.h.
         * c-opts.c: Likewise.
         * c-pragma.c: Likewise.
         * c-warn.c: Likewise.


*** gcc/cp/ChangeLog ***

2016-10-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

         * decl2.c: Include memmodel.h.
         * rtti.c: Likewise.


*** gcc/fortran/ChangeLog ***

2016-10-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

         * trans-intrinsic.c: Include memmodel.h.


*** gcc/go/ChangeLog ***

2016-10-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

         * go-backend.c: Include memmodel.h.


*** libgcc/ChangeLog ***

2016-10-10  Thomas Preud'homme  <thomas.preudhomme@arm.com>

         * config/tilepro/atomic.c: Include memmodel.h.
         * libgcov-profiler.c: Likewise.


Bootstrapped on x86-64, arm and aarch64 and alpha-linux-gnu cross-compiler built.

Is this ok for trunk?

Best regards,

Thomas

Comments

Joseph Myers Oct. 12, 2016, 8 p.m. UTC | #1
On Wed, 12 Oct 2016, Thomas Preudhomme wrote:

> This patch is a follow up of [1] which aims to have all memory model related
> declarations in memmodel.h. To achieve that, this patch moves memory model
> related declaration from coretypes.h into memmodel.h. Note that since
> memmodel.h is now included from libgcc it needs to have a runtime library
> exception.

I think libgcc should be using the __ATOMIC_* predefines instead of the 
MEMMODEL_* host-side constants.  (In general, we should be moving away 
from including host-side headers in target-side code.)
Richard Biener Oct. 13, 2016, 8:30 a.m. UTC | #2
On Wed, 12 Oct 2016, Joseph Myers wrote:

> On Wed, 12 Oct 2016, Thomas Preudhomme wrote:
> 
> > This patch is a follow up of [1] which aims to have all memory model related
> > declarations in memmodel.h. To achieve that, this patch moves memory model
> > related declaration from coretypes.h into memmodel.h. Note that since
> > memmodel.h is now included from libgcc it needs to have a runtime library
> > exception.
> 
> I think libgcc should be using the __ATOMIC_* predefines instead of the 
> MEMMODEL_* host-side constants.  (In general, we should be moving away 
> from including host-side headers in target-side code.)

Ah, if we have those then I agree.

Richard.
diff mbox

Patch

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 540201e21f66d14210f3932a45203aa312659bab..f50305b248cf89d34f41c677fbdc5b4eb1bf6244 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3383,7 +3383,7 @@  s-params.options: $(srcdir)/params-options.h $(srcdir)/params.def
 PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
   toplev.h $(DIAGNOSTIC_CORE_H) $(BASIC_BLOCK_H) $(HASH_TABLE_H) \
   tree-ssa-alias.h $(INTERNAL_FN_H) gimple-fold.h tree-eh.h gimple-expr.h \
-  gimple.h is-a.h $(TREE_PASS_H) $(GCC_PLUGIN_H) \
+  gimple.h is-a.h memmodel.h $(TREE_PASS_H) $(GCC_PLUGIN_H) \
   $(GGC_H) $(TREE_DUMP_H) $(PRETTY_PRINT_H) $(OPTS_H) $(PARAMS_H) \
   $(tm_file_list) $(tm_include_list) $(tm_p_file_list) $(tm_p_include_list) \
   $(host_xm_file_list) $(host_xm_include_list) $(xm_include_list) \
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index 9ace387b85aa19f5df39762f3cf652c7528a4a6f..c0d831fb1e5ba90373a483afb8d57781b3aee136 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -26,6 +26,7 @@ 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "memmodel.h"
 #include "tm.h"
 #include "vec.h"
 #include "alias.h"
diff --git a/gcc/alias.c b/gcc/alias.c
index 19e9208ac976e86e4f085a4b39bb20b206d9ed24..f4a0a2978c38db8f383ff14e2a02476702c571ba 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "gimple.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "gimple-ssa.h"
 #include "emit-rtl.h"
diff --git a/gcc/asan.c b/gcc/asan.c
index 3a4b5f708dcb40a552e690e869c2fd7d79c65c09..c6d924014b6f32ead3d7e2dc37ee6e8aeadec11a 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -30,6 +30,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "cfghooks.h"
 #include "alloc-pool.h"
 #include "tree-pass.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "tree-vrp.h"
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
index eb2dc21f801c51084468b45d2a1d28643bdc927d..e80244b0f500582cdbbda44dd940f9b0f7b2ef65 100644
--- a/gcc/auto-inc-dec.c
+++ b/gcc/auto-inc-dec.c
@@ -28,6 +28,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "predict.h"
 #include "df.h"
 #include "insn-config.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "recog.h"
 #include "cfgrtl.h"
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index bb8435f131c200b2996607849d667a44924f4612..ef1c476f318694bb9f92d6b258b21d52a761785f 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -100,6 +100,7 @@ 
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "optabs.h"
 #include "regs.h"
 #include "emit-rtl.h"
diff --git a/gcc/bt-load.c b/gcc/bt-load.c
index 5b1bcecd5c3cfe232fc6c8f342fd2cf70a3e5402..6747845be7afba9ad79f1c95872c37edaba9fc3d 100644
--- a/gcc/bt-load.c
+++ b/gcc/bt-load.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "df.h"
 #include "insn-config.h"
 #include "regs.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "recog.h"
 #include "diagnostic-core.h"
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 97eda67e93b1173bb2cb9ed60253bf0c16ff1523..94af585eafedece18f588cc55201887fdd5b0894 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "target.h"
 #include "c-common.h"
+#include "memmodel.h"
 #include "tm_p.h"		/* For TARGET_CPU_CPP_BUILTINS & friends.  */
 #include "stringpool.h"
 #include "stor-layout.h"
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index da62b55fea3eb0fc92e49d6a85cb86d4864f994b..a0c0c624f96b65749414cad5d516c8e8bfd28d0d 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tm.h"
 #include "c-target.h"
 #include "c-common.h"
+#include "memmodel.h"
 #include "tm_p.h"		/* For C_COMMON_OVERRIDE_OPTIONS.  */
 #include "diagnostic.h"
 #include "c-pragma.h"
diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c
index 1a9a9f3f3eb91c05528d49cff392a0b857467ea7..58ef5c9c80b65ab2cc75a4e2016927f5d8a39848 100644
--- a/gcc/c-family/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "function.h"		/* For cfun.  */
 #include "c-common.h"
+#include "memmodel.h"
 #include "tm_p.h"		/* For REGISTER_TARGET_PRAGMAS.  */
 #include "stringpool.h"
 #include "cgraph.h"
diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c
index cac5b36e4789cfcbd737ea8990e4ec14a5f772ec..88544ce2a92e0e84411cad62238108163680c3c4 100644
--- a/gcc/c-family/c-warn.c
+++ b/gcc/c-family/c-warn.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "function.h"
 #include "tree.h"
 #include "c-common.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "diagnostic.h"
 #include "intl.h"
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index e5c725603978dd8d5b75a0f3e4b7f697a3d49c85..f0917ed788c91b2a2c8701438150f0e634c9402b 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "memmodel.h"
 #include "target.h"
 #include "function.h"
 #include "bitmap.h"
diff --git a/gcc/caller-save.c b/gcc/caller-save.c
index caf6486a5a80369f7973df053dc229373a16d578..24546bf9db35e01817dd7992d26c8e387f71143b 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/calls.c b/gcc/calls.c
index 86369e9cfdc832a13599172a3b7f02827dce09c7..66b34b8f1438d8e3b8d578fea3150cdb6342fcd4 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "gimple.h"
 #include "predict.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "expmed.h"
diff --git a/gcc/ccmp.c b/gcc/ccmp.c
index 6f95acec95b547b5efb67152d373a174b4ac092c..615b7e653f209d57374dd0745c07be243cd6af4a 100644
--- a/gcc/ccmp.c
+++ b/gcc/ccmp.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "gimple.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "ssa.h"
 #include "expmed.h"
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index edecab52f5d64d15621f0b78dc9b24dc687a633b..40c011d9aea9d708e8e045a7cd129edeaf79242e 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "backend.h"
 #include "rtl.h"
 #include "cfghooks.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "cfgrtl.h"
 #include "cfganal.h"
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 2e2a63559f520cb57af305b8031fd2cc9c26da13..1c9691dfa124429d03fba7161106e280b9c94fde 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -38,6 +38,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "emit-rtl.h"
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index c7a2faa72006908221d1094c4d71f57e084bf147..803ca10e2903073ad968610190cdc3247d6c2f82 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "cfghooks.h"
 #include "tree-pass.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "ssa.h"
 #include "optabs.h"
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c
index 001cf45ee9c975bfd9cc3dd33867756e0fcb6403..9ea48b1eb2be68d05bc4601bad7724f609210bb6 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "predict.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "cfgloop.h"
 #include "explow.h"
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index de07fcd4b1d7cd887af1c15b94d94eb8cf1f1d23..c1f0322a60116ac7e98ecb7761cf2fc896b53fd0 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -47,6 +47,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "cfghooks.h"
 #include "df.h"
 #include "insn-config.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "cfgrtl.h"
 #include "cfganal.h"
diff --git a/gcc/cilk-common.c b/gcc/cilk-common.c
index 9a2ed9d3b537ce1f30015da3d3da423155ccc4c5..ecd7abe0adf57cd185338a7efbadaeb6e2e6f2bc 100644
--- a/gcc/cilk-common.c
+++ b/gcc/cilk-common.c
@@ -31,6 +31,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "expmed.h"
 #include "optabs-query.h"
 #include "insn-config.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "recog.h"
 #include "fold-const.h"
diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index a74b65ab095388e987ec63310343878ba62020e3..3302550fc271d442b3145e4bb2ab55da42139fe4 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -45,6 +45,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "df.h"
 #include "insn-config.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "recog.h"
 #include "cfgrtl.h"
diff --git a/gcc/combine.c b/gcc/combine.c
index b27aae5f02fb8547a8b6440b524d030870561a62..272768398b4ab58ca6842cba120855c4bba7f5ca 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -84,6 +84,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/common/config/aarch64/aarch64-common.c b/gcc/common/config/aarch64/aarch64-common.c
index 09debee06b80d2208424dcadcd4fc194f08ad7f5..90f5f6bce3208ea8e26c5a1afd29d00ec7b418b9 100644
--- a/gcc/common/config/aarch64/aarch64-common.c
+++ b/gcc/common/config/aarch64/aarch64-common.c
@@ -23,6 +23,7 @@ 
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "common/common-target.h"
 #include "common/common-target-def.h"
diff --git a/gcc/common/config/arm/arm-common.c b/gcc/common/config/arm/arm-common.c
index a9abd6b026e2f35844e810fecf09e9890ea41e21..f3b674339a50460d55920ca8d26275a550bbbc1e 100644
--- a/gcc/common/config/arm/arm-common.c
+++ b/gcc/common/config/arm/arm-common.c
@@ -21,6 +21,7 @@ 
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "common/common-target.h"
 #include "common/common-target-def.h"
diff --git a/gcc/common/config/bfin/bfin-common.c b/gcc/common/config/bfin/bfin-common.c
index 770aa1c3eaa6f80d1ec89f1816a60aea0d29adb2..ceee72f7cb9258f6fc00d7750c1f3d8650699bb4 100644
--- a/gcc/common/config/bfin/bfin-common.c
+++ b/gcc/common/config/bfin/bfin-common.c
@@ -22,6 +22,7 @@ 
 #include "coretypes.h"
 #include "diagnostic-core.h"
 #include "tm.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "common/common-target.h"
 #include "common/common-target-def.h"
diff --git a/gcc/common/config/c6x/c6x-common.c b/gcc/common/config/c6x/c6x-common.c
index 758358d8596c75924d34cc7f7ff2b69216b8e3ab..38be5ba6a4edfd5dc3ce5508345b1f10b0abb4a5 100644
--- a/gcc/common/config/c6x/c6x-common.c
+++ b/gcc/common/config/c6x/c6x-common.c
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "diagnostic-core.h"
 #include "tm.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "common/common-target.h"
 #include "common/common-target-def.h"
diff --git a/gcc/common/config/i386/i386-common.c b/gcc/common/config/i386/i386-common.c
index ce1b5f74d9fccbbba8d0c3804233a76c93115cac..d20115439a0fbbce44e30273c2def2727916cefc 100644
--- a/gcc/common/config/i386/i386-common.c
+++ b/gcc/common/config/i386/i386-common.c
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "diagnostic-core.h"
 #include "tm.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "common/common-target.h"
 #include "common/common-target-def.h"
diff --git a/gcc/common/config/ia64/ia64-common.c b/gcc/common/config/ia64/ia64-common.c
index 47c71dea342cec95342708a200ba61795396c07a..65879fc41fbd04bedddd487a1f0f57e7e3469070 100644
--- a/gcc/common/config/ia64/ia64-common.c
+++ b/gcc/common/config/ia64/ia64-common.c
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "diagnostic-core.h"
 #include "tm.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "common/common-target.h"
 #include "common/common-target-def.h"
diff --git a/gcc/common/config/nvptx/nvptx-common.c b/gcc/common/config/nvptx/nvptx-common.c
index 2582e988fe557267052d27c4684969ab65763bbd..27904120b6e21fb6dd43c1eebb12ada21f8d5b4e 100644
--- a/gcc/common/config/nvptx/nvptx-common.c
+++ b/gcc/common/config/nvptx/nvptx-common.c
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "diagnostic-core.h"
 #include "tm.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "common/common-target.h"
 #include "common/common-target-def.h"
diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c
index e7fdce83734a84fb107ae05c7a72aa0b0e1a3952..329f18f8be78b313f1ab761a47306ed886986c80 100644
--- a/gcc/compare-elim.c
+++ b/gcc/compare-elim.c
@@ -61,6 +61,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "rtl.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "recog.h"
diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c
index b3625801761fd5bc3891920fe27f69756e92db6e..594a6151e69e35e8e5a5a9b0542c81c1610f962e 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -27,6 +27,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "gimple.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "expmed.h"
 #include "optabs.h"
diff --git a/gcc/config/aarch64/aarch64-c.c b/gcc/config/aarch64/aarch64-c.c
index 3380ed6f2cd0ae35fd6a4e53177604256875e6de..422e3221eea131772ead9c4f9dd73526e7cd9bcb 100644
--- a/gcc/config/aarch64/aarch64-c.c
+++ b/gcc/config/aarch64/aarch64-c.c
@@ -22,6 +22,7 @@ 
 #include "coretypes.h"
 #include "tm.h"
 #include "input.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "flags.h"
 #include "c-family/c-common.h"
diff --git a/gcc/config/aarch64/cortex-a57-fma-steering.c b/gcc/config/aarch64/cortex-a57-fma-steering.c
index 1bf804b4873c6b32e0eb3d640a74c2e52843e796..214db4a101072cd1121add83a678cfe7092a0581 100644
--- a/gcc/config/aarch64/cortex-a57-fma-steering.c
+++ b/gcc/config/aarch64/cortex-a57-fma-steering.c
@@ -28,6 +28,7 @@ 
 #include "df.h"
 #include "insn-config.h"
 #include "regs.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "recog.h"
 #include "cfganal.h"
diff --git a/gcc/config/arc/arc-c.c b/gcc/config/arc/arc-c.c
index 3bf3fd26c2c46acd0fef6050036afda4620a6ec8..e89bc5c51e9919b414686735549142e80a7b21a0 100644
--- a/gcc/config/arc/arc-c.c
+++ b/gcc/config/arc/arc-c.c
@@ -22,6 +22,7 @@ 
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "cpplib.h"
 #include "c-family/c-common.h"
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 5e8d6b4209ddc478e0ded032c5b1fe60885619e8..21bba0cc2db14d74937ae04bef15a6c36d626168 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -31,6 +31,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "memmodel.h"
 #include "backend.h"
 #include "target.h"
 #include "rtl.h"
diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c
index 4fafefc4050a94ff8da0d214dcdbc046890fe927..319517128b0985a4ab4a6e21d813bf5a3ab481fc 100644
--- a/gcc/config/arm/arm-builtins.c
+++ b/gcc/config/arm/arm-builtins.c
@@ -25,6 +25,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "gimple-expr.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "emit-rtl.h"
diff --git a/gcc/config/arm/arm-c.c b/gcc/config/arm/arm-c.c
index 72837001d1011e366233236a6ba3d1e5775583b1..6a1cddb1c38a82fc895620687f1b3dfc27668725 100644
--- a/gcc/config/arm/arm-c.c
+++ b/gcc/config/arm/arm-c.c
@@ -21,6 +21,7 @@ 
 #include "coretypes.h"
 #include "target.h"
 #include "c-family/c-common.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "c-family/c-pragma.h"
 #include "stringpool.h"
diff --git a/gcc/config/avr/avr-c.c b/gcc/config/avr/avr-c.c
index 270b803edf0a6abc973b29d2f0f92a9c6fb00fee..6d363c9d20c1b8030bb08b818275921b412e28ed 100644
--- a/gcc/config/avr/avr-c.c
+++ b/gcc/config/avr/avr-c.c
@@ -26,6 +26,7 @@ 
 #include "c-family/c-common.h"
 #include "stor-layout.h"
 #include "langhooks.h"
+#include "memmodel.h"
 #include "tm_p.h"
 
 /* IDs for all the AVR builtins.  */
diff --git a/gcc/config/avr/avr-log.c b/gcc/config/avr/avr-log.c
index fe2cae46eff560b5f71873b9cdc0a7d5f34f4ae2..46578d608f320e7ff8bfab722736ac2ce954516c 100644
--- a/gcc/config/avr/avr-log.c
+++ b/gcc/config/avr/avr-log.c
@@ -26,6 +26,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "tree-pass.h"	/* for current_pass */
+#include "memmodel.h"
 #include "tm_p.h"
 #include "print-tree.h"
 
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 7310b54f9ed46252e2001fcae4b606def4197757..3945122e2f3b46a39b02cbecb9f687a426fea0f5 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -27,6 +27,7 @@ 
 #include "c-family/c-common.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index a91e47ed163c696cb78c32bc2e66e53c3fe0958f..9b81868984a315e9786c4934de9b6d0cf6009c3e 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -27,6 +27,7 @@ 
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c
index 305f31ea0b338f8c466e682b8813553b01ec67a9..f8c3d668dbe300d5082d449c7b93c0ed5dcb6057 100644
--- a/gcc/config/c6x/c6x.c
+++ b/gcc/config/c6x/c6x.c
@@ -29,6 +29,7 @@ 
 #include "gimple-expr.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "optabs.h"
diff --git a/gcc/config/cr16/cr16.c b/gcc/config/cr16/cr16.c
index 13e8e475ae9960988cd126a67a34c995038d10b2..530ccba44da1a57263d101f0145103eedea40392 100644
--- a/gcc/config/cr16/cr16.c
+++ b/gcc/config/cr16/cr16.c
@@ -26,6 +26,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "regs.h"
 #include "emit-rtl.h"
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c
index 7532b8e501a0a1b78f4644cd3eab74cd731b36c1..a8252193b58170f4aeba8eb246cf2707628c72f1 100644
--- a/gcc/config/cris/cris.c
+++ b/gcc/config/cris/cris.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index 23ec18041955a28a8852664a1d87a7476750bdc0..ed032b971df1c624a0e900369173f1b350935a69 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "c-family/c-target.h"
 #include "c-family/c-target-def.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "cgraph.h"
 #include "incpath.h"
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index f8da9591be882bb2deec257c85fd14b6c129903d..ff8600c74416a62cf3461989a7b43374d2cf4df1 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -28,6 +28,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "insn-config.h"
diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c
index b871ccb3feb98d82aefc46d35a3fb0359bfa72aa..a7854e7baccb64d73f077d430647ae7c01903af3 100644
--- a/gcc/config/epiphany/epiphany.c
+++ b/gcc/config/epiphany/epiphany.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "optabs.h"
diff --git a/gcc/config/epiphany/mode-switch-use.c b/gcc/config/epiphany/mode-switch-use.c
index d7fbae31868f2e962d64ea79643ed9e869ba3281..9f1c56ae0da515c8fc7ecd51a639f45e1e87ae20 100644
--- a/gcc/config/epiphany/mode-switch-use.c
+++ b/gcc/config/epiphany/mode-switch-use.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "backend.h"
 #include "rtl.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "emit-rtl.h"
 #include "tree-pass.h"
diff --git a/gcc/config/epiphany/resolve-sw-modes.c b/gcc/config/epiphany/resolve-sw-modes.c
index 603886b57cece380c556da5a4b7aeb0121e42311..f1aafdc66ea5100f83d8fee648140e6c55b5820e 100644
--- a/gcc/config/epiphany/resolve-sw-modes.c
+++ b/gcc/config/epiphany/resolve-sw-modes.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "backend.h"
 #include "rtl.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "emit-rtl.h"
diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c
index 741a0136640677f0d75af93b746fd8846798a52d..187302bc02564bf1f82fc590365d1ad9d9ed3453 100644
--- a/gcc/config/fr30/fr30.c
+++ b/gcc/config/fr30/fr30.c
@@ -28,6 +28,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "stor-layout.h"
 #include "varasm.h"
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index 60c3863bbad4ec14168cd6dee857cad8c47c66bd..352bcff681de6a211de72507b26c13921ab4e58f 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "optabs.h"
diff --git a/gcc/config/ft32/ft32.c b/gcc/config/ft32/ft32.c
index 216a80404287263e083db373b356a56039958365..6ac87017f64a6e109e705bfbb4038d3669b9bda5 100644
--- a/gcc/config/ft32/ft32.c
+++ b/gcc/config/ft32/ft32.c
@@ -26,6 +26,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "regs.h"
 #include "emit-rtl.h"
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 943356781e7fbf22c6cbf1495f8c10dc5a53fcae..3d06014c23bbc77bb28e6de3ad68babc25138f6f 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "optabs.h"
diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c
index d4d2674eb643a626869367949ae6ec6ff0b39bd0..9bb80c00afc2a3d65ead4921f9f71185081656cb 100644
--- a/gcc/config/i386/i386-c.c
+++ b/gcc/config/i386/i386-c.c
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "target.h"
 #include "c-family/c-common.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "c-family/c-pragma.h"
 
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index e2b2f4b516c0660247fcdb4cea53c7dc403ee413..fdc89e0e97219f95f3402844fc69d9566e4cdca6 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "gimple.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "emit-rtl.h"
diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c
index c7e5f199b8f1932e6f684770625a2bdb078ebfc9..7be7ee52186c391c95149b5e3caa4db8ccb9c6ec 100644
--- a/gcc/config/iq2000/iq2000.c
+++ b/gcc/config/iq2000/iq2000.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/config/lm32/lm32.c b/gcc/config/lm32/lm32.c
index 8a102207f0d613f7b1980efbedd0b895adeb5562..99e2695dd48aa891dd36648f24e3d7749a131ad7 100644
--- a/gcc/config/lm32/lm32.c
+++ b/gcc/config/lm32/lm32.c
@@ -27,6 +27,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c
index 1db1ef7ade1690f0d54ac69772213222bc7b4de2..7d64c49d3bfc7228793c7de3f60ab2a754f33b76 100644
--- a/gcc/config/m32c/m32c.c
+++ b/gcc/config/m32c/m32c.c
@@ -26,6 +26,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
index dda3961bf303de4e2db7d055e89676afdcbb273a..17e48f545bf2c77a01af77e0433de0c336e001dc 100644
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -25,6 +25,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "insn-config.h"
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index a104193c23c51cc5fa3b26f3bb02486a03470878..8e7dbf38fa3f90ab8c43f5180c6aa7042e7c2b0d 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -41,6 +41,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "expmed.h"
 #include "dojump.h"
 #include "explow.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "stmt.h"
 #include "expr.h"
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index 3afe42c0c86e0178f3a7866e083cc6a84f2b4301..b8dc2d0259141c5a3bf82fe5e43e72e93e573c46 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -25,6 +25,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "emit-rtl.h"
diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
index e32fa0eca7511be5c06b685169def374c60639f5..0fb273f24d056ad526891223df8d43765f936461 100644
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -27,6 +27,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index bf06e3b1933f9cc3cda846449975fca8e303f09a..7029c3d2a6739ebc33005bea5fc760efc1402d36 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index 81c8506a0ff82f01e550a3faeca675391f6fed27..dbbc4db1410ba58a74c51c24802045c0ea7192b1 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -28,6 +28,7 @@ 
 #include "cfghooks.h"
 #include "cfgloop.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c
index 9d376f1959b49dfaea42786df9d05e16c7e3dc48..0de591e8d18d645d054e537b3ae2ed1a34edc484 100644
--- a/gcc/config/moxie/moxie.c
+++ b/gcc/config/moxie/moxie.c
@@ -27,6 +27,7 @@ 
 #include "tree.h"
 #include "df.h"
 #include "regs.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "diagnostic-core.h"
 #include "output.h"
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
index 93431765562b47cfd45814ddaf6174dc5af39853..50f6815e32f74ad6e95c09b2d56922a53a341cf9 100644
--- a/gcc/config/msp430/msp430.c
+++ b/gcc/config/msp430/msp430.c
@@ -27,6 +27,7 @@ 
 #include "tree.h"
 #include "gimple-expr.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "regs.h"
 #include "emit-rtl.h"
diff --git a/gcc/config/nds32/nds32-cost.c b/gcc/config/nds32/nds32-cost.c
index e6a29fc9dbfb2a92c4b9f6243c10f38d1e722b2a..a38e3483fa3481fe51e4fb1c0b567d6f9b597704 100644
--- a/gcc/config/nds32/nds32-cost.c
+++ b/gcc/config/nds32/nds32-cost.c
@@ -27,6 +27,7 @@ 
 #include "target.h"
 #include "rtl.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"		/* For GEN_FCN.  */
 #include "recog.h"
diff --git a/gcc/config/nds32/nds32-intrinsic.c b/gcc/config/nds32/nds32-intrinsic.c
index fabf262e3cb02f691854399ad5cba8b43746b8be..d3428ca2e4339adb602d84892bdafd5000e09011 100644
--- a/gcc/config/nds32/nds32-intrinsic.c
+++ b/gcc/config/nds32/nds32-intrinsic.c
@@ -27,6 +27,7 @@ 
 #include "target.h"
 #include "rtl.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "optabs.h"		/* For GEN_FCN.  */
 #include "diagnostic-core.h"
 #include "stor-layout.h"
diff --git a/gcc/config/nds32/nds32-md-auxiliary.c b/gcc/config/nds32/nds32-md-auxiliary.c
index def8eda417e772a8d5c3e6f09070417fb58fda98..c4f3aac3dfccc0fe59af16b349b5e16bad0b378d 100644
--- a/gcc/config/nds32/nds32-md-auxiliary.c
+++ b/gcc/config/nds32/nds32-md-auxiliary.c
@@ -28,6 +28,7 @@ 
 #include "target.h"
 #include "rtl.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"		/* For GEN_FCN.  */
 #include "recog.h"
diff --git a/gcc/config/nds32/nds32-memory-manipulation.c b/gcc/config/nds32/nds32-memory-manipulation.c
index 4c26dcc7bbcb369361aaa3f454e218a7cf36591e..0b0acf757d29719075909aae215d003aa1e547c7 100644
--- a/gcc/config/nds32/nds32-memory-manipulation.c
+++ b/gcc/config/nds32/nds32-memory-manipulation.c
@@ -27,6 +27,7 @@ 
 #include "backend.h"
 #include "target.h"
 #include "rtl.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "explow.h"
 
diff --git a/gcc/config/nds32/nds32-predicates.c b/gcc/config/nds32/nds32-predicates.c
index 361d0018627c0971cca11c2b359ba4be9d2cee2b..251219f95ab2aca8f4ecf635a8140aa1f86d306c 100644
--- a/gcc/config/nds32/nds32-predicates.c
+++ b/gcc/config/nds32/nds32-predicates.c
@@ -27,6 +27,7 @@ 
 #include "target.h"
 #include "rtl.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"		/* For GEN_FCN.  */
 #include "emit-rtl.h"
diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c
index 7b0d74745171e682bef601ac40336c9e7c64f8e7..6a0e53fc180db07172c99798127e1c7f5a98fdda 100644
--- a/gcc/config/nds32/nds32.c
+++ b/gcc/config/nds32/nds32.c
@@ -28,6 +28,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"		/* For GEN_FCN.  */
 #include "regs.h"
diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c
index 632adadb072566ed8f455c10045ef1e5779a5cd9..8afb46838c45661224b270d992b2c134d8c3ae52 100644
--- a/gcc/config/nios2/nios2.c
+++ b/gcc/config/nios2/nios2.c
@@ -28,6 +28,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index 16e04a4f726640e0b64368a91425623819ffa802..6ec8eb41eaa6f40353f81299fa407c4f42f7e30f 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -28,6 +28,7 @@ 
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "expmed.h"
 #include "optabs.h"
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index a02010c9ccffbbf975d9c9e01fdc9449d1b58e06..e04abd43cd02c052da5bcec38fb88fc204f6d955 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.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 "memmodel.h"
 #include "backend.h"
 #include "target.h"
 #include "rtl.h"
diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c
index 7fa08cbf66a3357b0ec1ef9a699972260aeaf19a..1dc3eefab30127a7f11e7b1091c39d94e4c7210f 100644
--- a/gcc/config/pdp11/pdp11.c
+++ b/gcc/config/pdp11/pdp11.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
index a4e4be27a6a0f7e717361b34b278ff08e3c08c1f..08ab8996f4c263a5400659be86de4706a89c2b3d 100644
--- a/gcc/config/rl78/rl78.c
+++ b/gcc/config/rl78/rl78.c
@@ -26,6 +26,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "optabs.h"
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index c98a54f995717920371cf8f0749b1acf3da12023..b7ca47286fbe3e45fcf1d82c222126531a108348 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -25,6 +25,7 @@ 
 #include "coretypes.h"
 #include "target.h"
 #include "c-family/c-common.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "stor-layout.h"
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index 8dfc8856abe542cd554169a7bb5d0dababbd2cb9..44c6b68ce7c423c6fed15143790343f55e76d977 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -31,6 +31,7 @@ 
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "regs.h"
 #include "emit-rtl.h"
diff --git a/gcc/config/s390/s390-c.c b/gcc/config/s390/s390-c.c
index cd3584bfdda20c477a0d29a73ac041d6a8eb9340..fcf74774340e70d1f3f056d185a67b1bf1265838 100644
--- a/gcc/config/s390/s390-c.c
+++ b/gcc/config/s390/s390-c.c
@@ -34,6 +34,7 @@ 
 #include "tree.h"
 #include "c-family/c-common.h"
 #include "c/c-tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "c-family/c-pragma.h"
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 3bdb64871af9ed2756360e48543171261fd97496..230c6ca989caeae13b0ec8ebd14826bde5cb7c85 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -32,6 +32,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "cfghooks.h"
 #include "cfgloop.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "expmed.h"
diff --git a/gcc/config/sh/sh-c.c b/gcc/config/sh/sh-c.c
index b854a69c8ce756d4adc6ae3f16c083c4a2ed7754..595b5307f59d7c8f5c1c9d05472262ac8004b7ec 100644
--- a/gcc/config/sh/sh-c.c
+++ b/gcc/config/sh/sh-c.c
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "target.h"
 #include "c-family/c-common.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "attribs.h"
diff --git a/gcc/config/sh/sh-mem.cc b/gcc/config/sh/sh-mem.cc
index 6128adfde7e90123ce7530c4fc6009bd9613bc39..1773f1df4d38f9a88d0e5c2a79b025844e092a0a 100644
--- a/gcc/config/sh/sh-mem.cc
+++ b/gcc/config/sh/sh-mem.cc
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "basic-block.h"
 #include "rtl.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "emit-rtl.h"
 #include "explow.h"
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 4152ecf28f4f11c0b24c4b69575d2ef8b0dc59aa..cf5231ef16dad80b68b45c18c14bea5207e1fe70 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -32,6 +32,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "optabs.h"
diff --git a/gcc/config/sh/sh_treg_combine.cc b/gcc/config/sh/sh_treg_combine.cc
index 4d40715db7987d38b48fc40bdee2ed7f830e969d..5de3338e43b8655adc5b84a8af0f7adacb1245d6 100644
--- a/gcc/config/sh/sh_treg_combine.cc
+++ b/gcc/config/sh/sh_treg_combine.cc
@@ -28,6 +28,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "rtl.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "optabs.h"
 #include "emit-rtl.h"
 #include "recog.h"
diff --git a/gcc/config/sol2.c b/gcc/config/sol2.c
index 30c525acbc347877c360af9be461a85b1b8ba56d..fcab9de054c60c3335ea4e96460f8cbde1a75ba9 100644
--- a/gcc/config/sol2.c
+++ b/gcc/config/sol2.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "rtl.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "diagnostic-core.h"
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 28173e5123c2c208b7e10255cbcc952a5f9bb421..5b59b7270a918b3f9b8bd75eeacd62096a1214e1 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -25,6 +25,7 @@ 
 #include "cfghooks.h"
 #include "cfgloop.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "expmed.h"
diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c
index 1eb95f57f9f82ef97d05905561e6d9daab75e0c5..531a7e92505c9e5d190feb5462c0176439fa7472 100644
--- a/gcc/config/stormy16/stormy16.c
+++ b/gcc/config/stormy16/stormy16.c
@@ -27,6 +27,7 @@ 
 #include "tree.h"
 #include "gimple.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "optabs.h"
diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c
index d743c63bd592c191c9ffc74f27deafb7d950fbbb..28996142e8d62328cf79807b0669646a8011de11 100644
--- a/gcc/config/tilegx/tilegx.c
+++ b/gcc/config/tilegx/tilegx.c
@@ -21,6 +21,7 @@ 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "memmodel.h"
 #include "backend.h"
 #include "target.h"
 #include "rtl.h"
diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c
index b39eff4b6a80d2aa65ac855b0fc12c257237184c..92bcfa5c87bc78f3e88eec2dca5933647d70af65 100644
--- a/gcc/config/tilepro/tilepro.c
+++ b/gcc/config/tilepro/tilepro.c
@@ -27,6 +27,7 @@ 
 #include "tree.h"
 #include "gimple.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "expmed.h"
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c
index f1716d1a9cd0036afe6462fef3bd46a8a47976f1..47344fc68e7c26fab9e23ca4f42b77c970947cf0 100644
--- a/gcc/config/v850/v850.c
+++ b/gcc/config/v850/v850.c
@@ -26,6 +26,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "insn-config.h"
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index 06ab5715ec31bfd4ff26336e6c18a82196cfab3e..732ebeeb36a4080f601e1acdaf5032bb3374b40a 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/config/visium/visium.c b/gcc/config/visium/visium.c
index 4585af578949990c7f5dff163bdd7c0b671dfd00..3f843f5d9705f9d411a9a375b22fd210a35fa663 100644
--- a/gcc/config/visium/visium.c
+++ b/gcc/config/visium/visium.c
@@ -27,6 +27,7 @@ 
 #include "tree.h"
 #include "gimple-expr.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "expmed.h"
diff --git a/gcc/config/vms/vms-c.c b/gcc/config/vms/vms-c.c
index 392b2db877809d13ca155f7177b9e2cdda56cce5..12c9c78a03c090c442b38d7ee54cba4beda4a6f9 100644
--- a/gcc/config/vms/vms-c.c
+++ b/gcc/config/vms/vms-c.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "c-family/c-common.h"
 #include "c/c-tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "c-family/c-pragma.h"
 #include "toplev.h"
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 07c9e8f1fb2b33d1bf4738ba167062be69576c31..60e50296d349342162f4ca474bebf72dc7c86898 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -28,6 +28,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "optabs.h"
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index fe1e984311cdad337d62b249924011a94ab80771..70f909dbf7f847e46f5d43c55fb90f42702dc2d5 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -331,34 +331,6 @@  enum symbol_visibility
   VISIBILITY_INTERNAL
 };
 
-/* Suppose that higher bits are target dependent. */
-#define MEMMODEL_MASK ((1<<16)-1)
-
-/* Legacy sync operations set this upper flag in the memory model.  This allows
-   targets that need to do something stronger for sync operations to
-   differentiate with their target patterns and issue a more appropriate insn
-   sequence.  See bugzilla 65697 for background.  */
-#define MEMMODEL_SYNC (1<<15)
-
-/* Memory model without SYNC bit for targets/operations that do not care.  */
-#define MEMMODEL_BASE_MASK (MEMMODEL_SYNC-1)
-
-/* Memory model types for the __atomic* builtins. 
-   This must match the order in libstdc++-v3/include/bits/atomic_base.h.  */
-enum memmodel
-{
-  MEMMODEL_RELAXED = 0,
-  MEMMODEL_CONSUME = 1,
-  MEMMODEL_ACQUIRE = 2,
-  MEMMODEL_RELEASE = 3,
-  MEMMODEL_ACQ_REL = 4,
-  MEMMODEL_SEQ_CST = 5,
-  MEMMODEL_LAST = 6,
-  MEMMODEL_SYNC_ACQUIRE = MEMMODEL_ACQUIRE | MEMMODEL_SYNC,
-  MEMMODEL_SYNC_RELEASE = MEMMODEL_RELEASE | MEMMODEL_SYNC,
-  MEMMODEL_SYNC_SEQ_CST = MEMMODEL_SEQ_CST | MEMMODEL_SYNC
-};
-
 /* Support for user-provided GGC and PCH markers.  The first parameter
    is a pointer to a pointer, the second a cookie.  */
 typedef void (*gt_pointer_operator) (void *, void *);
diff --git a/gcc/coverage.c b/gcc/coverage.c
index a759831ab1ae75841b00430eae2cf03e00cc1842..8810710be4f306a9a9f5b4d44da0ca86c546375e 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -32,6 +32,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "tree-pass.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "cgraph.h"
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 5a04bc7e31edf294d9ad8615dc691d874059b3f3..ea9d379989d6631b2af64071fd88db5ca7a9b03b 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -29,6 +29,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "memmodel.h"
 #include "target.h"
 #include "cp-tree.h"
 #include "c-family/c-common.h"
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index a8827615a7ce46225974b9abaf47bc46d69e3c86..cfbc3d40680dcc6661c647d1accb636c1f8b5b81 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "target.h"
 #include "cp-tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "intl.h"
diff --git a/gcc/cppbuiltin.c b/gcc/cppbuiltin.c
index 69ccdb918466b651605d352b8cc3f38dd4e14e99..3a86b2a10c82323d4177886fe7a9ec2c8e2a4b4f 100644
--- a/gcc/cppbuiltin.c
+++ b/gcc/cppbuiltin.c
@@ -20,6 +20,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "memmodel.h"
 #include "target.h"
 #include "tree.h"
 #include "version.h"
diff --git a/gcc/cprop.c b/gcc/cprop.c
index 199e990a15dff3d64b2c1b66afe625ae56c48ef7..6b4c0b8fa389f3f2ab065f4dbc7044c72fcd0338 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "cfghooks.h"
 #include "df.h"
 #include "insn-config.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "recog.h"
 #include "diagnostic-core.h"
diff --git a/gcc/cse.c b/gcc/cse.c
index 7069fab6b3850401eff51a9366d72bc180a88ad6..8b9e4a116ac6c3b54435aeaa9213caec2b8172c2 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/cselib.c b/gcc/cselib.c
index 24e15bca2112395d9608048e092f5b005ddad3d7..3e1e9e75a2e52470cbd4c07f282eb596f90d74a7 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "regs.h"
 #include "emit-rtl.h"
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 52307f3cd3e3613ba87928a59b4a80323ce1e19a..33014174daba1a051cb07107ebf73923af2935b5 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -73,6 +73,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "function.h"
 #include "rtl.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "insn-config.h"
diff --git a/gcc/dce.c b/gcc/dce.c
index ea3fb00d433f60c4d58106ec917bc8d6a31f5aac..84023e07ad9d204a5eea433f731cf0ee3286c576 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "emit-rtl.h"  /* FIXME: Can go away once crtl is moved to rtl.h.  */
 #include "cfgrtl.h"
diff --git a/gcc/df-core.c b/gcc/df-core.c
index e531d581c23a819bb07c5b95738fa9478d031da3..f84d2742d4d2a13af9bf6b163c4f923727802776 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -380,6 +380,7 @@  are write-only operations.
 #include "backend.h"
 #include "rtl.h"
 #include "df.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "cfganal.h"
 #include "tree-pass.h"
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 290281ccd4f0982ba72274b29769e28f591bdfd1..6dbc126b69861fc8f5e88a1e20a13e32ee3a215f 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -28,6 +28,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "rtl.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "cfganal.h"
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index c8dbf8ddb00d4997b6a2f010d62367114573ac99..7cfd34b541993fc3246ce0ab131e24b7694e4fee 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -29,6 +29,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "regs.h"
 #include "emit-rtl.h"  /* FIXME: Can go away once crtl is moved to rtl.h.  */
diff --git a/gcc/dojump.c b/gcc/dojump.c
index d437b974526509b1a18aa239d93ba98cdef38a7b..5a32c34aee6d210b6bcb58ace7aef283f51c19bc 100644
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "predict.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "emit-rtl.h"
diff --git a/gcc/dse.c b/gcc/dse.c
index 9d222a947a18249b58b13705b95b6db72f76d0c0..95d5757140e6b7272188b708cfb0e5a234233ef1 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -32,6 +32,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "gimple-ssa.h"
 #include "expmed.h"
diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index cad550916d4c6c230ee3bae32e22b0c54953727e..473353885006231f6898efb5753e75b0f79899e2 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "rtl.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "varasm.h"
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 6491d5aaf4c4a21241cc718bfff1016f6d149951..da9da52353ea3a1a42e3e25cb5cb11e5f0358858 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "tree-pass.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "emit-rtl.h"
 #include "stor-layout.h"
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 98deeefd337f6f9b395e4ce2aa6e1629a4572fd1..5789fc82e2f2e42423cb7de1fda41607d5bed01b 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -62,6 +62,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "function.h"
 #include "rtl.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "insn-config.h"
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 2d6d1eb6c1311871f15dbed13d7c084ed3845a86..387438ce7f892bcee07c93e6905e79211525efc4 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -34,6 +34,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "memmodel.h"
 #include "backend.h"
 #include "target.h"
 #include "rtl.h"
diff --git a/gcc/except.c b/gcc/except.c
index 800ca2a27bad30e7b0d9ea1f1f2894ae0e1c8251..f0a1be0099f84fb494e025b67e295c74c84978e0 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -118,6 +118,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "cfghooks.h"
 #include "tree-pass.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "expmed.h"
diff --git a/gcc/explow.c b/gcc/explow.c
index b56aea694773e7f7be68c5fc8a671c765b71ef63..fbebcbd8e47ed06248b44a3d20a7338fa8a6057e 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "function.h"
 #include "rtl.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "expmed.h"
 #include "optabs.h"
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 2f789a2f07539ea0207d8deea20375fa37c07d92..fec0bbde8e824e9fc0b05484b0eeb24bd158faa4 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "predict.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "expmed.h"
 #include "optabs.h"
diff --git a/gcc/expr.c b/gcc/expr.c
index e6d110dd027bd3e8ee9eb8d7f0bda8a6ad2cfe04..b587da82180acb2b2d0479d010223965ec1a8b22 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "gimple.h"
 #include "predict.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "ssa.h"
 #include "expmed.h"
diff --git a/gcc/final.c b/gcc/final.c
index 29c12fddc67cb643aab55895da55213fe33d3c86..52d1589ad6ff116f8e70a4d9d17c499bc9309711 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -52,6 +52,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 02aa484a72745360d1308f864c31b0a6d57b4f9b..e2e05545fc02278f6e4056c61dfd76aabe038357 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -49,6 +49,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "gimple.h"
 #include "predict.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "tree-ssa-operands.h"
 #include "optabs-query.h"
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index a499c3273865481945b993d5cff64db0e6edfeb6..ed4d1640347eae66ba2e35be9cd45cf39db86ce3 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "memmodel.h"
 #include "tm.h"		/* For UNITS_PER_WORD.  */
 #include "tree.h"
 #include "gfortran.h"
diff --git a/gcc/function.c b/gcc/function.c
index cdd2721cdf904be6457d090fe20345d3dee0b4dd..de81d18d17b0323e2ba91276dbea78f19f764afc 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -41,6 +41,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple-expr.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "expmed.h"
diff --git a/gcc/fwprop.c b/gcc/fwprop.c
index 30d5739f0e3815c9d03c76a67a55b5d716c97ed8..4365ff0db90ecd8e7cfbaf65e85a561e54832ccb 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "emit-rtl.h"
diff --git a/gcc/gcse.c b/gcc/gcse.c
index c2c0e8ec690db96d93c91ecc8e7e69b79498b19a..9e396fea581a08751533674de490f2bb9e4868f4 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -141,6 +141,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "print-rtl.h"
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index 6e0a9b9b6265fafc8fd6ef4a310e1fbd832692cb..dbcdcfcca711a8b69cc4420c43e5eef2fdbc5506 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -5159,6 +5159,7 @@  write_header (FILE *outf)
   fprintf (outf, "#include \"stor-layout.h\"\n");
   fprintf (outf, "#include \"calls.h\"\n");
   fprintf (outf, "#include \"insn-attr.h\"\n");
+  fprintf (outf, "#include \"memmodel.h\"\n");
   fprintf (outf, "#include \"tm_p.h\"\n");
   fprintf (outf, "#include \"insn-config.h\"\n");
   fprintf (outf, "#include \"recog.h\"\n");
diff --git a/gcc/genautomata.c b/gcc/genautomata.c
index 92c8b5c390fe97a1a3696d01356a7a056f9b831a..f4c125eca8ba1e8a799dc5daff53d4eb824a1c6d 100644
--- a/gcc/genautomata.c
+++ b/gcc/genautomata.c
@@ -9651,6 +9651,7 @@  main (int argc, const char **argv)
 		"#include \"stor-layout.h\"\n"
 		"#include \"calls.h\"\n"
 		"#include \"rtl.h\"\n"
+		"#include \"memmodel.h\"\n"
 		"#include \"tm_p.h\"\n"
 		"#include \"insn-config.h\"\n"
 		"#include \"recog.h\"\n"
diff --git a/gcc/genconditions.c b/gcc/genconditions.c
index d8b0ebba56b8db4bea9e0edced03293152e51d02..923b23c81d9d9eb65fabea6b0584a06740d570bf 100644
--- a/gcc/genconditions.c
+++ b/gcc/genconditions.c
@@ -72,6 +72,7 @@  write_header (void)
 #include \"tm.h\"\n\
 #include \"insn-constants.h\"\n\
 #include \"rtl.h\"\n\
+#include \"memmodel.h\"\n\
 #include \"tm_p.h\"\n\
 #include \"hard-reg-set.h\"\n\
 #include \"function.h\"\n\
@@ -94,7 +95,6 @@  write_header (void)
 #include \"resource.h\"\n\
 #include \"diagnostic-core.h\"\n\
 #include \"reload.h\"\n\
-#include \"memmodel.h\"\n\
 #include \"tm-constrs.h\"\n");
 
   if (saw_eh_return)
diff --git a/gcc/genemit.c b/gcc/genemit.c
index d5e07a97a6d50f7b744e9d67ad49e72046e9df03..fe298951c784bcf5eb3c7413e467db7f81b967f6 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -773,6 +773,7 @@  from the machine description file `md'.  */\n\n");
   printf ("#include \"varasm.h\"\n");
   printf ("#include \"stor-layout.h\"\n");
   printf ("#include \"calls.h\"\n");
+  printf ("#include \"memmodel.h\"\n");
   printf ("#include \"tm_p.h\"\n");
   printf ("#include \"flags.h\"\n");
   printf ("#include \"insn-config.h\"\n");
@@ -792,7 +793,6 @@  from the machine description file `md'.  */\n\n");
   printf ("#include \"reload.h\"\n");
   printf ("#include \"diagnostic-core.h\"\n");
   printf ("#include \"regs.h\"\n");
-  printf ("#include \"memmodel.h\"\n");
   printf ("#include \"tm-constrs.h\"\n");
   printf ("#include \"ggc.h\"\n");
   printf ("#include \"dumpfile.h\"\n");
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index cecd552f7147dd92f823bd8369a92a8969029e35..760f9859184e7349f4984915192858560d478aa6 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -1710,14 +1710,14 @@  open_base_files (void)
       "config.h", "system.h", "coretypes.h", "backend.h", "predict.h", "tree.h",
       "rtl.h", "gimple.h", "fold-const.h", "insn-codes.h", "splay-tree.h",
       "alias.h", "insn-config.h", "flags.h", "expmed.h", "dojump.h",
-      "explow.h", "calls.h", "cilk.h", "emit-rtl.h", "varasm.h", "stmt.h",
-      "expr.h", "alloc-pool.h", "cselib.h", "insn-addr.h", "optabs.h",
-      "libfuncs.h", "debug.h", "internal-fn.h", "gimple-fold.h", "tree-eh.h",
-      "gimple-iterator.h", "gimple-ssa.h", "tree-cfg.h", "tree-vrp.h",
-      "tree-phinodes.h", "ssa-iterators.h", "stringpool.h", "tree-ssanames.h",
-      "tree-ssa-loop.h", "tree-ssa-loop-ivopts.h", "tree-ssa-loop-manip.h",
-      "tree-ssa-loop-niter.h", "tree-into-ssa.h", "tree-dfa.h", 
-      "tree-ssa.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
+      "explow.h", "calls.h", "cilk.h", "memmodel.h", "emit-rtl.h", "varasm.h",
+      "stmt.h", "expr.h", "alloc-pool.h", "cselib.h", "insn-addr.h",
+      "optabs.h", "libfuncs.h", "debug.h", "internal-fn.h", "gimple-fold.h",
+      "tree-eh.h", "gimple-iterator.h", "gimple-ssa.h", "tree-cfg.h",
+      "tree-vrp.h", "tree-phinodes.h", "ssa-iterators.h", "stringpool.h",
+      "tree-ssanames.h", "tree-ssa-loop.h", "tree-ssa-loop-ivopts.h",
+      "tree-ssa-loop-manip.h", "tree-ssa-loop-niter.h", "tree-into-ssa.h",
+      "tree-dfa.h", "tree-ssa.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
       "except.h", "output.h",  "cfgloop.h", "target.h", "lto-streamer.h",
       "target-globals.h", "ipa-ref.h", "cgraph.h", "symbol-summary.h",
       "ipa-prop.h", "ipa-inline.h", "dwarf2out.h", "omp-low.h", NULL
diff --git a/gcc/genopinit.c b/gcc/genopinit.c
index 5f4f354384e7566e094b8f2c6104e8953c05d653..b0e013c533e406bc27547b2b3c3c325a0c45f74d 100644
--- a/gcc/genopinit.c
+++ b/gcc/genopinit.c
@@ -257,6 +257,7 @@  main (int argc, const char **argv)
 	   "#include \"varasm.h\"\n"
 	   "#include \"stor-layout.h\"\n"
 	   "#include \"calls.h\"\n"
+	   "#include \"memmodel.h\"\n"
 	   "#include \"tm_p.h\"\n"
 	   "#include \"flags.h\"\n"
 	   "#include \"insn-config.h\"\n"
diff --git a/gcc/genoutput.c b/gcc/genoutput.c
index f792cb462bf73d395ba97daa7f2d65e4e62ce3dd..9b6dd09b6550d511588678dfe4bd83ca0209cae6 100644
--- a/gcc/genoutput.c
+++ b/gcc/genoutput.c
@@ -219,6 +219,7 @@  output_prologue (void)
   printf ("#include \"expmed.h\"\n");
   printf ("#include \"dojump.h\"\n");
   printf ("#include \"explow.h\"\n");
+  printf ("#include \"memmodel.h\"\n");
   printf ("#include \"emit-rtl.h\"\n");
   printf ("#include \"stmt.h\"\n");
   printf ("#include \"expr.h\"\n");
@@ -231,7 +232,6 @@  output_prologue (void)
   printf ("#include \"diagnostic-core.h\"\n");
   printf ("#include \"output.h\"\n");
   printf ("#include \"target.h\"\n");
-  printf ("#include \"memmodel.h\"\n");
   printf ("#include \"tm-constrs.h\"\n");
 }
 
diff --git a/gcc/genpeep.c b/gcc/genpeep.c
index e1997e03e476de910c57f7854b7b62edd5360b8f..a0a7a3b21adc6f2cb93e507777c5a1581f3526a6 100644
--- a/gcc/genpeep.c
+++ b/gcc/genpeep.c
@@ -366,6 +366,7 @@  from the machine description file `md'.  */\n\n");
   printf ("#include \"varasm.h\"\n");
   printf ("#include \"stor-layout.h\"\n");
   printf ("#include \"calls.h\"\n");
+  printf ("#include \"memmodel.h\"\n");
   printf ("#include \"tm_p.h\"\n");
   printf ("#include \"regs.h\"\n");
   printf ("#include \"output.h\"\n");
@@ -373,7 +374,6 @@  from the machine description file `md'.  */\n\n");
   printf ("#include \"except.h\"\n");
   printf ("#include \"diagnostic-core.h\"\n");
   printf ("#include \"flags.h\"\n");
-  printf ("#include \"memmodel.h\"\n");
   printf ("#include \"tm-constrs.h\"\n\n");
 
   printf ("extern rtx peep_operand[];\n\n");
diff --git a/gcc/genpreds.c b/gcc/genpreds.c
index 6db1b7b0301633b0354b49570d985fb02e4ede10..23a7e1841d5dfe9e4375425d6fa2523758481a89 100644
--- a/gcc/genpreds.c
+++ b/gcc/genpreds.c
@@ -1569,6 +1569,7 @@  write_insn_preds_c (void)
 #include \"varasm.h\"\n\
 #include \"stor-layout.h\"\n\
 #include \"calls.h\"\n\
+#include \"memmodel.h\"\n\
 #include \"tm_p.h\"\n\
 #include \"insn-config.h\"\n\
 #include \"recog.h\"\n\
@@ -1580,7 +1581,6 @@  write_insn_preds_c (void)
 #include \"reload.h\"\n\
 #include \"regs.h\"\n\
 #include \"emit-rtl.h\"\n\
-#include \"memmodel.h\"\n\
 #include \"tm-constrs.h\"\n");
 
   FOR_ALL_PREDICATES (p)
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index 778610744923bb1cd3e9ecfb5c93faa1c142063a..3e5b0f7a9e0185ac25c76a4e2cd6d0769681e66f 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -4181,6 +4181,7 @@  write_header (void)
 #include \"backend.h\"\n\
 #include \"predict.h\"\n\
 #include \"rtl.h\"\n\
+#include \"memmodel.h\"\n\
 #include \"tm_p.h\"\n\
 #include \"emit-rtl.h\"\n\
 #include \"insn-config.h\"\n\
@@ -4192,7 +4193,6 @@  write_header (void)
 #include \"diagnostic-core.h\"\n\
 #include \"reload.h\"\n\
 #include \"regs.h\"\n\
-#include \"memmodel.h\"\n\
 #include \"tm-constrs.h\"\n\
 \n");
 
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index 2b42b6e4f3930b63ff493fb987b1c9b3457a69c1..2148595394d5559517c791f910b737c121607dd6 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "alias.h"
 #include "tree.h"
 #include "rtl.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "diagnostic-core.h"
 #include "flags.h"
diff --git a/gcc/go/go-backend.c b/gcc/go/go-backend.c
index 99609f0fc1683b5ffe3fd6dceacab4b4c0877d4d..3a56f0a45df516115e628a62f3e0945587795151 100644
--- a/gcc/go/go-backend.c
+++ b/gcc/go/go-backend.c
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "target.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "diagnostic.h"
 #include "simple-object.h"
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 0ad080f253cbadfb174c0bf2a6d16dbb5a5baa18..fea9f5092169f9541c48cddcf7b09edafd1f5c15 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -130,6 +130,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/hsa-brig.c b/gcc/hsa-brig.c
index 4dc568c54e45b4e84b63949199a1549202f73bc9..66ff8f97e07fa4ae11622ce4b03a6c9a94a4f0d7 100644
--- a/gcc/hsa-brig.c
+++ b/gcc/hsa-brig.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"
 #include "target.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "is-a.h"
 #include "vec.h"
diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c
index 6f7083a15c997b25468c03bb8dbfc5c096b673a1..21c35e6089f73b91b0b7cf05185f5b0bffb3e7b4 100644
--- a/gcc/hsa-gen.c
+++ b/gcc/hsa-gen.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 "memmodel.h"
 #include "tm.h"
 #include "is-a.h"
 #include "hash-table.h"
diff --git a/gcc/hw-doloop.c b/gcc/hw-doloop.c
index c73b1060da1041b25231902cb67074166155db00..a046c24c9d3b54f8e82604245d952245fea306a0 100644
--- a/gcc/hw-doloop.c
+++ b/gcc/hw-doloop.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "df.h"
 #include "insn-config.h"
 #include "regs.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "recog.h"
 #include "cfgrtl.h"
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 24542f008485e6c28e068030fa301f2ce040efc1..68c7c3f7664744d2c27632442462f0afac846855 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -26,6 +26,7 @@ 
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "expmed.h"
 #include "optabs.h"
diff --git a/gcc/init-regs.c b/gcc/init-regs.c
index bb20978b2c223eb483dc6cb01d90ee6ea9f80b3a..3fbaee1cc44f4c47bca34045fa4ce9e3b769d5d2 100644
--- a/gcc/init-regs.c
+++ b/gcc/init-regs.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "expr.h"
 #include "tree-pass.h"
diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
index 029a534e9eb838c78f6b184f6ba4299ac5a20328..0b32d5f635bbcf1178a7ec27d341fd66ef1ced1b 100644
--- a/gcc/internal-fn.c
+++ b/gcc/internal-fn.c
@@ -30,6 +30,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree-vrp.h"
 #include "tree-ssanames.h"
 #include "expmed.h"
+#include "memmodel.h"
 #include "optabs.h"
 #include "emit-rtl.h"
 #include "diagnostic-core.h"
diff --git a/gcc/ira-build.c b/gcc/ira-build.c
index caa770e849f04324e36ba25cb7da63c110220113..4df78d6778935262b719945df07f687f8e138c34 100644
--- a/gcc/ira-build.c
+++ b/gcc/ira-build.c
@@ -28,6 +28,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "df.h"
 #include "insn-config.h"
 #include "regs.h"
+#include "memmodel.h"
 #include "ira.h"
 #include "ira-int.h"
 #include "params.h"
diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index 84334791e2ae8f8ccc8064ece7123df4fe3aa19a..5bbb33af7479bc10a7e8386fc81a2876564aec8a 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/ira-conflicts.c b/gcc/ira-conflicts.c
index 06a3eb56e94604f5936a9b49d353a0f897b3e592..17e47803922b44d7229bf5a09c73ce55043b5f41 100644
--- a/gcc/ira-conflicts.c
+++ b/gcc/ira-conflicts.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "rtl.h"
 #include "predict.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index f3d31e178afd09887f13164eff53100e4a99c656..bdd5cb5ceb6abaf7b3c7f3dd4e6c6ecde6190674 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "predict.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/ira-emit.c b/gcc/ira-emit.c
index 691bd1d20c4aec7ce71c75ee88c24ee1ae001ef7..c1c69490fac779f3b4743838addfca1f4246b2a2 100644
--- a/gcc/ira-emit.c
+++ b/gcc/ira-emit.c
@@ -75,6 +75,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "df.h"
 #include "insn-config.h"
 #include "regs.h"
+#include "memmodel.h"
 #include "ira.h"
 #include "ira-int.h"
 #include "cfgrtl.h"
diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c
index ff6d1006802b74529c61b1f1eb7cd77c63709442..6389796962f7b458ce9bd41471f0deb32fcd9ff0 100644
--- a/gcc/ira-lives.c
+++ b/gcc/ira-lives.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/ira.c b/gcc/ira.c
index c2e04c2b7a87d86de7e3268d39a4d8a017b132ea..94cfe2a04a11181a4492f0909bff6e3386477ed2 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -371,6 +371,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/jump.c b/gcc/jump.c
index 2164c3b8626e54cab80ede4fa9ac732cb9b5d2dc..e4bb93ff5eb6cc724eea113e9c414f30af27b110 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -42,6 +42,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "cfghooks.h"
 #include "tree-pass.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c
index 17a968fe6ab0022c0f2469702fd338ee79764eae..a80551960148610eefe3b43002e5c1e69380ae06 100644
--- a/gcc/loop-doloop.c
+++ b/gcc/loop-doloop.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "cfghooks.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "dojump.h"
 #include "expr.h"
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index d550a841d0695b9b55344e1655f6f9f3f79f1976..551103fcf4698cd66709b309fe50b6a9a38efcb6 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -43,6 +43,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index 78bec9e85217480ab01b5d4631af72e5f0810452..9e13938d950fc580bc8444c313a76718566c3e94 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -53,6 +53,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "backend.h"
 #include "rtl.h"
 #include "df.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "diagnostic-core.h"
 #include "cfgloop.h"
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 2d5fe48411b4d2801ecbdb594e9b78d455240259..494504d61e6b4e861123ad974428416f9ebb6032 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "cfghooks.h"
+#include "memmodel.h"
 #include "optabs.h"
 #include "emit-rtl.h"
 #include "recog.h"
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 4ea763b1e278c026fd97afc456223bf9fb451277..9675eedeca816f847bb80fe55952207564991699 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "expmed.h"
 #include "insn-config.h"
diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c
index 7248f89869e267ab10780dc94d84d48f687c5cd9..936a16990ef243e268569d9d084d65f0e168a1d4 100644
--- a/gcc/lra-assigns.c
+++ b/gcc/lra-assigns.c
@@ -83,6 +83,7 @@  along with GCC; see the file COPYING3.	If not see
 #include "tree.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/lra-coalesce.c b/gcc/lra-coalesce.c
index 178ed3ff5cbfbb57c104a33134732ccc7c626d30..0a9f7793ee8bc31e26355736f9547797891d3231 100644
--- a/gcc/lra-coalesce.c
+++ b/gcc/lra-coalesce.c
@@ -51,6 +51,7 @@  along with GCC; see the file COPYING3.	If not see
 #include "df.h"
 #include "insn-config.h"
 #include "regs.h"
+#include "memmodel.h"
 #include "ira.h"
 #include "recog.h"
 #include "lra-int.h"
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index bf5b521f51cd444e6e24064706aac59951db5312..117d84dc837fb16c075a55bba34ef5698ace07b8 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -115,6 +115,7 @@ 
 #include "tree.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "expmed.h"
 #include "optabs.h"
diff --git a/gcc/lra-eliminations.c b/gcc/lra-eliminations.c
index 03b315e71997110298206e772723bd291e025f37..b90cbed471661a2167d5636e0697352cf989ab76 100644
--- a/gcc/lra-eliminations.c
+++ b/gcc/lra-eliminations.c
@@ -59,6 +59,7 @@  along with GCC; see the file COPYING3.	If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index f761da53e459ab8281ea9b2b0a171de018426aaa..5573ff80a535030caf132f8d37f58701f57e2501 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -33,6 +33,7 @@  along with GCC; see the file COPYING3.	If not see
 #include "tree.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c
index 245c6de6b449bd9d6718a2e61d792b6023a41aa5..f01c6644c428fd9b5efdf6cc98788e5f6fadba62 100644
--- a/gcc/lra-remat.c
+++ b/gcc/lra-remat.c
@@ -60,6 +60,7 @@  along with GCC; see the file COPYING3.	If not see
 #include "df.h"
 #include "insn-config.h"
 #include "regs.h"
+#include "memmodel.h"
 #include "ira.h"
 #include "recog.h"
 #include "lra.h"
diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c
index 768ae82f772641f04571fdb25e1fbd9f365fd781..6e044cdfced3964b41481c00477329a01b38290e 100644
--- a/gcc/lra-spills.c
+++ b/gcc/lra-spills.c
@@ -64,6 +64,7 @@  along with GCC; see the file COPYING3.	If not see
 #include "df.h"
 #include "insn-config.h"
 #include "regs.h"
+#include "memmodel.h"
 #include "ira.h"
 #include "recog.h"
 #include "output.h"
diff --git a/gcc/lra.c b/gcc/lra.c
index cb2bd35cffd6b2c74784eeb4a07c0d8b881fe18d..4165492796c6b114ae0a41853d70f3e20fa33766 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -109,6 +109,7 @@  along with GCC; see the file COPYING3.	If not see
 #include "tree.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/memmodel.h b/gcc/memmodel.h
index d53eb7bc9d9966c2b1510e584f0fd50b13cde572..4fed2955adfbc9b8b6b5795e149961ff693f3eb5 100644
--- a/gcc/memmodel.h
+++ b/gcc/memmodel.h
@@ -1,5 +1,5 @@ 
 /* Prototypes of memory model helper functions.
-   Copyright (C) 2015-2016 Free Software Foundation, Inc.
+   Copyright (C) 2011-2016 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -13,6 +13,10 @@  WARRANTY; without even the implied warranty of MERCHANTABILITY or
 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
 
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
 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/>.  */
@@ -20,6 +24,38 @@  along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_MEMMODEL_H
 #define GCC_MEMMODEL_H
 
+/* Suppose that higher bits are target dependent. */
+#define MEMMODEL_MASK ((1<<16)-1)
+
+/* Legacy sync operations set this upper flag in the memory model.  This allows
+   targets that need to do something stronger for sync operations to
+   differentiate with their target patterns and issue a more appropriate insn
+   sequence.  See bugzilla 65697 for background.  */
+#define MEMMODEL_SYNC (1<<15)
+
+/* Memory model without SYNC bit for targets/operations that do not care.  */
+#define MEMMODEL_BASE_MASK (MEMMODEL_SYNC-1)
+
+/* Memory model types for the __atomic* builtins.
+   This must match the order in libstdc++-v3/include/bits/atomic_base.h.  */
+enum memmodel
+{
+  MEMMODEL_RELAXED = 0,
+  MEMMODEL_CONSUME = 1,
+  MEMMODEL_ACQUIRE = 2,
+  MEMMODEL_RELEASE = 3,
+  MEMMODEL_ACQ_REL = 4,
+  MEMMODEL_SEQ_CST = 5,
+  MEMMODEL_LAST = 6,
+  MEMMODEL_SYNC_ACQUIRE = MEMMODEL_ACQUIRE | MEMMODEL_SYNC,
+  MEMMODEL_SYNC_RELEASE = MEMMODEL_RELEASE | MEMMODEL_SYNC,
+  MEMMODEL_SYNC_SEQ_CST = MEMMODEL_SEQ_CST | MEMMODEL_SYNC
+};
+
+/* memmodel.h is included in libgcc where HOST_WIDE_INT and bool do not make
+   sense.  This guards definitions using those.  */
+#ifndef USED_FOR_TARGET
+
 /* Return the memory model from a host integer.  */
 static inline enum memmodel
 memmodel_from_int (unsigned HOST_WIDE_INT val)
@@ -83,4 +119,6 @@  is_mm_sync (enum memmodel model)
   return (model & MEMMODEL_SYNC);
 }
 
+#endif /* !USED_FOR_TARGET */
+
 #endif  /* GCC_MEMMODEL_H  */
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index 121b9704905f5c554bb0296c7bec6f3c129b13f1..37514177f665c70c91d42881f74ad77a394dec01 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "regs.h"
 #include "emit-rtl.h"
diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
index 6e87a6f260711cbb59ad05dcae2bb04bb4e6f411..3a58f8ba5836378f9160eedbc1420f9dc7d3a163 100644
--- a/gcc/modulo-sched.c
+++ b/gcc/modulo-sched.c
@@ -28,6 +28,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "optabs.h"
 #include "regs.h"
 #include "emit-rtl.h"
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 202f0bd5f2a81890fc3f98b5b7e048dafcf5eccd..77f89d5ef61ef46d8044fca81af5d7ff06f26e84 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "memmodel.h"
 #include "backend.h"
 #include "target.h"
 #include "rtl.h"
diff --git a/gcc/passes.c b/gcc/passes.c
index 881f2293daef96bab99ecdbc31a4e9d41fd0ae7f..e78f9ed79af25fa856e5f32145c32fb136c42b37 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -32,6 +32,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "ssa.h"
 #include "emit-rtl.h"
diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
index da04fb74706538f616604a6423c17d7066a0bc05..139da3796ea17cdf078add59a991fa6cce0c9ec5 100644
--- a/gcc/postreload-gcse.c
+++ b/gcc/postreload-gcse.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "emit-rtl.h"
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 4f3a526981e82d35f953a576ec966fe7dfa9de1c..26871e8d12b23fbabaf329c0484c7fd26c8a1d3b 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/predict.c b/gcc/predict.c
index 463fd0b610e5f9b0d750939a6398ee551777c461..9950c095cc0217f8188a7f1592567e9efe649c8b 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -37,6 +37,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "cfghooks.h"
 #include "tree-pass.h"
 #include "ssa.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "cgraph.h"
 #include "coverage.h"
diff --git a/gcc/print-rtl-function.c b/gcc/print-rtl-function.c
index 4f9b4efdb2e3cd0a25f82799aa657210e15a8081..18dbc11cef4b75dca20f70e8b713252f71a2d825 100644
--- a/gcc/print-rtl-function.c
+++ b/gcc/print-rtl-function.c
@@ -31,6 +31,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "basic-block.h"
 #include "print-rtl.h"
 #include "langhooks.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 
 /* Print an "(edge-from)" or "(edge-to)" directive describing E
diff --git a/gcc/recog.c b/gcc/recog.c
index 6a95d7f9402dd8055cad01e5553d21b2bd307705..22b5aaa265a460d9fd968387e7370a22bbb165a0 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/ree.c b/gcc/ree.c
index 2929277bfd0bef0c320411e5c0c5344bbdc77763..4ab2ad088c363caaaae8abaad375ec5a78bf13ea 100644
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -223,6 +223,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "emit-rtl.h"
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 907f28de5815d048251405b4844f2ef89c66a27a..4e86fa924a0792c24eb38e959ef3a1d649b3df25 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -161,6 +161,7 @@ 
 #include "tree.h"
 #include "df.h"
 #include "insn-config.h"
+#include "memmodel.h"
 #include "emit-rtl.h"  /* FIXME: Can go away once crtl is moved to rtl.h.  */
 #include "recog.h"
 #include "varasm.h"
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index 6d2581bc88e7fac5d47ef4c4bfdc75f94f9a3ba3..fc8297ed53bef25604dc76adc36961f00048d80d 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -23,6 +23,7 @@ 
 #include "backend.h"
 #include "rtl.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index 0cda6aa620098c752522add589b42631b382d9fc..31715593f1aca64c86eba73bf38321bd9faf007e 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -33,6 +33,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 3509e8bab81bcbaeee124347bef21468ec80ec48..c7dd604471ad2f4f4bc5d7cd584741d32c6b1cb4 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -24,6 +24,7 @@ 
 #include "target.h"
 #include "rtl.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/reload.c b/gcc/reload.c
index cd0d661e2246b75f030b187bd1284e7b54466657..9a859e5b45bfa09ffdf69b3e38ae7391d56d7ba4 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -96,6 +96,7 @@  a register with any other reload.  */
 #include "rtl.h"
 #include "tree.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 55aafe46e877c8252ec519b74d9b7f5fe245a82a..89da84d000714de60ad00d7c5bc1cf19b1ed669c 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 40f143feddf0086df27f9f9440bb4a6487ba9b1f..2ad3a4e8db6ab5ed7c5b4ee4ab63d54d7e0a9677 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -108,6 +108,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "predict.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "expmed.h"
 #include "insn-config.h"
diff --git a/gcc/resource.c b/gcc/resource.c
index 32e3e44856dcc0a11c1ed6a1a17ad77127af5399..1aa2f8cf309f70a791b7a9bf183c41fc14dc271a 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "backend.h"
 #include "rtl.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "regs.h"
 #include "emit-rtl.h"
diff --git a/gcc/rtl-chkp.c b/gcc/rtl-chkp.c
index e2a34b371f021d1502d7f7e22da472da6c14d1bf..45cf8f1eee111b5a6d4f2faa07ade596f060b622 100644
--- a/gcc/rtl-chkp.c
+++ b/gcc/rtl-chkp.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "rtl.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "expr.h"
 #include "rtl-chkp.h"
diff --git a/gcc/rtl-tests.c b/gcc/rtl-tests.c
index 3e9ebae02bbcd1b5a2365ecca91754017f7c9694..723efa5a0f61fc5fa3c589e32e639cd4e412db10 100644
--- a/gcc/rtl-tests.c
+++ b/gcc/rtl-tests.c
@@ -39,6 +39,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "print-rtl.h"
 #include "selftest.h"
 #include "function.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 
 #if CHECKING_P
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 2a0a1d2d99ddfc2db0655b36935cb7fcbbb342d8..a882200a4b47f4f48e491fb2ecaa8095e6beb3df 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "predict.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/rtlhooks.c b/gcc/rtlhooks.c
index 32a994f6f3c87dfbd4eccbd252e2c64835815cdd..49f54bc97b6d965c231479767db3299faa64cb40 100644
--- a/gcc/rtlhooks.c
+++ b/gcc/rtlhooks.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "insn-config.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "recog.h"
 #include "rtlhooks-def.h"
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index dc46351ccd278305f3bc716000a1cc3142f62f74..6cd833272b871a2a2266e309ede30307db0c2997 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -30,6 +30,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "df.h"
 #include "insn-config.h"
 #include "regs.h"
+#include "memmodel.h"
 #include "ira.h"
 #include "ira-int.h"
 #include "insn-attr.h"
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index f6d1c91f7683bbe69c463dbaaa88a336604bbe08..08956a0ff962e0fb54ed5f232c607812e010de84 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -50,6 +50,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "target.h"
 #include "rtl.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "emit-rtl.h"
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index 039d945d12ae57167eac7a7a11d2265b61b3d724..71b46d0aa05ffb738548cebe75c5470bf9bac93e 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -69,6 +69,7 @@  static GTY(()) bool sdbout_initialized;
 #include "rtl.h"
 #include "regs.h"
 #include "function.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "flags.h"
 #include "insn-config.h"
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 210b1e4edfb359a161cda4826704005ae9ab5a24..26bc1422167305d5e0715c3ee0c4d7e0d885c232 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "rtl.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "cfgrtl.h"
 #include "cfganal.h"
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 2968bdfe797edbb7f703dde234c071b17a23c37b..9c33b51efe1cc2145310b0a0b121cff79ceb7c6e 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "rtl.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "regs.h"
 #include "cfgbuild.h"
diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c
index b85b1c3b3497c6c1b8d7ee80930cb123025fb23f..a038bb73a822682c3a2e03d24e2af045a3265d06 100644
--- a/gcc/shrink-wrap.c
+++ b/gcc/shrink-wrap.c
@@ -28,6 +28,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "cfghooks.h"
 #include "df.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "regs.h"
 #include "emit-rtl.h"
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index cd3e2d08d6fabc399ccc97a33c4dbe8ce7f75c18..5c3dea1a349f6546260864b7580bfb1170c1904b 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "predict.h"
+#include "memmodel.h"
 #include "optabs.h"
 #include "emit-rtl.h"
 #include "recog.h"
diff --git a/gcc/stack-ptr-mod.c b/gcc/stack-ptr-mod.c
index ff67dec5c74dfdd8c995e0b3303affb8fad15b9a..549c4637a78cb74f90c0b7edc0dfae6c82e34225 100644
--- a/gcc/stack-ptr-mod.c
+++ b/gcc/stack-ptr-mod.c
@@ -23,6 +23,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "backend.h"
 #include "rtl.h"
 #include "df.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "tree-pass.h"
 
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 39fa5e19db35aa7551614c302076e40fd10e3488..f1bf6e4f90f8f19f9e98916ec282cb4500bf9cf0 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -32,6 +32,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "predict.h"
 #include "alloc-pool.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs.h"
 #include "regs.h"
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 63a1454b6297c2bd4cdce50b4e353820ddcfa572..f904d759e1d81b74a4cdbca09c565636f7bb2b72 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "function.h"
 #include "rtl.h"
 #include "tree.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "regs.h"
diff --git a/gcc/target-globals.c b/gcc/target-globals.c
index 45d5880be4db6ad9641f3de61f97f755261b574f..f17cdc12282661dbb612727c2ca45fa8f4450a1b 100644
--- a/gcc/target-globals.c
+++ b/gcc/target-globals.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "optabs-query.h"
 #include "insn-config.h"
 #include "regs.h"
+#include "memmodel.h"
 #include "ira.h"
 #include "ira-int.h"
 #include "toplev.h"
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index c7977be57d47fc9ce30f5ed1f22e9de86d08d7b3..d6fd8b8a77f6b6485d62ad7e4e0c50acdfbc3bc1 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -55,6 +55,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "tree-ssa-alias.h"
 #include "gimple-expr.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "tree-vrp.h"
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 570f4cfee6cafb4ee6940497328fe8241446cef9..1df80d04442647e3a5b6a34a6dcca6b5cfb030f5 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -32,6 +32,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "alloc-pool.h"
 #include "timevar.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "optabs-libfuncs.h"
 #include "insn-config.h"
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 465ae310b1767f069d78eeee1d7d3026cc58f2d5..3aab8e10a8821e7718872afec18d2e29ccf7b250 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -24,6 +24,7 @@ 
 #include "rtl.h"
 #include "tree.h"
 #include "gimple.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "cgraph.h"
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index be57ce4e24278462b47191b5d14010f6bacc66e4..7a35c1e59d340a5aec707c4c2120502d393bc87d 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "cfghooks.h"
 #include "ssa.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "gimple-pretty-print.h"
 #include "diagnostic-core.h"
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 1f45b995d0f4cdb9f98a8edb3d33854a16927ada..abeee92204e227fa5752ebf5aefa9fd961286c69 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "memmodel.h"
 #include "backend.h"
 #include "target.h"
 #include "tree.h"
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index 01f6c5f82390d808c6828585974a8cb50ee4a9f6..6423cdd3cbbb81a1ebfb1d18094ada3477895b0d 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -25,6 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "gimple.h"
 #include "predict.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "ssa.h"
 #include "tree-pretty-print.h"
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
index 79fe3a8b2d0057d9c139b8a7125e30c6bc7f4877..8e5258f8879d767f0e99adaafcb7449684c46fb1 100644
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "cfghooks.h"
 #include "tree-pass.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "ssa.h"
 #include "tree-pretty-print.h"
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 93626fd028ff4da048627e61788cd7bcaa0a1f75..f9211ad1ff3c3fde109797f4bcba420840579fc5 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -75,6 +75,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "cfghooks.h"
 #include "tree-pass.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "ssa.h"
 #include "expmed.h"
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 06354e39e78af44782065bd189ee3bb0281b4772..24c05852b066176876c803b820eb4595c459f1b4 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "gimple.h"
 #include "tree-pass.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "fold-const.h"
 #include "gimple-iterator.h"
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 7b844ddd83d54fbb49777abd125c5d22698d3806..99e1b4140704302b31d320e68c4dfbd6fd15421a 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -29,6 +29,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "cfghooks.h"
 #include "alloc-pool.h"
 #include "tree-pass.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "ssa.h"
 #include "optabs-tree.h"
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index fc8bf74766b2e5e646acb439c5366675ceeb323c..00c1c23054346ef075c34446eee2e0acb1feaa50 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -29,6 +29,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "ssa.h"
 #include "expmed.h"
 #include "insn-config.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 #include "cgraph.h"
 #include "gimple-pretty-print.h"
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 6cf26d9c367d6152f2c5cd8c598908d0af0005ca..c99fa4069beb398d0744e8bdd5a25a93d0639a5f 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -28,6 +28,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "gimple.h"
 #include "predict.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "ssa.h"
 #include "optabs-tree.h"
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index 5fe6f3d0e2a393aee963974d7ab95256ad4b557d..6594dd171837c9e8d724bd02ae8c933110e24b57 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "cfghooks.h"
 #include "tree-pass.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "ssa.h"
 #include "cgraph.h"
diff --git a/gcc/valtrack.c b/gcc/valtrack.c
index 26a15ea42cd1a7e656051c1b1da7042f5236f6c5..9a1ae2def174e8ab8b04e5e979995e1eaeffbbde 100644
--- a/gcc/valtrack.c
+++ b/gcc/valtrack.c
@@ -27,6 +27,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "df.h"
 #include "valtrack.h"
 #include "regs.h"
+#include "memmodel.h"
 #include "emit-rtl.h"
 
 /* gen_lowpart_no_emit hook implementation for DEBUG_INSNs.  In DEBUG_INSNs,
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index e405f0d81b3b07fdf9683c6f533a96df331e3aab..89788f12443492b4120c277a1322645a7f9b47a8 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -95,6 +95,7 @@ 
 #include "cfghooks.h"
 #include "alloc-pool.h"
 #include "tree-pass.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "insn-config.h"
 #include "regs.h"
diff --git a/gcc/varasm.c b/gcc/varasm.c
index a03687210c0b3b7d62a8704ccfcf4f93acc2ed1f..f7d62104f4fee97606cfdffe2aac00aacbb47140 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -33,6 +33,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "rtl.h"
 #include "tree.h"
 #include "predict.h"
+#include "memmodel.h"
 #include "tm_p.h"
 #include "stringpool.h"
 #include "regs.h"
diff --git a/libgcc/config/tilepro/atomic.c b/libgcc/config/tilepro/atomic.c
index 87665f7eccbfeaa5059cefb3f2b036c1563e16cb..e1ff5773c0ad6a3a056eaa9d4b016b743d2b363b 100644
--- a/libgcc/config/tilepro/atomic.c
+++ b/libgcc/config/tilepro/atomic.c
@@ -23,6 +23,7 @@ 
 
 #include "tconfig.h"
 #include "coretypes.h"
+#include "memmodel.h"
 #include "atomic.h"
 
 #define bool unsigned char
diff --git a/libgcc/libgcov-profiler.c b/libgcc/libgcov-profiler.c
index d9217b9885b0854343df6a6baccac340df964e2d..bd897e9eb69c4daea8c5318882e1b32e6afbbd31 100644
--- a/libgcc/libgcov-profiler.c
+++ b/libgcc/libgcov-profiler.c
@@ -24,6 +24,7 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 <http://www.gnu.org/licenses/>.  */
 
 #include "libgcov.h"
+#include "memmodel.h"
 #if !defined(inhibit_libc)
 
 /* Detect whether target can support atomic update of profilers.  */