diff options
author | SimplyTheOther <simplytheother@gmail.com> | 2020-07-23 22:05:45 +0800 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2020-11-28 21:13:19 +0000 |
commit | 1bedf7bfc18623bad65413b6273358b436beaf61 (patch) | |
tree | 1e9ac2d05bcb8e94cc5b8ae3b7513f140e808f1b /gcc | |
parent | e6bc70496837494959039523fb7982056f59347f (diff) | |
download | gcc-1bedf7bfc18623bad65413b6273358b436beaf61.zip gcc-1bedf7bfc18623bad65413b6273358b436beaf61.tar.gz gcc-1bedf7bfc18623bad65413b6273358b436beaf61.tar.bz2 |
Added NEC V850 target hook (or provisional one at least)
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config.gcc | 1 | ||||
-rw-r--r-- | gcc/config/sparc/sparc-rust.c | 2 | ||||
-rw-r--r-- | gcc/config/v850/t-v850 | 4 | ||||
-rw-r--r-- | gcc/config/v850/v850-protos.h | 3 | ||||
-rw-r--r-- | gcc/config/v850/v850-rust.c | 83 | ||||
-rw-r--r-- | gcc/config/v850/v850.h | 2 |
6 files changed, 94 insertions, 1 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc index d1dfa79..e4fd427 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -589,6 +589,7 @@ sh[123456789lbe]*-*-* | sh-*-*) ;; v850*-*-*) cpu_type=v850 + rust_target_objs="v850-rust.o" ;; tic6x-*-*) cpu_type=c6x diff --git a/gcc/config/sparc/sparc-rust.c b/gcc/config/sparc/sparc-rust.c index 867612e..6ba2852 100644 --- a/gcc/config/sparc/sparc-rust.c +++ b/gcc/config/sparc/sparc-rust.c @@ -35,7 +35,7 @@ void sparc_rust_target_cpu_info(void) { /* TODO: try to isolate soft-mul-div feature (software emulation for integer multiply and divide) * if doable? does gcc even support this? */ if (!(TARGET_FSMULD)) - rust_add_target_info("target_arch", "no-fsmuld"); + rust_add_target_info("target_feature", "no-fsmuld"); // TODO: add "no-fmuls" (fmuls instruction) option if can find in gcc if (TARGET_V9) rust_add_target_info("target_feature", "v9"); diff --git a/gcc/config/v850/t-v850 b/gcc/config/v850/t-v850 index 36fdc1d..5edba89 100644 --- a/gcc/config/v850/t-v850 +++ b/gcc/config/v850/t-v850 @@ -30,6 +30,10 @@ v850-c.o: $(srcdir)/config/v850/v850-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/v850/v850-c.c +v850-rust.o: $(srcdir)/config/v850/v850-rust.c \ + $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H) + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< + # Local Variables: # mode: Makefile # End: diff --git a/gcc/config/v850/v850-protos.h b/gcc/config/v850/v850-protos.h index 2efe513..45d8606 100644 --- a/gcc/config/v850/v850-protos.h +++ b/gcc/config/v850/v850-protos.h @@ -65,4 +65,7 @@ extern void ghs_pragma_endtda (struct cpp_reader *); extern void ghs_pragma_endsda (struct cpp_reader *); extern void ghs_pragma_endzda (struct cpp_reader *); +/* Routines implemented in v850-rust.c */ +extern void v850_rust_target_cpu_info (void); + #endif /* ! GCC_V850_PROTOS_H */ diff --git a/gcc/config/v850/v850-rust.c b/gcc/config/v850/v850-rust.c new file mode 100644 index 0000000..866774a --- /dev/null +++ b/gcc/config/v850/v850-rust.c @@ -0,0 +1,83 @@ +/* Subroutines for the Rust front end for the NEC V850 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 NEC V850 targets. */ + +void v850_rust_target_cpu_info(void) { + rust_add_target_info("target_arch", "v850"); + + // appears to have no current or historical support in llvm, so names made up by me + if (TARGET_APP_REGS) + rust_add_target_info("target_feature", "app-regs"); + if (TARGET_BIG_SWITCH) { + rust_add_target_info("target_feature", "big-switch"); + rust_add_target_info("target_feature", "long-jumps"); + } + if (TARGET_DEBUG) + rust_add_target_info("target_feature", "debug"); + if (TARGET_DISABLE_CALLT) + rust_add_target_info("target_feature", "disable-callt"); + if (TARGET_EP) + rust_add_target_info("target_feature", "ep"); + if (TARGET_LONG_CALLS) + rust_add_target_info("target_feature", "long-calls"); + if (TARGET_PROLOG_FUNCTION) + rust_add_target_info("target_feature", "prolog-function"); + // TODO: find if can get info from sda, zda and tda options + if (TARGET_SMALL_SLD) + rust_add_target_info("target_feature", "small-sld"); + if (TARGET_NO_STRICT_ALIGN) + rust_add_target_info("target_feature", "no-strict-align"); + if (TARGET_JUMP_TABLES_IN_DATA_SECTION) + rust_add_target_info("target_feature", "jump-tables-in-data-section"); + if (TARGET_US_BIT_SET) + rust_add_target_info("target_feature", "US-bit-set"); + if (TARGET_V850) + rust_add_target_info("target_feature", "v850"); + if (TARGET_V850E) + rust_add_target_info("target_feature", "v850e"); + if (TARGET_V850E1) + rust_add_target_info("target_feature", "v850e1"); + if (TARGET_V850E2) + rust_add_target_info("target_feature", "v850e2"); + if (TARGET_V850E2V3) + rust_add_target_info("target_feature", "v850e2v3"); + if (TARGET_V850E2V5) // TODO: how do i deal with V850E2V4 redirecting to this? + rust_add_target_info("target_feature", "v850e2v5"); + if (TARGET_LOOP) + rust_add_target_info("target_feature", "loop"); + if (TARGET_RELAX) + rust_add_target_info("target_feature", "relax"); + if (TARGET_SOFT_FLOAT) + rust_add_target_info("target_feature", "soft-float"); + else + rust_add_target_info("target_feature", "hard-float"); + if (TARGET_GCC_ABI) + rust_add_target_info("target_feature", "gcc-abi"); + else + rust_add_target_info("target_feature", "rh850-abi"); + if (TARGET_8BYTE_ALIGN) + rust_add_target_info("target_feature", "8byte-align"); +} diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index 7ae583c..72daf1a 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -156,6 +156,8 @@ } \ while(0) +#define TARGET_RUST_CPU_INFO v850_rust_target_cpu_info + #define MASK_CPU (MASK_V850 | MASK_V850E | MASK_V850E1 | MASK_V850E2 | MASK_V850E2V3 | MASK_V850E3V5) /* Target machine storage layout */ |