aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSimplyTheOther <simplytheother@gmail.com>2020-06-25 22:16:37 +0800
committerPhilip Herron <philip.herron@embecosm.com>2020-11-28 21:13:17 +0000
commit0195559c0ece9d91a581330c694f5ecde5213c90 (patch)
tree85a4b13ca3ea28b78fb249882394fbc69a03a9bc /gcc
parent695a885813daef0f877a8127cf23ec4b6cdb9d6a (diff)
downloadgcc-0195559c0ece9d91a581330c694f5ecde5213c90.zip
gcc-0195559c0ece9d91a581330c694f5ecde5213c90.tar.gz
gcc-0195559c0ece9d91a581330c694f5ecde5213c90.tar.bz2
Added provisional Motorola 68K target hook
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config.gcc2
-rw-r--r--gcc/config/m68k/m68k-protos.h3
-rw-r--r--gcc/config/m68k/m68k-rust.c63
-rw-r--r--gcc/config/m68k/m68k.h2
-rw-r--r--gcc/config/m68k/t-opts4
5 files changed, 74 insertions, 0 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 7fc3a96..0bb3b80 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -393,6 +393,7 @@ fido-*-*)
cpu_type=m68k
extra_headers=math-68881.h
extra_options="${extra_options} m68k/m68k-tables.opt"
+ rust_target_objs="m68k-rust.o"
;;
i[34567]86-*-*)
cpu_type=i386
@@ -488,6 +489,7 @@ m32r*-*-*)
m68k-*-*)
extra_headers=math-68881.h
extra_options="${extra_options} m68k/m68k-tables.opt"
+ rust_target_objs="m68k-rust.o"
;;
microblaze*-*-*)
cpu_type=microblaze
diff --git a/gcc/config/m68k/m68k-protos.h b/gcc/config/m68k/m68k-protos.h
index 1c502d7..cb2b83c 100644
--- a/gcc/config/m68k/m68k-protos.h
+++ b/gcc/config/m68k/m68k-protos.h
@@ -101,6 +101,9 @@ extern enum attr_op_mem m68k_sched_attr_op_mem (rtx_insn *);
#endif /* RTX_CODE */
+/* Defined in m68k-rust.c */
+extern void m68k_rust_target_cpu_info (void);
+
extern enum reg_class m68k_secondary_reload_class (enum reg_class,
machine_mode, rtx);
extern enum reg_class m68k_preferred_reload_class (rtx, enum reg_class);
diff --git a/gcc/config/m68k/m68k-rust.c b/gcc/config/m68k/m68k-rust.c
new file mode 100644
index 0000000..4e4cc07
--- /dev/null
+++ b/gcc/config/m68k/m68k-rust.c
@@ -0,0 +1,63 @@
+/* Subroutines for the Rust front end for the Motorola 680x0/ColdFire 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 Motorola 680x0/ColdFire targets. */
+
+void m68k_rust_target_cpu_info(void) {
+ rust_add_target_info("target_arch", "m68k");
+
+ /* llvm has no current or historical support for m68k, and llvm forks and mrustc don't suggest any
+ * true target feature names, so I made up names and features */
+ // TODO: maybe define subarches as features? probably needed, but not sure how well it interacts
+ if (TARGET_ALIGN_INT)
+ rust_add_target_info("target_feature", "align-int");
+ if (TARGET_BITFIELD)
+ rust_add_target_info("target_feature", "bitfield");
+ if (TARGET_CF_HWDIV)
+ rust_add_target_info("target_feature", "div");
+ if (TARGET_HARD_FLOAT)
+ rust_add_target_info("target_feature", "hard-float");
+ else
+ rust_add_target_info("target_feature", "soft-float");
+ if (TARGET_ID_SHARED_LIBRARY)
+ rust_add_target_info("target_feature", "id-shared-library");
+ if (TARGET_LONG_JUMP_TABLE_OFFSETS)
+ rust_add_target_info("target_feature", "long-jump-table-offsets");
+ if (TARGET_RTD)
+ rust_add_target_info("target_feature", "rtd");
+ if (TARGET_SHORT)
+ rust_add_target_info("target_feature", "short");
+ if (TARGET_PCREL)
+ rust_add_target_info("target_feature", "pcrel");
+ if (TARGET_SEP_DATA)
+ rust_add_target_info("target_feature", "sep-data");
+ // TODO: see if can get information about shared-library-id
+ if (TARGET_STRICT_ALIGNMENT)
+ rust_add_target_info("target_feature", "strict-align");
+ if (TARGET_XGOT)
+ rust_add_target_info("target_feature", "xgot");
+ if (TARGET_XTLS)
+ rust_add_target_info("target_feature", "xtls");
+}
diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
index 85e8f84..b455a49 100644
--- a/gcc/config/m68k/m68k.h
+++ b/gcc/config/m68k/m68k.h
@@ -196,6 +196,8 @@ along with GCC; see the file COPYING3. If not see
} \
while (0)
+#define TARGET_RUST_CPU_INFO m68k_rust_target_cpu_info
+
/* Classify the groups of pseudo-ops used to assemble QI, HI and SI
quantities. */
#define INT_OP_STANDARD 0 /* .byte, .short, .long */
diff --git a/gcc/config/m68k/t-opts b/gcc/config/m68k/t-opts
index 391a931..4f1ce87 100644
--- a/gcc/config/m68k/t-opts
+++ b/gcc/config/m68k/t-opts
@@ -6,3 +6,7 @@ $(srcdir)/config/m68k/m68k-tables.opt: $(srcdir)/config/m68k/genopt.sh \
$(srcdir)/config/m68k/m68k-microarchs.def
$(SHELL) $(srcdir)/config/m68k/genopt.sh $(srcdir)/config/m68k > \
$(srcdir)/config/m68k/m68k-tables.opt
+
+m68k-rust.o: $(srcdir)/config/m68k/m68k-rust.c \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<