diff options
author | SimplyTheOther <simplytheother@gmail.com> | 2020-06-20 22:20:34 +0800 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2020-11-28 21:13:17 +0000 |
commit | b0eb8fb1473e82a2577a605f3efb8445f6867415 (patch) | |
tree | 2aad34c3e9c730532e34a6ac4013534024edcfd6 | |
parent | 3faf45fcf6ced5dc0ec5c532abb96fd31916de69 (diff) | |
download | gcc-b0eb8fb1473e82a2577a605f3efb8445f6867415.zip gcc-b0eb8fb1473e82a2577a605f3efb8445f6867415.tar.gz gcc-b0eb8fb1473e82a2577a605f3efb8445f6867415.tar.bz2 |
Added FRV target hook (or at least provisional one)
-rw-r--r-- | gcc/config.gcc | 1 | ||||
-rw-r--r-- | gcc/config/epiphany/epiphany-rust.c | 2 | ||||
-rw-r--r-- | gcc/config/frv/frv-protos.h | 3 | ||||
-rw-r--r-- | gcc/config/frv/frv-rust.c | 112 | ||||
-rw-r--r-- | gcc/config/frv/frv.h | 1 | ||||
-rw-r--r-- | gcc/config/frv/t-frv | 4 |
6 files changed, 122 insertions, 1 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc index c3d6763..46beda4 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -381,6 +381,7 @@ bpf-*-*) ;; frv*) cpu_type=frv extra_options="${extra_options} g.opt" + rust_target_objs="frv-rust.o" ;; ft32*) cpu_type=ft32 target_has_targetm_common=no diff --git a/gcc/config/epiphany/epiphany-rust.c b/gcc/config/epiphany/epiphany-rust.c index 01a73d9..19df9ce 100644 --- a/gcc/config/epiphany/epiphany-rust.c +++ b/gcc/config/epiphany/epiphany-rust.c @@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see /* Implement TARGET_RUST_CPU_INFO for Adapteva Epiphany targets. */ -void cris_rust_target_cpu_info(void) { +void epiphany_rust_target_cpu_info(void) { rust_add_target_info("target_arch", "epiphany"); // llvm seems to have no support for sky (nor historical support), so names are made up by me diff --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h index 8d61359..9cc19cb 100644 --- a/gcc/config/frv/frv-protos.h +++ b/gcc/config/frv/frv-protos.h @@ -26,6 +26,9 @@ extern void frv_debug_stack (frv_stack_t *); extern int frv_initial_elimination_offset (int, int); extern void frv_ifcvt_machdep_init (void *); +/* Defined in frv-rust.c */ +extern void frv_rust_target_cpu_info (void); + #ifdef RTX_CODE extern int frv_legitimate_address_p_1 (machine_mode, rtx, int, int, int); diff --git a/gcc/config/frv/frv-rust.c b/gcc/config/frv/frv-rust.c new file mode 100644 index 0000000..3dc7dc8 --- /dev/null +++ b/gcc/config/frv/frv-rust.c @@ -0,0 +1,112 @@ +/* Subroutines for the Rust front end for the FRV 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 FRV targets. */ + +void frv_rust_target_cpu_info(void) { + rust_add_target_info("target_arch", "frv"); + + // llvm seems to have no support for sky (nor historical support), so names are made up by me + // TODO: very subject to change + // TODO maybe put in sub-arches as features? idk. might be useful in this case + if (TARGET_ACC_4) + rust_add_target_info("target_feature", "acc-4"); + if (TARGET_ACC_8) + rust_add_target_info("target_feature", "acc-8"); + if (TARGET_ALIGN_LABELS) + rust_add_target_info("target_feature", "align-labels"); + if (TARGET_ALLOC_CC) + rust_add_target_info("target_feature", "alloc-cc"); + // TODO: maybe option on branch cost, but wouldn't work well as "define only" option + if (TARGET_COND_EXEC) + rust_add_target_info("target_feature", "cond-exec"); + /* TODO: maybe option on cond-exec-insns, but wouldn't work well as "define-only" option. + * also cond-exec-temps, sched-lookahead */ + if (TARGET_COND_MOVE) + rust_add_target_info("target_feature", "cond-move"); + if (TARGET_DEBUG) + rust_add_target_info("target_feature", "debug"); + if (TARGET_DEBUG_ARG) + rust_add_target_info("target_feature", "debug-arg"); + if (TARGET_DEBUG_ADDR) + rust_add_target_info("target_feature", "debug-addr"); + if (TARGET_DEBUG_COND_EXEC) + rust_add_target_info("target_feature", "debug-cond-exec"); + if (TARGET_DEBUG_LOC) + rust_add_target_info("target_feature", "debug-loc"); + if (TARGET_DEBUG_STACK) + rust_add_target_info("target_feature", "debug-stack"); + if (TARGET_DOUBLE) + rust_add_target_info("target_feature", "double"); + if (TARGET_DWORD) + rust_add_target_info("target_feature", "dword"); + if (TARGET_FDPIC) + rust_add_target_info("target_feature", "fdpic"); + if (TARGET_FIXED_CC) + rust_add_target_info("target_feature", "fixed-cc"); + if (TARGET_FPR_32) + rust_add_target_info("target_feature", "fpr-32"); + if (TARGET_FPR_64) + rust_add_target_info("target_feature", "fpr-64"); + if (TARGET_GPR_32) + rust_add_target_info("target_feature", "gpr-32"); + if (TARGET_GPR_64) + rust_add_target_info("target_feature", "gpr-64"); + if (TARGET_GPREL_RO) + rust_add_target_info("target_feature", "gprel-ro"); + if (TARGET_HARD_FLOAT) + rust_add_target_info("target_feature", "hard-float"); + else + rust_add_target_info("target_feature", "soft-float"); + if (TARGET_INLINE_PLT) + rust_add_target_info("target_feature", "inline-plt"); + if (TARGET_LIBPIC) + rust_add_target_info("target_feature", "library-pic"); + if (TARGET_LINKED_FP) + rust_add_target_info("target_feature", "linked-fp"); + if (TARGET_LONG_CALLS) + rust_add_target_info("target_feature", "long-calls"); + if (TARGET_MEDIA) + rust_add_target_info("target_feature", "media"); + if (TARGET_MULADD) + rust_add_target_info("target_feature", "muladd"); + if (TARGET_MULTI_CE) + rust_add_target_info("target_feature", "multi-cond-exec"); + if (TARGET_NESTED_CE) + rust_add_target_info("target_feature", "nested-cond-exec"); + // TODO: maybe something with no-eflags if possible? tomcat-stats? multilib-library-pic? + if (TARGET_OPTIMIZE_MEMBAR) + rust_add_target_info("target_feature", "optimize-membar"); + if (TARGET_PACK) + rust_add_target_info("target_feature", "pack"); + if (TARGET_SCC) + rust_add_target_info("target_feature", "scc"); + if (TARGET_BIG_TLS) + rust_add_target_info("target_feature", "large-tls"); + else + rust_add_target_info("target_feature", "small-tls"); + if (TARGET_VLIW_BRANCH) + rust_add_target_info("target_feature", "vliw-branch"); +} diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h index 450b22e..64bd5f9 100644 --- a/gcc/config/frv/frv.h +++ b/gcc/config/frv/frv.h @@ -188,6 +188,7 @@ } \ while (0) +#define TARGET_RUST_CPU_INFO frv_rust_target_cpu_info #define TARGET_HAS_FPRS (TARGET_HARD_FLOAT || TARGET_MEDIA) diff --git a/gcc/config/frv/t-frv b/gcc/config/frv/t-frv index bdfde2b..428ee1c 100644 --- a/gcc/config/frv/t-frv +++ b/gcc/config/frv/t-frv @@ -34,3 +34,7 @@ MULTILIB_MATCHES = mcpu?simple=mcpu?fr300 \ MULTILIB_EXCEPTIONS = mcpu=frv/mno-pack* mcpu=simple/mno-pack* EXTRA_HEADERS = $(srcdir)/config/frv/frv-asm.h + +frv-rust.o: $(srcdir)/config/frv/frv-rust.c \ + $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H) + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< |