summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-13 19:22:44 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-13 19:22:44 +0000
commit8da0577c87baa75ad56a412fe624f397ec90bd9b (patch)
treeb1b4a7b1d891dcea67383cef1479b4fa6ef4f4b5
parent2c40a128278633ed44c671f6191a7ed589eb6ede (diff)
downloadgcc-8da0577c87baa75ad56a412fe624f397ec90bd9b.tar.gz
sparc: Default memory model to TSO for Linux and Solaris.
* config/sparc/tso.h: New file. * config.gcc (sparc-*-linux*, sparc*-*-solaris2*): Use it. * config/sparc/sparc.c (sparc_option_override): Honor SUBTARGET_DEFAULT_MEMORY_MODEL. * config/sparc/sparc.h (SUBTARGET_DEFAULT_MEMORY_MODEL): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182297 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config.gcc6
-rw-r--r--gcc/config/sparc/sparc.c6
-rw-r--r--gcc/config/sparc/sparc.h5
-rw-r--r--gcc/config/sparc/tso.h23
5 files changed, 44 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 60435516e7f..2b324a470c4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2011-12-13 Richard Henderson <rth@redhat.com>
+
+ * config/sparc/tso.h: New file.
+ * config.gcc (sparc-*-linux*, sparc*-*-solaris2*): Use it.
+ * config/sparc/sparc.c (sparc_option_override): Honor
+ SUBTARGET_DEFAULT_MEMORY_MODEL.
+ * config/sparc/sparc.h (SUBTARGET_DEFAULT_MEMORY_MODEL): New.
+
2011-12-13 Aldy Hernandez <aldyh@redhat.com>
PR/51443
diff --git a/gcc/config.gcc b/gcc/config.gcc
index a4772892b45..d0f7b283b9a 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2357,7 +2357,7 @@ sparc-*-rtems*)
tmake_file="sparc/t-sparc sparc/t-elf t-rtems"
;;
sparc-*-linux*)
- tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h"
+ tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/tso.h"
extra_options="${extra_options} sparc/long-double-switch.opt"
case ${target} in
*-leon-*)
@@ -2384,7 +2384,7 @@ sparc-*-netbsdelf*)
tmake_file="${tmake_file} sparc/t-sparc"
;;
sparc*-*-solaris2*)
- tm_file="sparc/biarch64.h ${tm_file} ${sol2_tm_file} sol2-bi.h"
+ tm_file="sparc/biarch64.h ${tm_file} ${sol2_tm_file} sol2-bi.h sparc/tso.h"
case ${target} in
sparc64-*-* | sparcv9-*-*)
tm_file="sparc/default-64.h ${tm_file}"
@@ -2410,7 +2410,7 @@ sparc64-*-rtems*)
tmake_file="${tmake_file} sparc/t-sparc t-rtems"
;;
sparc64-*-linux*)
- tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/default-64.h sparc/linux64.h"
+ tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/default-64.h sparc/linux64.h sparc/tso.h"
extra_options="${extra_options} sparc/long-double-switch.opt"
tmake_file="${tmake_file} sparc/t-sparc sparc/t-linux64"
;;
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 713db26ee0b..20efb00c451 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1162,8 +1162,12 @@ sparc_option_override (void)
if (sparc_memory_model == SMM_DEFAULT)
{
+ /* Choose the memory model for the operating system. */
+ enum sparc_memory_model_type os_default = SUBTARGET_DEFAULT_MEMORY_MODEL;
+ if (os_default != SMM_DEFAULT)
+ sparc_memory_model = os_default;
/* Choose the most relaxed model for the processor. */
- if (TARGET_V9)
+ else if (TARGET_V9)
sparc_memory_model = SMM_RMO;
else if (TARGET_V8)
sparc_memory_model = SMM_PSO;
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index 32f8c1074ae..bb6b0794350 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -1755,3 +1755,8 @@ extern int sparc_indent_opcode;
#define MASK_DEBUG_ALL MASK_DEBUG_OPTIONS
#define TARGET_DEBUG_OPTIONS (sparc_debug & MASK_DEBUG_OPTIONS)
+
+/* By default, use the weakest memory model for the cpu. */
+#ifndef SUBTARGET_DEFAULT_MEMORY_MODEL
+#define SUBTARGET_DEFAULT_MEMORY_MODEL SMM_DEFAULT
+#endif
diff --git a/gcc/config/sparc/tso.h b/gcc/config/sparc/tso.h
new file mode 100644
index 00000000000..c81ea4d35a3
--- /dev/null
+++ b/gcc/config/sparc/tso.h
@@ -0,0 +1,23 @@
+/* Include fragment for Sparc TSO operating systems.
+ Copyright (C) 2011 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+
+/* This operating system sets PSTATE.MM to the TSO memory model. */
+#undef SUBTARGET_DEFAULT_MEMORY_MODEL
+#define SUBTARGET_DEFAULT_MEMORY_MODEL SMM_TSO