aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSimplyTheOther <simplytheother@gmail.com>2020-07-14 22:11:06 +0800
committerPhilip Herron <philip.herron@embecosm.com>2020-11-28 21:13:19 +0000
commite8bf48baaf778a9e3e174f57f1d0a81221a30a9a (patch)
tree70d011e500c2afcee158c6cb6a0bde49040c68de /gcc
parentfed3fd6054a2ae4d83a4db52c58ba34e4bb99902 (diff)
downloadgcc-e8bf48baaf778a9e3e174f57f1d0a81221a30a9a.zip
gcc-e8bf48baaf778a9e3e174f57f1d0a81221a30a9a.tar.gz
gcc-e8bf48baaf778a9e3e174f57f1d0a81221a30a9a.tar.bz2
Added extremely provisional S/390 and zSeries target hook
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config.gcc1
-rw-r--r--gcc/config/rx/rx-rust.c2
-rw-r--r--gcc/config/s390/s390-protos.h3
-rw-r--r--gcc/config/s390/s390-rust.c57
-rw-r--r--gcc/config/s390/s390.h3
-rw-r--r--gcc/config/s390/t-s3904
6 files changed, 69 insertions, 1 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 6286584..2a2d3c2 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -575,6 +575,7 @@ sparc*-*-*)
s390*-*-*)
cpu_type=s390
d_target_objs="s390-d.o"
+ rust_target_objs="s390-rust.o"
extra_options="${extra_options} fused-madd.opt"
extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h"
;;
diff --git a/gcc/config/rx/rx-rust.c b/gcc/config/rx/rx-rust.c
index 5c2e186..1701dea 100644
--- a/gcc/config/rx/rx-rust.c
+++ b/gcc/config/rx/rx-rust.c
@@ -31,7 +31,7 @@ void rx_rust_target_cpu_info(void) {
// llvm appears to have no (current or historical) support, so names made up by me
if (TARGET_64BIT_DOUBLES)
rust_add_target_info("target_feature", "64bit-doubles");
- if (NO_USE_FPU)
+ if (TARGET_NO_USE_FPU)
rust_add_target_info("target_feature", "nofpu");
// TODO: ensure below switch and variable works
switch (rx_cpu_type) {
diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h
index ad2f7f7..dafd5ae 100644
--- a/gcc/config/s390/s390-protos.h
+++ b/gcc/config/s390/s390-protos.h
@@ -173,6 +173,9 @@ extern bool s390_const_operand_ok (tree, int, int, tree);
/* s390-d.c routines */
extern void s390_d_target_versions (void);
+/* Routines implemented in s390-rust.c */
+extern void s390_rust_target_cpu_info (void);
+
/* Pass management. */
namespace gcc { class context; }
class rtl_opt_pass;
diff --git a/gcc/config/s390/s390-rust.c b/gcc/config/s390/s390-rust.c
new file mode 100644
index 0000000..98d9ea0
--- /dev/null
+++ b/gcc/config/s390/s390-rust.c
@@ -0,0 +1,57 @@
+/* Subroutines for the Rust front end for the IBM S/390 and zSeries architectures.
+ Copyright (C) 2020 Free Software Foundation, Inc.
+
+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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tm_p.h"
+#include "rust/rust-target.h"
+#include "rust/rust-target-def.h"
+
+/* Implement TARGET_RUST_CPU_INFO for S/390 and zSeries targets. */
+
+void s390_rust_target_cpu_info(void) {
+ // TODO: ensure that this is right for llvm/rustc arch
+ if (TARGET_64BIT)
+ rust_add_target_info("target_arch", "s390x");
+ else
+ rust_add_target_info("target_arch", "s390");
+
+ // names derived from llvm and rustc
+ if (TARGET_SOFT_FLOAT)
+ rust_add_target_info("target_feature", "soft-float");
+ else
+ rust_add_target_info("target_feature", "fp-extension");
+ // TODO: ensure that having hardware float is actually what fp-extension refers to
+ /* TODO: find gcc equivalent of distinct-ops (distinct-operands facility), fast-serialization,
+ * high-word, interlocked-access1, load-store-on-cond, population-count,
+ * message-security-assist-extension3, message-security-assist-extension4,
+ * reset-reference-bits-multiple, execution-hint, load-and-trap, miscellaneous-extensions,
+ * processor-assist, dfp-zoned-conversion, enhanced-dat-2, load-and-zero-rightmost-byte,
+ * load-store-on-cond-2, message-security-assist-extension5, dfp-packed-conversion,
+ * miscellaneous-extensions-2, message-security-assist-extension7, message-security-assist-extension8,
+ * vector-enhancements-1, vector-packed-decimal, insert-reference-bits-multiple,
+ * miscellaneous-extensions-3, message-security-assist-extension9, vector-enhancements-2,
+ * vector-packed-decimal-enhancement, enhanced-sort, deflate-conversion if they exist */
+ if (TARGET_OPT_HTM)
+ rust_add_target_info("target_feature", "transactional-execution");
+ // TODO: ensure that "vector" only refers to code generation and not language exts and builtins
+ if (TARGET_OPT_VX)
+ rust_add_target_info("target_feature", "vector");
+ // TODO: is guarded-storage the same thing as stack-guard? if so, add that option mapping
+}
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index bc579a3..d748f9c 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -232,6 +232,9 @@ enum processor_flags
/* Target CPU versions for D. */
#define TARGET_D_CPU_VERSIONS s390_d_target_versions
+/* Target CPU info for Rust. */
+#define TARGET_RUST_CPU_INFO s390_rust_target_cpu_info
+
#ifdef DEFAULT_TARGET_64BIT
#define TARGET_DEFAULT (MASK_64BIT | MASK_ZARCH | MASK_HARD_DFP \
| MASK_OPT_HTM | MASK_OPT_VX)
diff --git a/gcc/config/s390/t-s390 b/gcc/config/s390/t-s390
index 979eace..68e78eb 100644
--- a/gcc/config/s390/t-s390
+++ b/gcc/config/s390/t-s390
@@ -30,3 +30,7 @@ s390-c.o: $(srcdir)/config/s390/s390-c.c \
s390-d.o: $(srcdir)/config/s390/s390-d.c
$(COMPILE) $<
$(POSTCOMPILE)
+
+s390-rust.o: $(srcdir)/config/s390/s390-rust.c \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<