1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Option Parsing Definitions *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* *|
7\*===----------------------------------------------------------------------===*/
8
9/////////
10// Tables
11
12#if defined(OPTTABLE_CODE) || defined(OPTIONS_STRUCT_DEFS)
13namespace {
14enum ID : unsigned {
15 OPT_INVALID = 0,
16 OPT_INPUT,
17 OPT_UNKNOWN,
18 OPT_avoid_spirv_capabilities,
19 OPT_disable_spirv_remove_unused_resources,
20 OPT_spirv_avoid_capabilities,
21 OPT_spirv_debug_lexical_block_discriminator_scope,
22 OPT_spirv_debug_scope_forward_refs,
23 OPT_spirv_emit_init_fini_kernel,
24 OPT_spirv_emit_op_names,
25 OPT_spirv_enable_remove_unused_resources,
26 OPT_spirv_ext,
27 OPT_spirv_fp_contract,
28 OPT_spirv_lower_global_ctor_dtor_id,
29 OPT_spirv_preserve_auxdata,
30 OPT_spirv_translator_compatibility_mode,
31 OPT_spv_emit_nonsemantic_debug_info,
32 OPT_translator_compatibility_mode,
33};
34} // namespace
35
36static llvm::opt::OptTable::Tables optionTables() {
37 using llvm::opt::DefaultVis, llvm::opt::HelpHidden,
38 llvm::opt::RenderAsInput, llvm::opt::RenderJoined,
39 llvm::opt::RenderSeparate;
40
41#ifdef __GNUC__
42#pragma GCC diagnostic push
43#pragma GCC diagnostic ignored "-Woverlength-strings"
44#endif
45static constexpr char OptionStrTableStorage[] =
46 "\0"
47 "-\0"
48 "--\0"
49 "<input>\0"
50 "<unknown>\0"
51 "-avoid-spirv-capabilities\0"
52 "-disable-spirv-remove-unused-resources\0"
53 "false\0"
54 "\0"
55 "-spirv-avoid-capabilities\0"
56 "SPIR-V capabilities to avoid if there are other options enabling a feature\0"
57 "<Shader>\0"
58 "Shader\0"
59 "-spirv-debug-lexical-block-discriminator-scope\0"
60 "Use a DebugLexicalBlockDiscriminator as a DebugScope\0"
61 "-spirv-debug-scope-forward-refs\0"
62 "Forward-reference debug scopes when SPV_KHR_relaxed_extended_instruction is enabled\0"
63 "-spirv-emit-init-fini-kernel\0"
64 "Emit kernels to call ctor/dtor globals\0"
65 "-spirv-emit-op-names\0"
66 "Emit OpName for all instructions\0"
67 "-spirv-enable-remove-unused-resources\0"
68 "Enable spirv-remove-unused-resources pass\0"
69 "-spirv-ext\0"
70 "Specify list of enabled SPIR-V extensions\0"
71 "-spirv-fp-contract\0"
72 "Override FP contraction policy for SPIR-V kernel entry points\0"
73 "<on|off|fast>\0"
74 "on,off,fast\0"
75 "-spirv-lower-global-ctor-dtor-id\0"
76 "Override unique ID of ctor/dtor globals\0"
77 "-spirv-preserve-auxdata\0"
78 "Preserve LLVM attributes and metadata as NonSemantic.AuxData ExtInst annotations (requires SPV_KHR_non_semantic_info)\0"
79 "-spirv-translator-compatibility-mode\0"
80 "SPIR-V Translator compatibility mode\0"
81 "-spv-emit-nonsemantic-debug-info\0"
82 "Deprecated. Use -g to emit SPIR-V NonSemantic.Shader.DebugInfo instructions\0"
83 "-translator-compatibility-mode\0"
84 ;
85#ifdef __GNUC__
86#pragma GCC diagnostic pop
87#endif
88
89static constexpr llvm::StringTable
90OptionStrTable = OptionStrTableStorage;
91
92 static constexpr llvm::StringTable::Offset OptionPrefixesTable[] = {
93 0 /* prefixes */,
94 2 /* prefixes */, 1 /* '-' */, 3 /* '--' */
95 };
96
97 static constexpr llvm::opt::OptTable::HelpTextVariant OptionHelpTextVariantsTable[] = {
98 {0, 0},
99 };
100
101 static constexpr unsigned OptionSubCommandIDsTable[] = {
102 0 /* subcommands */
103 };
104
105 static constexpr llvm::opt::OptTable::InfoExtra OptionInfoExtrasTable[] = {
106 {0, 0, 0, 0, 0, 0, 0, 0},
107 {0, 0, 0, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0},
108 {0, 89, 0, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0},
109 {197, 0, 206, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0},
110 {765, 0, 779, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0},
111 };
112
113 static constexpr llvm::opt::OptTable::Info OptionInfoTable[] = {
114 {6 /* <input> */, 0, 0, 0, 1, 0, llvm::opt::Option::InputClass},
115 {14 /* <unknown> */, 0, 0, 0, 1, 0, llvm::opt::Option::UnknownClass},
116 {24 /* -avoid-spirv-capabilities */, 0, 0, OPT_spirv_avoid_capabilities, 1, 1, llvm::opt::Option::SeparateOrEqClass},
117 {50 /* -disable-spirv-remove-unused-resources */, 0, 0, OPT_spirv_enable_remove_unused_resources, 2, 1, llvm::opt::Option::FlagClass},
118 {96 /* -spirv-avoid-capabilities */, 122, 0, 0, 3, 1, llvm::opt::Option::SeparateOrEqClass},
119 {213 /* -spirv-debug-lexical-block-discriminator-scope */, 260, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
120 {313 /* -spirv-debug-scope-forward-refs */, 345, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
121 {429 /* -spirv-emit-init-fini-kernel */, 458, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
122 {497 /* -spirv-emit-op-names */, 518, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
123 {551 /* -spirv-enable-remove-unused-resources */, 589, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
124 {631 /* -spirv-ext */, 642, 0, 0, 1, 1, llvm::opt::Option::SeparateOrEqClass},
125 {684 /* -spirv-fp-contract */, 703, 0, 0, 4, 1, llvm::opt::Option::SeparateOrEqClass},
126 {791 /* -spirv-lower-global-ctor-dtor-id */, 824, 0, 0, 1, 1, llvm::opt::Option::SeparateOrEqClass},
127 {864 /* -spirv-preserve-auxdata */, 888, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
128 {1006 /* -spirv-translator-compatibility-mode */, 1043, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
129 {1080 /* -spv-emit-nonsemantic-debug-info */, 1113, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
130 {1189 /* -translator-compatibility-mode */, 0, 0, OPT_spirv_translator_compatibility_mode, 1, 1, llvm::opt::Option::FlagOrEqClass},
131 };
132
133 return {OptionStrTable, OptionPrefixesTable,
134 OptionInfoTable, OptionInfoExtrasTable, OptionHelpTextVariantsTable, {}, OptionSubCommandIDsTable};
135}
136#undef OPTTABLE_CODE
137#endif // OPTTABLE_CODE || OPTIONS_STRUCT_DEFS
138
139
140#ifdef OPTIONS_STRUCT_DECL
141#undef OPTIONS_STRUCT_DECL
142#include "llvm/ADT/ArrayRef.h"
143#include "llvm/ADT/BoolOrDefault.h"
144#include "llvm/ADT/StringRef.h"
145#include "llvm/Support/Allocator.h"
146#include "llvm/Support/LibraryOptionsContext.h"
147
148namespace llvm {
149namespace opt {
150class Arg;
151class LibraryOptionsParser;
152class OptTable;
153} // namespace opt
154} // namespace llvm
155
156namespace llvm {
157struct SPIRVOptions {
158 SPIRVFPContractMode fp_contract{SPIRVFPContractMode::On};
159 bool preserve_auxdata{false};
160 bool emit_init_fini_kernel{true};
161 StringRef lower_global_ctor_dtor_id{};
162 bool emit_op_names{false};
163 llvm::ArrayRef<SPIRV::Capability::Capability> avoid_capabilities{};
164 bool debug_lexical_block_discriminator_scope{false};
165 bool debug_scope_forward_refs{false};
166 bool enable_remove_unused_resources{true};
167 StringRef ext{};
168 bool translator_compatibility_mode{false};
169 bool spv_emit_nonsemantic_debug_info{false};
170
171 static const llvm::opt::OptTable &optTable();
172 /// Sets the member that \p A names, allocating a list from \p Alloc.
173 /// Returns false if the value is invalid.
174 bool apply(const llvm::opt::Arg &A, llvm::BumpPtrAllocator &Alloc);
175
176private:
177 friend class llvm::cl::LibraryOptionsContext;
178 friend class llvm::opt::LibraryOptionsParser;
179
180 static const SPIRVOptions Default;
181};
182} // namespace llvm
183#endif // OPTIONS_STRUCT_DECL
184
185#ifdef OPTIONS_STRUCT_DEFS
186#undef OPTIONS_STRUCT_DEFS
187LLVM_REQUIRE_CONSTANT_INITIALIZATION const llvm::SPIRVOptions llvm::SPIRVOptions::Default;
188
189const llvm::opt::OptTable &llvm::SPIRVOptions::optTable() {
190 static const llvm::opt::LibraryOptTable T(optionTables());
191 return T;
192}
193
194bool llvm::SPIRVOptions::apply(const llvm::opt::Arg &A, llvm::BumpPtrAllocator &Alloc) {
195 switch (A.getOption().getID()) {
196 case OPT_spirv_avoid_capabilities:
197 return llvm::opt::parseArgValue(A.getValue(), avoid_capabilities, Alloc, [](llvm::StringRef V, auto &X) {
198 if (V == "Shader") {
199 X = SPIRV::Capability::Shader;
200 return true;
201 }
202 return false;
203 });
204 case OPT_spirv_debug_lexical_block_discriminator_scope:
205 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", debug_lexical_block_discriminator_scope, Alloc);
206 case OPT_spirv_debug_scope_forward_refs:
207 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", debug_scope_forward_refs, Alloc);
208 case OPT_spirv_emit_init_fini_kernel:
209 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", emit_init_fini_kernel, Alloc);
210 case OPT_spirv_emit_op_names:
211 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", emit_op_names, Alloc);
212 case OPT_spirv_enable_remove_unused_resources:
213 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", enable_remove_unused_resources, Alloc);
214 case OPT_spirv_ext:
215 return llvm::opt::parseArgValue(A.getValue(), ext, Alloc);
216 case OPT_spirv_fp_contract:
217 return llvm::opt::parseArgValue(A.getValue(), fp_contract, Alloc, [](llvm::StringRef V, auto &X) {
218 if (V == "on") {
219 X = SPIRVFPContractMode::On;
220 return true;
221 }
222 if (V == "off") {
223 X = SPIRVFPContractMode::Off;
224 return true;
225 }
226 if (V == "fast") {
227 X = SPIRVFPContractMode::Fast;
228 return true;
229 }
230 return false;
231 });
232 case OPT_spirv_lower_global_ctor_dtor_id:
233 return llvm::opt::parseArgValue(A.getValue(), lower_global_ctor_dtor_id, Alloc);
234 case OPT_spirv_preserve_auxdata:
235 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", preserve_auxdata, Alloc);
236 case OPT_spirv_translator_compatibility_mode:
237 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", translator_compatibility_mode, Alloc);
238 case OPT_spv_emit_nonsemantic_debug_info:
239 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", spv_emit_nonsemantic_debug_info, Alloc);
240 }
241 llvm_unreachable("option without a member");
242}
243#endif // OPTIONS_STRUCT_DEFS
244/////////
245// ValuesCode
246
247#ifdef OPTTABLE_VALUES_CODE
248static llvm::StringRef getOptionValuesCode(unsigned ID) {
249 switch (ID) {
250 }
251 return {};
252}
253#undef OPTTABLE_VALUES_CODE
254#endif // OPTTABLE_VALUES_CODE
255/////////
256// Groups
257
258#ifdef OPTION
259
260//////////
261// Options
262
263OPTION(0, 6 /* <input> */, INPUT, Input, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0, 0, 0, 0)
264OPTION(0, 14 /* <unknown> */, UNKNOWN, Unknown, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0, 0, 0, 0)
265OPTION(1, 24 /* -avoid-spirv-capabilities */, anonymous_12, Flag, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0, 0, 0, 0)
266OPTION(1, 50 /* -disable-spirv-remove-unused-resources */, anonymous_13, Flag, INVALID, INVALID, 89, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0, 0, 0, 0)
267OPTION(1, 96 /* -spirv-avoid-capabilities */, anonymous_5, SeparateOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 122, 0, 197, 206, 0)
268OPTION(1, 213 /* -spirv-debug-lexical-block-discriminator-scope */, anonymous_6, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 260, 0, 0, 0, 0)
269OPTION(1, 313 /* -spirv-debug-scope-forward-refs */, anonymous_7, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 345, 0, 0, 0, 0)
270OPTION(1, 429 /* -spirv-emit-init-fini-kernel */, anonymous_2, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 458, 0, 0, 0, 0)
271OPTION(1, 497 /* -spirv-emit-op-names */, anonymous_4, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 518, 0, 0, 0, 0)
272OPTION(1, 551 /* -spirv-enable-remove-unused-resources */, anonymous_8, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 589, 0, 0, 0, 0)
273OPTION(1, 631 /* -spirv-ext */, anonymous_9, SeparateOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 642, 0, 0, 0, 0)
274OPTION(1, 684 /* -spirv-fp-contract */, anonymous_0, SeparateOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 703, 0, 765, 779, 0)
275OPTION(1, 791 /* -spirv-lower-global-ctor-dtor-id */, anonymous_3, SeparateOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 824, 0, 0, 0, 0)
276OPTION(1, 864 /* -spirv-preserve-auxdata */, anonymous_1, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 888, 0, 0, 0, 0)
277OPTION(1, 1006 /* -spirv-translator-compatibility-mode */, anonymous_10, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1043, 0, 0, 0, 0)
278OPTION(1, 1080 /* -spv-emit-nonsemantic-debug-info */, anonymous_11, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1113, 0, 0, 0, 0)
279OPTION(1, 1189 /* -translator-compatibility-mode */, anonymous_14, Flag, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0, 0, 0, 0)
280#endif // OPTION
281
282#ifdef SIMPLE_ENUM_VALUE_TABLE
283
284struct SimpleEnumValue {
285 const char *Name;
286 unsigned Value;
287};
288
289struct SimpleEnumValueTable {
290 const SimpleEnumValue *Table;
291 unsigned Size;
292};
293static const SimpleEnumValueTable SimpleEnumValueTables[] = {};
294static const unsigned SimpleEnumValueTablesSize = std::size(SimpleEnumValueTables);
295#endif // SIMPLE_ENUM_VALUE_TABLE
296