Re: [PATCH, GCC] Move MEMMODEL_* and enum memmodel from coretypes.h to memmodel.h

2016-10-13 Thread Richard Biener
On Thu, 13 Oct 2016, Thomas Preudhomme wrote:

> On 12/10/16 21:00, 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.)
> > 
> 
> That's a better solution indeed. I've updated the patch, and did another
> x86_64 bootstrap and built a tilepro-linux-gnu cross-compiler for good
> measure. It's all good.
> 
> Ok for trunk?

Ok.

Richard.


Re: [PATCH, GCC] Move MEMMODEL_* and enum memmodel from coretypes.h to memmodel.h

2016-10-13 Thread Thomas Preudhomme

On 12/10/16 21:00, 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.)



That's a better solution indeed. I've updated the patch, and did another x86_64 
bootstrap and built a tilepro-linux-gnu cross-compiler for good measure. It's 
all good.


Ok for trunk?

Best regards,

Thomas
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 

Re: [PATCH, GCC] Move MEMMODEL_* and enum memmodel from coretypes.h to memmodel.h

2016-10-13 Thread Richard Biener
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.


Re: [PATCH, GCC] Move MEMMODEL_* and enum memmodel from coretypes.h to memmodel.h

2016-10-12 Thread Joseph Myers
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.)

-- 
Joseph S. Myers
jos...@codesourcery.com


[PATCH, GCC] Move MEMMODEL_* and enum memmodel from coretypes.h to memmodel.h

2016-10-12 Thread Thomas Preudhomme

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  

* 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