aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimplyTheOther <simplytheother@gmail.com>2020-07-08 22:09:29 +0800
committerPhilip Herron <philip.herron@embecosm.com>2020-11-28 21:13:18 +0000
commitb92289909d9367090a298d8af54c6f1de4c1a394 (patch)
treeb62a389bc0b0a80910345d1f9a6721746512a9c6
parent143490432941699e07a38d49a04179dd696b524c (diff)
downloadgcc-b92289909d9367090a298d8af54c6f1de4c1a394.zip
gcc-b92289909d9367090a298d8af54c6f1de4c1a394.tar.gz
gcc-b92289909d9367090a298d8af54c6f1de4c1a394.tar.bz2
Added HPPA target hook (or provisional one at least)
-rw-r--r--gcc/config.gcc1
-rw-r--r--gcc/config/pa/pa-protos.h3
-rw-r--r--gcc/config/pa/pa-rust.c88
-rw-r--r--gcc/config/pa/pa.h2
-rw-r--r--gcc/config/pa/t-pa3
5 files changed, 97 insertions, 0 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 680ab05..571ce1a 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -478,6 +478,7 @@ ia64-*-*)
;;
hppa*-*-*)
cpu_type=pa
+ rust_target_objs="pa-rust.o"
;;
lm32*)
extra_options="${extra_options} g.opt"
diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h
index 5222ce6..eab4651 100644
--- a/gcc/config/pa/pa-protos.h
+++ b/gcc/config/pa/pa-protos.h
@@ -115,3 +115,6 @@ extern const int pa_magic_milli[];
/* Routines implemented in pa-d.c */
extern void pa_d_target_versions (void);
+
+/* Routines implemented in pa-rust.c */
+extern void pa_rust_target_cpu_info (void);
diff --git a/gcc/config/pa/pa-rust.c b/gcc/config/pa/pa-rust.c
new file mode 100644
index 0000000..a121737
--- /dev/null
+++ b/gcc/config/pa/pa-rust.c
@@ -0,0 +1,88 @@
+/* Subroutines for the Rust front end for the HPPA 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 HPPA targets. */
+
+void pa_rust_target_cpu_info(void) {
+ rust_add_target_info("target_arch", "hppa");
+
+ // 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_CALLER_COPIES)
+ rust_add_target_info("target_feature", "caller-copies");
+ if (TARGET_COHERENT_LDCW)
+ rust_add_target_info("target_feature", "coherent-ldcw");
+ if (TARGET_DISABLE_FPREGS)
+ rust_add_target_info("target_feature", "disable-fpregs");
+ if (TARGET_DISABLE_INDEXING)
+ rust_add_target_info("target_feature", "disable-indexing");
+ if (TARGET_FAST_INDIRECT_CALLS)
+ rust_add_target_info("target_feature", "fast-indirect-calls");
+ // TODO: figure out how to represent fixed-range (ranges of registers to make fixed) as define
+ if (TARGET_GAS)
+ rust_add_target_info("target_feature", "gas");
+ if (TARGET_LONG_CALLS)
+ rust_add_target_info("target_feature", "long-calls");
+ if (TARGET_LONG_LOAD_STORE)
+ rust_add_target_info("target_feature", "long-load-store");
+ if (TARGET_NO_SPACE_REGS)
+ rust_add_target_info("target_feature", "no-space-regs");
+ if (TARGET_ORDERED)
+ rust_add_target_info("target_feature", "ordered");
+ if (TARGET_PORTABLE_RUNTIME)
+ rust_add_target_info("target_feature", "portable-runtime");
+ if (TARGET_SOFT_FLOAT)
+ rust_add_target_info("target_feature", "soft-float");
+
+ // defines for generating PA 1.1 or PA 2.0 code - TODO should PA 2.0 imply PA 1.1 as well?
+ if (TARGET_PA_11)
+ rust_add_target_info("target_feature", "pa-risc-1-1");
+ if (TARGET_PA_20)
+ rust_add_target_info("target_feature", "pa-risc-2-0");
+
+ // TODO: ensure switch and variable work
+ switch (pa_cpu) {
+ case PROCESSOR_8000:
+ rust_add_target_info("target_feature", "schedule-8000");
+ break;
+ case PROCESSOR_7100:
+ rust_add_target_info("target_feature", "schedule-7100");
+ break;
+ case PROCESSOR_700:
+ rust_add_target_info("target_feature", "schedule-700");
+ break;
+ case PROCESSOR_7100LC:
+ rust_add_target_info("target_feature", "schedule-7100lc");
+ break;
+ case PROCESSOR_7200:
+ rust_add_target_info("target_feature", "schedule-7200");
+ break;
+ case PROCESSOR_7300:
+ rust_add_target_info("target_feature", "schedule-7300");
+ break;
+ default: // should this be an error?
+ break;
+ }
+}
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 64e792a..bb3c285 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -182,6 +182,8 @@ do { \
builtin_define("__SIZEOF_FLOAT128__=16"); \
} while (0)
+#define TARGET_RUST_CPU_INFO pa_rust_target_cpu_info
+
/* An old set of OS defines for various BSD-like systems. */
#define TARGET_OS_CPP_BUILTINS() \
do \
diff --git a/gcc/config/pa/t-pa b/gcc/config/pa/t-pa
index fbd05d2..52deee6 100644
--- a/gcc/config/pa/t-pa
+++ b/gcc/config/pa/t-pa
@@ -2,3 +2,6 @@ pa-d.o: $(srcdir)/config/pa/pa-d.c
$(COMPILE) $<
$(POSTCOMPILE)
+pa-rust.o: $(srcdir)/config/pa/pa-rust.c \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<