aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimplyTheOther <simplytheother@gmail.com>2020-07-14 19:24:48 +0800
committerPhilip Herron <philip.herron@embecosm.com>2020-11-28 21:13:19 +0000
commitfed3fd6054a2ae4d83a4db52c58ba34e4bb99902 (patch)
tree67c78b98b98bf4759e7b2a13083c943f80d421e4
parent51e1554100dc5abc53c0e4fea82a62b26281ab98 (diff)
downloadgcc-fed3fd6054a2ae4d83a4db52c58ba34e4bb99902.zip
gcc-fed3fd6054a2ae4d83a4db52c58ba34e4bb99902.tar.gz
gcc-fed3fd6054a2ae4d83a4db52c58ba34e4bb99902.tar.bz2
Added Renesas RX target hook (or at least provisional one)
-rw-r--r--gcc/config.gcc2
-rw-r--r--gcc/config/rx/rx-protos.h3
-rw-r--r--gcc/config/rx/rx-rust.c75
-rw-r--r--gcc/config/rx/rx.h2
-rw-r--r--gcc/config/rx/t-rx4
5 files changed, 86 insertions, 0 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc
index a3a1995..6286584 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3135,10 +3135,12 @@ rx-*-elf*)
tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
tmake_file="${tmake_file} rx/t-rx"
extra_options="${extra_options} rx/elf.opt"
+ rust_target_objs="rx-rust.o"
;;
rx-*-linux*)
tm_file="elfos.h linux.h glibc-stdint.h rx/linux.h ../../libgcc/config/rx/rx-abi.h"
tmake_file="${tmake_file} rx/t-linux"
+ rust_target_objs="rx-rust.o"
;;
s390-*-linux*)
tm_file="s390/s390.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h s390/linux.h"
diff --git a/gcc/config/rx/rx-protos.h b/gcc/config/rx/rx-protos.h
index 6927b91..9a1585d 100644
--- a/gcc/config/rx/rx-protos.h
+++ b/gcc/config/rx/rx-protos.h
@@ -171,4 +171,7 @@ rx_find_use_of_reg (rtx reg, rtx_insn* insn, F stepfunc)
#endif
+/* Routines implemented in rx-rust.c */
+extern void rx_rust_target_cpu_info (void);
+
#endif /* GCC_RX_PROTOS_H */
diff --git a/gcc/config/rx/rx-rust.c b/gcc/config/rx/rx-rust.c
new file mode 100644
index 0000000..5c2e186
--- /dev/null
+++ b/gcc/config/rx/rx-rust.c
@@ -0,0 +1,75 @@
+/* Subroutines for the Rust front end for the Renesas RX architecture.
+ 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 RX targets. */
+
+void rx_rust_target_cpu_info(void) {
+ rust_add_target_info("target_arch", "rx");
+
+ // 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)
+ rust_add_target_info("target_feature", "nofpu");
+ // TODO: ensure below switch and variable works
+ switch (rx_cpu_type) {
+ case RX610:
+ rust_add_target_info("target_feature", "cpu-rx610");
+ break;
+ case RX200:
+ rust_add_target_info("target_feature", "cpu-rx200");
+ break;
+ case RX600:
+ rust_add_target_info("target_feature", "cpu-rx600");
+ break;
+ case RX100:
+ rust_add_target_info("target_feature", "cpu-rx100");
+ break;
+ default: // should this be an error? probably shouldn't happen
+ break;
+ }
+ if (TARGET_BIG_ENDIAN_DATA)
+ rust_add_target_info("target_feature", "big-endian-data");
+ // TODO: find way of having small-data-limit, max-constant-size, int-register as defines
+ // TODO: find way of getting info for relax
+ if (TARGET_SAVE_ACC_REGISTER)
+ rust_add_target_info("target_feature", "save-acc-in-interrupts");
+ if (TARGET_PID)
+ rust_add_target_info("target_feature", "pid");
+ // TODO: ensure below variable works
+ if (rx_warn_multiple_fast_interrupts)
+ rust_add_target_info("target_feature", "warn-multiple-fast-interrupts");
+ if (TARGET_GCC_ABI)
+ rust_add_target_info("target_feature", "gcc-abi");
+ else
+ rust_add_target_info("target_feature", "rx-abi");
+ if (TARGET_ENABLE_LRA)
+ rust_add_target_info("target_feature", "lra");
+ // TODO: ensure below variable works
+ if (rx_allow_string_insns)
+ rust_add_target_info("target_feature", "allow-string-insns");
+ if (TARGET_JSR)
+ rust_add_target_info("target_feature", "jsr");
+}
diff --git a/gcc/config/rx/rx.h b/gcc/config/rx/rx.h
index 2f3d97a..25b55ab 100644
--- a/gcc/config/rx/rx.h
+++ b/gcc/config/rx/rx.h
@@ -75,6 +75,8 @@
} \
while (0)
+#define TARGET_RUST_CPU_INFO rx_rust_target_cpu_info
+
#undef CC1_SPEC
#define CC1_SPEC "\
%{mas100-syntax:%{gdwarf*:%e-mas100-syntax is incompatible with -gdwarf}} \
diff --git a/gcc/config/rx/t-rx b/gcc/config/rx/t-rx
index 5890a95..bd92001 100644
--- a/gcc/config/rx/t-rx
+++ b/gcc/config/rx/t-rx
@@ -35,3 +35,7 @@ MULTILIB_MATCHES = nofpu=mnofpu nofpu=mcpu?rx200 nofpu=mcpu?rx100
MULTILIB_EXCEPTIONS =
MULTILIB_EXTRA_OPTS =
+
+rx-rust.o: $(srcdir)/config/rx/rx-rust.c \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< \ No newline at end of file