1/* d-target.def -- Target hook definitions for the D front end.
2 Copyright (C) 2017-2023 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 3, or (at your option) any
7 later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; see the file COPYING3. If not see
16 <http://www.gnu.org/licenses/>. */
17
18/* See target-hooks-macros.h for details of macros that should be
19 provided by the including file, and how to use them here. */
20
21#include "target-hooks-macros.h"
22
23#undef HOOK_TYPE
24#define HOOK_TYPE "D Target Hook"
25
26HOOK_VECTOR (TARGETDM_INITIALIZER, gcc_targetdm)
27
28#undef HOOK_PREFIX
29#define HOOK_PREFIX "TARGET_"
30
31/* Environmental version identifiers relating to the target CPU. */
32DEFHOOK
33(d_cpu_versions,
34 "Declare all environmental version identifiers relating to the target CPU\n\
35using the function @code{builtin_version}, which takes a string representing\n\
36the name of the version. Version identifiers predefined by this hook apply\n\
37to all modules that are being compiled and imported.",
38 void, (void),
39 hook_void_void)
40
41/* Environmental version identifiers relating to the target OS. */
42DEFHOOK
43(d_os_versions,
44 "Similarly to @code{TARGET_D_CPU_VERSIONS}, but is used for versions\n\
45relating to the target operating system.",
46 void, (void),
47 hook_void_void)
48
49/* getTargetInfo keys relating to the target CPU. */
50DEFHOOK
51(d_register_cpu_target_info,
52 "Register all target information keys relating to the target CPU using the\n\
53function @code{d_add_target_info_handlers}, which takes a\n\
54@samp{struct d_target_info_spec} (defined in @file{d/d-target.h}). The keys\n\
55added by this hook are made available at compile time by the\n\
56@code{__traits(getTargetInfo)} extension, the result is an expression\n\
57describing the requested target information.",
58 void, (void),
59 hook_void_void)
60
61/* getTargetInfo keys relating to the target OS. */
62DEFHOOK
63(d_register_os_target_info,
64 "Same as @code{TARGET_D_CPU_TARGET_INFO}, but is used for keys relating to\n\
65the target operating system.",
66 void, (void),
67 hook_void_void)
68
69/* ModuleInfo section name and brackets. */
70DEFHOOKPOD
71(d_minfo_section,
72 "Contains the name of the section in which module info references should be\n\
73placed. By default, the compiler puts all module info symbols in the\n\
74@code{\"minfo\"} section. Define this macro to override the string if a\n\
75different section name should be used. This section is expected to be\n\
76bracketed by two symbols @code{TARGET_D_MINFO_SECTION_START} and \n\
77@code{TARGET_D_MINFO_SECTION_END} to indicate the start and end address of\n\
78the section, so that the runtime library can collect all modules for each\n\
79loaded shared library and executable. Setting the value to @code{NULL}\n\
80disables the use of sections for storing module info altogether.",
81 const char *, "minfo")
82
83DEFHOOKPOD
84(d_minfo_section_start,
85 "If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined\n\
86as the name of the symbol indicating the start address of the module info\n\
87section",
88 const char *, "__start_minfo")
89
90DEFHOOKPOD
91(d_minfo_section_end,
92 "If @code{TARGET_D_MINFO_SECTION} is defined, then this must also be defined\n\
93as the name of the symbol indicating the end address of the module info\n\
94section",
95 const char *, "__stop_minfo")
96
97/* The "stdcall" convention is really supported on 32-bit x86/Windows only.
98 The following hook is a helper to determine whether to apply the attribute
99 on declarations with `extern(System)' and `extern(Windows)' linkage. */
100DEFHOOK
101(d_has_stdcall_convention,
102 "Returns @code{true} if the target supports the stdcall calling convention.\n\
103The hook should also set @var{link_system} to @code{1} if the @code{stdcall}\n\
104attribute should be applied to functions with @code{extern(System)} linkage,\n\
105and @var{link_windows} to @code{1} to apply @code{stdcall} to functions with\n\
106@code{extern(Windows)} linkage.",
107 bool, (unsigned int *link_system, unsigned int *link_windows),
108 hook_bool_uintp_uintp_false)
109
110/* True if instantiations are always COMDAT if they have external linkage. */
111DEFHOOKPOD
112(d_templates_always_comdat,
113 "This flag is true if instantiated functions and variables are always COMDAT\n\
114if they have external linkage. If this flag is false, then instantiated\n\
115decls will be emitted as weak symbols. The default is @code{false}.",
116 bool, false)
117
118/* Close the 'struct gcc_targetdm' definition. */
119HOOK_VECTOR_END (C90_EMPTY_HACK)
120

source code of gcc/d/d-target.def