From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 741DD385841A for ; Thu, 7 Sep 2023 13:38:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 741DD385841A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-31f6ddb3047so835569f8f.1 for ; Thu, 07 Sep 2023 06:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1694093906; x=1694698706; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=5HsKNrzMU9P/826DiSpKVPte2DI+FYeQKq9oQw58P0w=; b=glnkgWuAKtufzkN/Bp8Nj+PTbVDRLMVR74zMJ53A3x7UdXlVmK/tfnG58rI1Q/NgO5 qE8Inv1NCycqvgoW/7QDx8/CWziE4B+KFCnsdrgBJaGURwSWmrSgW+9XV5jmjzacxFWQ CfFe2GHTLPxliEiUZgLFwc7Cvcyp00DaX3F+MWgW60zUHLT4e6k14LpOj3g1eRp8H8gI NysvkDUckJIbHr/41kF0TRG+xdsNoxcjCL7lwTZSIbGUwrXQ0AxkPOftjJyir8sNyIcL +XKXmhKDYk0QoSg3WEktYCnTAxiJI0WF/1EFXNxJwWCsc3Tg0NTIxI51iLbApVSTv6hj LqxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694093906; x=1694698706; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5HsKNrzMU9P/826DiSpKVPte2DI+FYeQKq9oQw58P0w=; b=cLcvwRUyt+aGKs2UVOtL1HTsh4EXLRjYkTt99CEysGq6l4YJG2FY7eAuXoMI56enxz 9UfPMGxeOD2B1uxKmU1ff8lh/+ENROgVZeXuKEs8NjFSCrWw7odJ+QWZEg+wIZckAsw+ fFlJC2sGGwRCJKxLgALM4kaUV2MnrxGVTKXXGx+D1g0cXCccM6Q78L1L8+fWQ8r7UaEY XFYH4SRkj4jy02hGLOOcyLo1x8ANLrlh0TihB1uG3MAZEN/nWkSLKiNx0uKpFXKzEsDB Z1BmD9t9vKcwbhm66rjMr7x29dy0n3X2FbHJPnUhK5VmljdSTlH1u/V1aahAtH6IOXG4 nmEA== X-Gm-Message-State: AOJu0Ywtrl27NnXSg1rxg4PMGpIpWT68eWYiSN4LLkoy6sSMDtVCUxA8 plCUvl83uC1+WFHyQImhDKRlDCEG0ibrxa6s+Q== X-Google-Smtp-Source: AGHT+IEyWw3ZU8uCU6EIDNkaJwuWXzd0AbvnUTj/iVWr3nP+3AMDsga3zN76F6JqxAbxELXh2LzSRw== X-Received: by 2002:adf:f749:0:b0:319:785a:fce5 with SMTP id z9-20020adff749000000b00319785afce5mr4768849wrp.38.1694093905494; Thu, 07 Sep 2023 06:38:25 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id bt12-20020a056000080c00b0031433443265sm17693052wrb.53.2023.09.07.06.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Sep 2023 06:38:25 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, ibuclaw@gdcproject.org Subject: [PATCH 01/14] rust: Add skeleton support and documentation for targetrustm hooks. Date: Thu, 7 Sep 2023 15:36:27 +0200 Message-ID: <20230907133729.2518969-2-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.42.0 Reply-To: arthur.cohen@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_LINEPADDING,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Iain Buclaw gcc/ChangeLog: * Makefile.in (tm_rust_file_list, tm_rust_include_list, TM_RUST_H, RUST_TARGET_DEF, RUST_TARGET_H, RUST_TARGET_OBJS): New variables. (tm_rust.h, cs-tm_rust.h, default-rust.o, rust/rust-target-hooks-def.h, s-rust-target-hooks-def-h): New rules. (s-tm-texi): Also check timestamp on rust-target.def. (generated_files): Add TM_RUST_H and rust-target-hooks-def.h. (build/genhooks.o): Also depend on RUST_TARGET_DEF. * config.gcc (tm_rust_file, rust_target_objs, target_has_targetrustm): New variables. * configure: Regenerate. * configure.ac (tm_rust_file_list, tm_rust_include_list, rust_target_objs): Add substitutes. * doc/tm.texi: Regenerate. * doc/tm.texi.in (targetrustm): Document. (target_has_targetrustm): Document. * genhooks.cc: Include rust/rust-target.def. * config/default-rust.cc: New file. gcc/rust/ChangeLog: * rust-target-def.h: New file. * rust-target.def: New file. * rust-target.h: New file. --- gcc/Makefile.in | 34 +++++++++++++++++++++++++++++++++- gcc/config.gcc | 25 +++++++++++++++++++++++++ gcc/config/default-rust.cc | 29 +++++++++++++++++++++++++++++ gcc/configure | 21 +++++++++++++++++++-- gcc/configure.ac | 14 ++++++++++++++ gcc/doc/tm.texi | 8 ++++++++ gcc/doc/tm.texi.in | 8 ++++++++ gcc/genhooks.cc | 1 + gcc/rust/rust-target-def.h | 20 ++++++++++++++++++++ gcc/rust/rust-target.def | 32 ++++++++++++++++++++++++++++++++ gcc/rust/rust-target.h | 31 +++++++++++++++++++++++++++++++ 11 files changed, 220 insertions(+), 3 deletions(-) create mode 100644 gcc/config/default-rust.cc create mode 100644 gcc/rust/rust-target-def.h create mode 100644 gcc/rust/rust-target.def create mode 100644 gcc/rust/rust-target.h diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 6d608db4dd2..9cc16268abf 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -600,6 +600,8 @@ tm_p_file_list=@tm_p_file_list@ tm_p_include_list=@tm_p_include_list@ tm_d_file_list=@tm_d_file_list@ tm_d_include_list=@tm_d_include_list@ +tm_rust_file_list=@tm_rust_file_list@ +tm_rust_include_list=@tm_rust_include_list@ build_xm_file_list=@build_xm_file_list@ build_xm_include_list=@build_xm_include_list@ build_xm_defines=@build_xm_defines@ @@ -898,6 +900,7 @@ TCONFIG_H = tconfig.h $(xm_file_list) # Some $(target)-protos.h depends on tree.h TM_P_H = tm_p.h $(tm_p_file_list) $(TREE_H) TM_D_H = tm_d.h $(tm_d_file_list) +TM_RUST_H = tm_rust.h $(tm_rust_file_list) GTM_H = tm.h $(tm_file_list) insn-constants.h TM_H = $(GTM_H) insn-flags.h $(OPTIONS_H) @@ -956,10 +959,12 @@ TARGET_DEF = target.def target-hooks-macros.h target-insns.def C_TARGET_DEF = c-family/c-target.def target-hooks-macros.h COMMON_TARGET_DEF = common/common-target.def target-hooks-macros.h D_TARGET_DEF = d/d-target.def target-hooks-macros.h +RUST_TARGET_DEF = rust/rust-target.def target-hooks-macros.h TARGET_H = $(TM_H) target.h $(TARGET_DEF) insn-modes.h insn-codes.h C_TARGET_H = c-family/c-target.h $(C_TARGET_DEF) COMMON_TARGET_H = common/common-target.h $(INPUT_H) $(COMMON_TARGET_DEF) D_TARGET_H = d/d-target.h $(D_TARGET_DEF) +RUST_TARGET_H = rust/rust-target.h $(RUST_TARGET_DEF) MACHMODE_H = machmode.h mode-classes.def HOOKS_H = hooks.h HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H) @@ -1268,6 +1273,9 @@ D_TARGET_OBJS=@d_target_objs@ # Target specific, Fortran specific object file FORTRAN_TARGET_OBJS=@fortran_target_objs@ +# Target specific, Rust specific object file +RUST_TARGET_OBJS=@rust_target_objs@ + # Object files for gcc many-languages driver. GCC_OBJS = gcc.o gcc-main.o ggc-none.o @@ -1999,6 +2007,7 @@ tconfig.h: cs-tconfig.h ; @true tm.h: cs-tm.h ; @true tm_p.h: cs-tm_p.h ; @true tm_d.h: cs-tm_d.h ; @true +tm_rust.h: cs-tm_rust.h ; @true cs-config.h: Makefile TARGET_CPU_DEFAULT="" \ @@ -2030,6 +2039,11 @@ cs-tm_d.h: Makefile HEADERS="$(tm_d_include_list)" DEFINES="" \ $(SHELL) $(srcdir)/mkconfig.sh tm_d.h +cs-tm_rust.h: Makefile + TARGET_CPU_DEFAULT="" \ + HEADERS="$(tm_rust_include_list)" DEFINES="" \ + $(SHELL) $(srcdir)/mkconfig.sh tm_rust.h + # Don't automatically run autoconf, since configure.ac might be accidentally # newer than configure. Also, this writes into the source directory which # might be on a read-only file system. If configured for maintainer mode @@ -2366,6 +2380,12 @@ default-d.o: config/default-d.cc $(COMPILE) $< $(POSTCOMPILE) +# Files used by the Rust language front end. + +default-rust.o: config/default-rust.cc + $(COMPILE) $< + $(POSTCOMPILE) + # Language-independent files. DRIVER_DEFINES = \ @@ -2672,6 +2692,15 @@ s-d-target-hooks-def-h: build/genhooks$(build_exeext) d/d-target-hooks-def.h $(STAMP) s-d-target-hooks-def-h +rust/rust-target-hooks-def.h: s-rust-target-hooks-def-h; @true + +s-rust-target-hooks-def-h: build/genhooks$(build_exeext) + $(RUN_GEN) build/genhooks$(build_exeext) "Rust Target Hook" \ + > tmp-rust-target-hooks-def.h + $(SHELL) $(srcdir)/../move-if-change tmp-rust-target-hooks-def.h \ + rust/rust-target-hooks-def.h + $(STAMP) s-rust-target-hooks-def-h + # check if someone mistakenly only changed tm.texi. # We use a different pathname here to avoid a circular dependency. s-tm-texi: $(srcdir)/doc/../doc/tm.texi @@ -2696,6 +2725,7 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in || test $(srcdir)/doc/tm.texi -nt $(srcdir)/c-family/c-target.def \ || test $(srcdir)/doc/tm.texi -nt $(srcdir)/common/common-target.def \ || test $(srcdir)/doc/tm.texi -nt $(srcdir)/d/d-target.def \ + || test $(srcdir)/doc/tm.texi -nt $(srcdir)/rust/rust-target.def \ ); then \ echo >&2 ; \ echo You should edit $(srcdir)/doc/tm.texi.in rather than $(srcdir)/doc/tm.texi . >&2 ; \ @@ -2872,6 +2902,7 @@ generated_files = config.h tm.h $(TM_P_H) $(TM_D_H) $(TM_H) multilib.h \ $(GIMPLE_MATCH_PD_SEQ_SRC) $(GENERIC_MATCH_PD_SEQ_SRC) \ gimple-match-auto.h generic-match-auto.h \ c-family/c-target-hooks-def.h d/d-target-hooks-def.h \ + $(TM_RUST_H) rust/rust-target-hooks-def.h \ case-cfn-macros.h \ cfn-operators.pd omp-device-properties.h @@ -3006,7 +3037,8 @@ build/genrecog.o : genrecog.cc $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H) \ $(HASH_TABLE_H) inchash.h build/genhooks.o : genhooks.cc $(TARGET_DEF) $(C_TARGET_DEF) \ - $(COMMON_TARGET_DEF) $(D_TARGET_DEF) $(BCONFIG_H) $(SYSTEM_H) errors.h + $(COMMON_TARGET_DEF) $(D_TARGET_DEF) $(RUST_TARGET_DEF) $(BCONFIG_H) \ + $(SYSTEM_H) errors.h build/genmddump.o : genmddump.cc $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ $(CORETYPES_H) $(GTM_H) errors.h $(READ_MD_H) $(GENSUPPORT_H) build/genmatch.o : genmatch.cc $(BCONFIG_H) $(SYSTEM_H) $(CORETYPES_H) \ diff --git a/gcc/config.gcc b/gcc/config.gcc index b2fe7c7ceef..13c575839ef 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -90,6 +90,9 @@ # tm_d_file A list of headers with definitions of target hook # macros for the D compiler. # +# tm_rust_file list of headers with definitions of target hook +# macros for the Rust compiler. +# # out_file The name of the machine description C support # file, if different from "$cpu_type/$cpu_type.c". # @@ -149,6 +152,9 @@ # fortran_target_objs List of extra target-dependent objects that be # linked into the fortran compiler only. # +# rust_target_objs List of extra target-dependent objects that be +# linked into the Rust compiler only. +# # target_gtfiles List of extra source files with type information. # # xm_defines List of macros to define when compiling for the @@ -201,6 +207,9 @@ # # target_has_targetdm Set to yes or no depending on whether the target # has its own definition of targetdm. +# +# target_has_targetrustm Set to yes or no depending on whether the target +# has its own definition of targetrustm. out_file= common_out_file= @@ -218,9 +227,11 @@ c_target_objs= cxx_target_objs= d_target_objs= fortran_target_objs= +rust_target_objs= target_has_targetcm=no target_has_targetm_common=yes target_has_targetdm=no +target_has_targetrustm=no tm_defines= xm_defines= # Set this to force installation and use of collect2. @@ -590,6 +601,16 @@ then tm_d_file="${tm_d_file} ${cpu_type}/${cpu_type}-d.h" fi +tm_rust_file= +if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-rust.h +then + tm_rust_file="${cpu_type}/${cpu_type}-rust.h" +fi +if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-rust.cc +then + rust_target_objs="${rust_target_objs} ${cpu_type}-rust.o" +fi + extra_modes= if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-modes.def then @@ -3606,6 +3627,10 @@ if [ "$target_has_targetdm" = "no" ]; then d_target_objs="$d_target_objs default-d.o" fi +if [ "$target_has_targetrustm" = "no" ]; then + rust_target_objs="$rust_target_objs default-rust.o" +fi + # Support for --with-cpu and related options (and a few unrelated options, # too). case ${with_cpu} in diff --git a/gcc/config/default-rust.cc b/gcc/config/default-rust.cc new file mode 100644 index 00000000000..aa098cbb806 --- /dev/null +++ b/gcc/config/default-rust.cc @@ -0,0 +1,29 @@ +/* Default Rust language target hooks initializer. + Copyright (C) 2022 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 +. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm_rust.h" +#include "rust/rust-target.h" +#include "rust/rust-target-def.h" + +/* Do not include tm.h or tm_p.h here; definitions needed by the target + architecture to initialize targetrustm should instead be added to tm_rust.h. + */ + +struct gcc_targetrustm targetrustm = TARGETRUSTM_INITIALIZER; diff --git a/gcc/configure b/gcc/configure index 07e8a64afbb..53a32373a18 100755 --- a/gcc/configure +++ b/gcc/configure @@ -645,6 +645,7 @@ ISLLIBS GMPINC GMPLIBS target_cpu_default +rust_target_objs d_target_objs fortran_target_objs cxx_target_objs @@ -653,6 +654,8 @@ use_gcc_stdint xm_defines xm_include_list xm_file_list +tm_rust_include_list +tm_rust_file_list tm_d_include_list tm_d_file_list tm_p_include_list @@ -13562,6 +13565,17 @@ for f in $tm_d_file; do esac done +tm_rust_file_list= +tm_rust_include_list= +for f in $tm_rust_file; do + case $f in + * ) + tm_rust_file_list="${tm_rust_file_list} \$(srcdir)/config/$f" + tm_rust_include_list="${tm_rust_include_list} config/$f" + ;; + esac +done + xm_file_list= xm_include_list= for f in $xm_file; do @@ -19886,7 +19900,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19889 "configure" +#line 19903 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19992,7 +20006,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19995 "configure" +#line 20009 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -31903,6 +31917,9 @@ fi + + + diff --git a/gcc/configure.ac b/gcc/configure.ac index cb4be11facd..c193c96452a 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2405,6 +2405,17 @@ for f in $tm_d_file; do esac done +tm_rust_file_list= +tm_rust_include_list= +for f in $tm_rust_file; do + case $f in + * ) + tm_rust_file_list="${tm_rust_file_list} \$(srcdir)/config/$f" + tm_rust_include_list="${tm_rust_include_list} config/$f" + ;; + esac +done + xm_file_list= xm_include_list= for f in $xm_file; do @@ -7381,6 +7392,8 @@ AC_SUBST(tm_p_file_list) AC_SUBST(tm_p_include_list) AC_SUBST(tm_d_file_list) AC_SUBST(tm_d_include_list) +AC_SUBST(tm_rust_file_list) +AC_SUBST(tm_rust_include_list) AC_SUBST(xm_file_list) AC_SUBST(xm_include_list) AC_SUBST(xm_defines) @@ -7389,6 +7402,7 @@ AC_SUBST(c_target_objs) AC_SUBST(cxx_target_objs) AC_SUBST(fortran_target_objs) AC_SUBST(d_target_objs) +AC_SUBST(rust_target_objs) AC_SUBST(target_cpu_default) AC_SUBST_FILE(language_hooks) diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index ff69207fb9f..69123f00298 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -115,6 +115,14 @@ initialize @code{targetdm} themselves, they should set @code{target_has_targetdm=yes} in @file{config.gcc}; otherwise a default definition is used. +Similarly, there is a @code{targetrustm} variable for hooks that are +specific to the Rust language front end, documented as ``Rust Target +Hook''. This is declared in @file{rust/rust-target.h}, the initializer +@code{TARGETRUSTM_INITIALIZER} in @file{rust/rust-target-def.h}. +If targets initialize @code{targetrustm} themselves, they should set +@code{target_has_targetrustm=yes} in @file{config.gcc}; otherwise a +default definition is used. + @node Driver @section Controlling the Compilation Driver, @file{gcc} @cindex driver diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index cad6308a87c..9bac02b9b66 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -115,6 +115,14 @@ initialize @code{targetdm} themselves, they should set @code{target_has_targetdm=yes} in @file{config.gcc}; otherwise a default definition is used. +Similarly, there is a @code{targetrustm} variable for hooks that are +specific to the Rust language front end, documented as ``Rust Target +Hook''. This is declared in @file{rust/rust-target.h}, the initializer +@code{TARGETRUSTM_INITIALIZER} in @file{rust/rust-target-def.h}. +If targets initialize @code{targetrustm} themselves, they should set +@code{target_has_targetrustm=yes} in @file{config.gcc}; otherwise a +default definition is used. + @node Driver @section Controlling the Compilation Driver, @file{gcc} @cindex driver diff --git a/gcc/genhooks.cc b/gcc/genhooks.cc index 8bcf9929207..49414eca531 100644 --- a/gcc/genhooks.cc +++ b/gcc/genhooks.cc @@ -35,6 +35,7 @@ static struct hook_desc hook_array[] = { #include "c-family/c-target.def" #include "common/common-target.def" #include "d/d-target.def" +#include "rust/rust-target.def" #undef DEFHOOK }; diff --git a/gcc/rust/rust-target-def.h b/gcc/rust/rust-target-def.h new file mode 100644 index 00000000000..8534c4b68c3 --- /dev/null +++ b/gcc/rust/rust-target-def.h @@ -0,0 +1,20 @@ +/* Default initializers for Rust target hooks. + Copyright (C) 2022 Free Software Foundation, Inc. + + This program 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. + + This program 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 this program; see the file COPYING3. If not see + . */ + +#include "rust/rust-target-hooks-def.h" +#include "tree.h" +#include "hooks.h" diff --git a/gcc/rust/rust-target.def b/gcc/rust/rust-target.def new file mode 100644 index 00000000000..c800eefcfaa --- /dev/null +++ b/gcc/rust/rust-target.def @@ -0,0 +1,32 @@ +/* Target hook definitions for the Rust front end. + Copyright (C) 2022 Free Software Foundation, Inc. + + This program 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. + + This program 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 this program; see the file COPYING3. If not see + . */ + +/* See target-hooks-macros.h for details of macros that should be + provided by the including file, and how to use them here. */ + +#include "target-hooks-macros.h" + +#undef HOOK_TYPE +#define HOOK_TYPE "Rust Target Hook" + +HOOK_VECTOR (TARGETRUSTM_INITIALIZER, gcc_targetrustm) + +#undef HOOK_PREFIX +#define HOOK_PREFIX "TARGET_" + +/* Close the 'struct gcc_targetrustm' definition. */ +HOOK_VECTOR_END (C90_EMPTY_HACK) diff --git a/gcc/rust/rust-target.h b/gcc/rust/rust-target.h new file mode 100644 index 00000000000..79edd786cdd --- /dev/null +++ b/gcc/rust/rust-target.h @@ -0,0 +1,31 @@ +/* Data structure definitions for target-specific Rust behavior. + Copyright (C) 2022 Free Software Foundation, Inc. + + This program 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. + + This program 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 this program; see the file COPYING3. If not see + . */ + +#ifndef GCC_RUST_TARGET_H +#define GCC_RUST_TARGET_H + +#define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME; +#define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (*NAME) PARAMS; +#define DEFHOOK_UNDOC DEFHOOK +#define HOOKSTRUCT(FRAGMENT) FRAGMENT + +#include "rust-target.def" + +/* Each target can provide their own. */ +extern struct gcc_targetrustm targetrustm; + +#endif /* GCC_RUST_TARGET_H */ -- 2.42.0