diff options
author | SimplyTheOther <simplytheother@gmail.com> | 2020-06-19 16:44:36 +0800 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2020-11-28 21:13:16 +0000 |
commit | 158a1e07761aa438fe389a61e869642f38ee53ff (patch) | |
tree | e12bcb60be8dc1d9802cb11b11a5699b3230641d | |
parent | 03bc3cd68260c7270a3bcde14ba159e5a986b0e6 (diff) | |
download | gcc-158a1e07761aa438fe389a61e869642f38ee53ff.zip gcc-158a1e07761aa438fe389a61e869642f38ee53ff.tar.gz gcc-158a1e07761aa438fe389a61e869642f38ee53ff.tar.bz2 |
Added Epiphany target hook (or at least provisional one)
-rw-r--r-- | gcc/config.gcc | 1 | ||||
-rw-r--r-- | gcc/config/epiphany/epiphany-protos.h | 3 | ||||
-rw-r--r-- | gcc/config/epiphany/epiphany-rust.c | 82 | ||||
-rw-r--r-- | gcc/config/epiphany/epiphany.h | 2 | ||||
-rw-r--r-- | gcc/config/epiphany/t-epiphany | 4 |
5 files changed, 92 insertions, 0 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc index 558acce..c3d6763 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1622,6 +1622,7 @@ epiphany-*-elf | epiphany-*-rtems*) extra_objs="${extra_objs} mode-switch-use.o resolve-sw-modes.o" tm_defines="${tm_defines} EPIPHANY_STACK_OFFSET=${with_stack_offset:-8}" extra_headers="epiphany_intrinsics.h" + rust_target_objs="epiphany-rust.o" ;; fr30-*-elf) tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" diff --git a/gcc/config/epiphany/epiphany-protos.h b/gcc/config/epiphany/epiphany-protos.h index 1d05b09..4765770 100644 --- a/gcc/config/epiphany/epiphany-protos.h +++ b/gcc/config/epiphany/epiphany-protos.h @@ -26,6 +26,9 @@ extern struct rtx_def *gen_compare_reg (machine_mode, enum rtx_code, machine_mode, rtx, rtx); #endif +/* Defined in epiphany-rust.c */ +extern void epiphany_rust_target_cpu_info (void); + /* Declarations for various fns used in the .md file. */ extern void epiphany_final_prescan_insn (rtx_insn *, rtx *, int); extern bool epiphany_is_long_call_p (rtx); diff --git a/gcc/config/epiphany/epiphany-rust.c b/gcc/config/epiphany/epiphany-rust.c new file mode 100644 index 0000000..01a73d9 --- /dev/null +++ b/gcc/config/epiphany/epiphany-rust.c @@ -0,0 +1,82 @@ +/* Subroutines for the Rust front end for the Adapteva Epiphany 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 Adapteva Epiphany targets. */ + +void cris_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 + // TODO: very subject to change + // TODO: should the "no" dichotomy be preserved? probably not, but which should be chosen? + if (TARGET_HALF_REG_FILE) + rust_add_target_info("target_feature", "half-reg-file"); + if (TARGET_PREFER_SHORT_INSN_REGS) + rust_add_target_info("target_feature", "prefer-short-insn-regs"); + // TODO: maybe have a "branch-cost" feature? doesn't really fit well with "define-only", though + if (TARGET_CMOVE) + rust_add_target_info("target_feature", "cmove"); + // TODO: maybe have a "nops" feature? doesn't really fit well with "define-only", though + if (TARGET_SOFT_CMPSF) + rust_add_target_info("target_feature", "soft-cmpsf"); + else + rust_add_target_info("target_feature", "no-soft-cmpsf"); + // TODO: maybe have a "stack-offset" feature? doesn't really fit well with "define-only", though + if (TARGET_ROUND_NEAREST) + rust_add_target_info("target_feature", "round-nearest"); + else + rust_add_target_info("target_feature", "no-round-nearest"); + if (TARGET_LONG_CALLS) + rust_add_target_info("target_feature", "long-calls"); + if (TARGET_SHORT_CALLS) + rust_add_target_info("target_feature", "short-calls"); + if (TARGET_SMALL16) + rust_add_target_info("target_feature", "small16"); + // TODO: output mfp-mode somehow - "define-only" may work, but idk + if (TARGET_SPLIT_LOHI) + rust_add_target_info("target_feature", "split-lohi"); + else + rust_add_target_info("target_feature", "no-split-lohi"); + if (TARGET_POST_INC) + rust_add_target_info("target_feature", "postinc"); + else + rust_add_target_info("target_feature", "no-postinc"); + if (TARGET_POST_MODIFY) + rust_add_target_info("target_feature", "postmodify"); + else + rust_add_target_info("target_feature", "no-postmodify"); + if (TARGET_VECT_DOUBLE) + rust_add_target_info("target_feature", "vect-double"); + else + rust_add_target_info("target_feature", "no-vect-double"); + // TODO: maybe have a "max-vect-align" feature? doesn't really fit well with "define-only", though + if (TARGET_SPLIT_VECMOVE_EARLY) + rust_add_target_info("target_feature", "split-vecmove-early"); + // TODO: maybe a feature about having the -1 register (1reg)? + if (TARGET_FP_IARITH) + rust_add_target_info("target_feature", "fp-iarith"); + if (TARGET_MAY_ROUND_FOR_TRUNC) + rust_add_target_info("target_feature", "may-round-for-trunc"); +} diff --git a/gcc/config/epiphany/epiphany.h b/gcc/config/epiphany/epiphany.h index 676fc63..273588d 100644 --- a/gcc/config/epiphany/epiphany.h +++ b/gcc/config/epiphany/epiphany.h @@ -41,6 +41,8 @@ along with GCC; see the file COPYING3. If not see builtin_assert ("machine=epiphany"); \ } while (0) +#define TARGET_RUST_CPU_INFO epiphany_rust_target_cpu_info + /* Pick up the libgloss library. One day we may do this by linker script, but for now its static. libgloss might use errno/__errno, which might not have been needed when we diff --git a/gcc/config/epiphany/t-epiphany b/gcc/config/epiphany/t-epiphany index 900a49e..2aa04cd 100644 --- a/gcc/config/epiphany/t-epiphany +++ b/gcc/config/epiphany/t-epiphany @@ -30,6 +30,10 @@ resolve-sw-modes.o : $(srcdir)/config/epiphany/resolve-sw-modes.c \ insn-attr-common.h $(TREE_PASS_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< +epiphany-rust.o: $(srcdir)/config/epiphany/epiphany-rust.c \ + $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H) + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< + SPECS = specs.install specs: specs.install |