diff options
author | SimplyTheOther <simplytheother@gmail.com> | 2020-07-09 22:01:05 +0800 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2020-11-28 21:13:18 +0000 |
commit | 7cd87ee2da3a4ba776cd409d7070bf4b42f553c6 (patch) | |
tree | e064bb800854606bd2e9128e1caf3d1ca6085a8e /gcc | |
parent | b92289909d9367090a298d8af54c6f1de4c1a394 (diff) | |
download | gcc-7cd87ee2da3a4ba776cd409d7070bf4b42f553c6.zip gcc-7cd87ee2da3a4ba776cd409d7070bf4b42f553c6.tar.gz gcc-7cd87ee2da3a4ba776cd409d7070bf4b42f553c6.tar.bz2 |
Added PDP-11 target hook (or provisional one at least)
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config.gcc | 1 | ||||
-rw-r--r-- | gcc/config/pdp11/pdp11-protos.h | 3 | ||||
-rw-r--r-- | gcc/config/pdp11/pdp11-rust.c | 59 | ||||
-rw-r--r-- | gcc/config/pdp11/pdp11.h | 1 | ||||
-rw-r--r-- | gcc/config/pdp11/t-pdp11 | 4 |
5 files changed, 68 insertions, 0 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc index 571ce1a..6a006ef 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2855,6 +2855,7 @@ or1k*-*-*) pdp11-*-*) tm_file="${tm_file} newlib-stdint.h" use_gcc_stdint=wrap + rust_target_objs="pdp11-rust.o" ;; # port not yet contributed #powerpc-*-openbsd*) diff --git a/gcc/config/pdp11/pdp11-protos.h b/gcc/config/pdp11/pdp11-protos.h index 855ec756..e94bdf6 100644 --- a/gcc/config/pdp11/pdp11-protos.h +++ b/gcc/config/pdp11/pdp11-protos.h @@ -55,3 +55,6 @@ extern void pdp11_gen_int_label (char *, const char *, int); extern void pdp11_output_labelref (FILE *, const char *); extern void pdp11_output_def (FILE *, const char *, const char *); extern void pdp11_output_addr_vec_elt (FILE *, int); + +/* Routines implemented in pdp11-rust.c */ +extern void pdp11_rust_target_cpu_info (void); diff --git a/gcc/config/pdp11/pdp11-rust.c b/gcc/config/pdp11/pdp11-rust.c new file mode 100644 index 0000000..270fcc0 --- /dev/null +++ b/gcc/config/pdp11/pdp11-rust.c @@ -0,0 +1,59 @@ +/* Subroutines for the Rust front end for the PDP-11 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 PDP-11 targets. */ + +void pdp11_rust_target_cpu_info(void) { + rust_add_target_info("target_arch", "pdp11"); + + // names made up by me (as no apparent current nor historical llvm support), based on gcc options + /* TODO: figure out how to get data for linker-opt, nosnake - not defined in variable, apparently */ + if (TARGET_AC0) + rust_add_target_info("target_feature", "ac0"); + if (TARGET_DEC_ASM) + rust_add_target_info("target_feature", "dec-asm"); + if (TARGET_GNU_ASM) + rust_add_target_info("target_feature", "gnu-asm"); + if (TARGET_UNIX_ASM) + rust_add_target_info("target_feature", "unix-asm"); + if (TARGET_FPU) + rust_add_target_info("target_feature", "fpu"); + else + rust_add_target_info("target_feature", "soft-float"); + if (TARGET_INT32) + rust_add_target_info("target_feature", "int32"); + else + rust_add_target_info("target_feature", "int16"); + if (TARGET_SPLIT) + rust_add_target_info("target_feature", "split"); + if (TARGET_LRA) + rust_add_target_info("target_feature", "lra"); + + // defines for generating -40 and -45 code - TODO should -45 imply -40 as well? -10 seems implicit + if (TARGET_40) + rust_add_target_info("target_feature", "pa-risc-1-1"); + if (TARGET_45) + rust_add_target_info("target_feature", "pa-risc-2-0"); +} diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h index aedeb73..ae2af37 100644 --- a/gcc/config/pdp11/pdp11.h +++ b/gcc/config/pdp11/pdp11.h @@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see } \ while (0) +#define TARGET_RUST_CPU_INFO pdp11_rust_target_cpu_info /* Generate DBX debugging information. */ diff --git a/gcc/config/pdp11/t-pdp11 b/gcc/config/pdp11/t-pdp11 index bdd8d70..a507c53 100644 --- a/gcc/config/pdp11/t-pdp11 +++ b/gcc/config/pdp11/t-pdp11 @@ -29,3 +29,7 @@ CRTSTUFF_T_CFLAGS = -Os # We could say "-Werror -Wno-error=type-limits", alas, not all supported # gcc bootstrap compilers support the latter option. dwarf2out.o-warn = -Wno-error + +pdp11-rust.o: $(srcdir)/config/pdp11/pdp11-rust.c \ + $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H) + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< |