aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimplyTheOther <simplytheother@gmail.com>2020-06-14 22:16:20 +0800
committerPhilip Herron <philip.herron@embecosm.com>2020-11-28 21:13:16 +0000
commitfad970a5ecf82f7af0c3d75c7524dc887e31be65 (patch)
treeaee7646217c4aee9204d87b9792f84cc7b136ed0
parent821da3d3a2b5f710efcdc8600a69cd4677e84583 (diff)
downloadgcc-fad970a5ecf82f7af0c3d75c7524dc887e31be65.zip
gcc-fad970a5ecf82f7af0c3d75c7524dc887e31be65.tar.gz
gcc-fad970a5ecf82f7af0c3d75c7524dc887e31be65.tar.bz2
Added TI C6X target hook (or a basic one at least)
-rw-r--r--gcc/config.gcc1
-rw-r--r--gcc/config/c6x/c6x-protos.h3
-rw-r--r--gcc/config/c6x/c6x-rust.c56
-rw-r--r--gcc/config/c6x/c6x.h2
-rw-r--r--gcc/config/c6x/t-c6x4
5 files changed, 66 insertions, 0 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc
index a9fd6a7..c5c9d8a 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -578,6 +578,7 @@ v850*-*-*)
;;
tic6x-*-*)
cpu_type=c6x
+ rust_target_objs="c6x-rust.o"
extra_headers="c6x_intrinsics.h"
extra_options="${extra_options} c6x/c6x-tables.opt"
;;
diff --git a/gcc/config/c6x/c6x-protos.h b/gcc/config/c6x/c6x-protos.h
index 92d6008..e69484d 100644
--- a/gcc/config/c6x/c6x-protos.h
+++ b/gcc/config/c6x/c6x-protos.h
@@ -21,6 +21,9 @@
#ifndef GCC_C6X_PROTOS_H
#define GCC_C6X_PROTOS_H
+/* Defined in c6x-rust.c */
+extern void c6x_rust_target_cpu_info (void);
+
/* Functions defined in c6x.c. */
#ifdef RTX_CODE
diff --git a/gcc/config/c6x/c6x-rust.c b/gcc/config/c6x/c6x-rust.c
new file mode 100644
index 0000000..351adac
--- /dev/null
+++ b/gcc/config/c6x/c6x-rust.c
@@ -0,0 +1,56 @@
+/* Subroutines for the Rust front end on the TI C6X.
+ 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 TI C6X targets. */
+
+void c6x_rust_target_cpu_info(void) {
+ rust_add_target_info("target_arch", "tic6x");
+
+ // llvm seems to have no support for c6x (nor historical support), so names are made up by me
+ // TODO: very subject to change
+ // TODO maybe put in sub-arches as features? idk
+ if (TARGET_DSBT)
+ rust_add_target_info("target_feature", "dsbt");
+
+ if (TARGET_INSNS_64)
+ rust_add_target_info("target_feature", "c64x");
+ if (TARGET_INSNS_64PLUS)
+ rust_add_target_info("target_feature", "c64x+");
+ if (TARGET_INSNS_67)
+ rust_add_target_info("target_feature", "c67x");
+ if (TARGET_INSNS_67PLUS)
+ rust_add_target_info("target_feature", "c67x+");
+
+ if (TARGET_LDDW)
+ rust_add_target_info("target_feature", "lddw");
+ if (TARGET_STDW)
+ rust_add_target_info("target_feature", "stdw");
+ if (TARGET_MPY32)
+ rust_add_target_info("target_feature", "mpy32");
+ if (TARGET_FP)
+ rust_add_target_info("target_feature", "fp");
+ if (TARGET_FP_EXT)
+ rust_add_target_info("target_feature", "fp-ext");
+}
diff --git a/gcc/config/c6x/c6x.h b/gcc/config/c6x/c6x.h
index d96f12e..e2159ef 100644
--- a/gcc/config/c6x/c6x.h
+++ b/gcc/config/c6x/c6x.h
@@ -114,6 +114,8 @@ extern c6x_cpu_t c6x_arch;
} \
} while (0)
+#define TARGET_RUST_CPU_INFO c6x_rust_target_cpu_info
+
#define OPTION_DEFAULT_SPECS \
{"arch", "%{!march=*:-march=%(VALUE)}" }
diff --git a/gcc/config/c6x/t-c6x b/gcc/config/c6x/t-c6x
index 7ea6c1d..cbcdfcc 100644
--- a/gcc/config/c6x/t-c6x
+++ b/gcc/config/c6x/t-c6x
@@ -42,3 +42,7 @@ $(srcdir)/config/c6x/c6x-tables.opt: $(srcdir)/config/c6x/genopt.sh \
$(srcdir)/config/c6x/c6x-isas.def
$(SHELL) $(srcdir)/config/c6x/genopt.sh $(srcdir)/config/c6x > \
$(srcdir)/config/c6x/c6x-tables.opt
+
+c6x-rust.o: $(srcdir)/config/c6x/c6x-rust.c \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<