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_disable_nvptx_ir_peephole,
19 OPT_disable_nvptx_load_store_vectorizer,
20 OPT_disable_nvptx_require_structured_cfg,
21 OPT_line_info_inlined_at,
22 OPT_nvptx_allow_ftz_atomics,
23 OPT_nvptx_approx_log2f32,
24 OPT_nvptx_early_byval_copy,
25 OPT_nvptx_emit_init_fini_kernel,
26 OPT_nvptx_fma_level,
27 OPT_nvptx_force_min_byval_param_align,
28 OPT_nvptx_lower_global_ctor_dtor_id,
29 OPT_nvptx_mad_wide_opt,
30 OPT_nvptx_no_f16_math,
31 OPT_nvptx_no_f32x2,
32 OPT_nvptx_prec_divf32,
33 OPT_nvptx_prec_sqrtf32,
34 OPT_nvptx_rsqrt_approx_opt,
35 OPT_nvptx_sched4reg,
36 OPT_nvptx_traverse_address_aliasing_limit,
37 OPT_nvvm_reflect_add,
38 OPT_nvvm_reflect_enable,
39};
40} // namespace
41
42static llvm::opt::OptTable::Tables optionTables() {
43 using llvm::opt::DefaultVis, llvm::opt::HelpHidden,
44 llvm::opt::RenderAsInput, llvm::opt::RenderJoined,
45 llvm::opt::RenderSeparate;
46
47#ifdef __GNUC__
48#pragma GCC diagnostic push
49#pragma GCC diagnostic ignored "-Woverlength-strings"
50#endif
51static constexpr char OptionStrTableStorage[] =
52 "\0"
53 "-\0"
54 "--\0"
55 "<input>\0"
56 "<unknown>\0"
57 "-disable-nvptx-ir-peephole\0"
58 "Disable NVPTX IR Peephole\0"
59 "-disable-nvptx-load-store-vectorizer\0"
60 "Disable load/store vectorizer\0"
61 "-disable-nvptx-require-structured-cfg\0"
62 "Transitional flag to turn off NVPTX's requirement on preserving structured CFG. The requirement should be disabled only when unexpected regressions happen.\0"
63 "-line-info-inlined-at\0"
64 "Emit line with inlined_at enhancement for NVPTX\0"
65 "-nvptx-allow-ftz-atomics\0"
66 "NVPTX Specific: Lower atomicrmw fadd to atom.add even when its FTZ behavior does not match the function's denormal mode.\0"
67 "-nvptx-approx-log2f32\0"
68 "NVPTX Specific: whether to use lg2.approx for log2\0"
69 "-nvptx-early-byval-copy\0"
70 "Create a copy of byval function arguments early.\0"
71 "-nvptx-emit-init-fini-kernel\0"
72 "Emit kernels to call ctor/dtor globals.\0"
73 "-nvptx-fma-level\0"
74 "NVPTX Specific: FMA contraction (0: don't do it, 1: do it, 2: do it aggressively)\0"
75 "-nvptx-force-min-byval-param-align\0"
76 "NVPTX Specific: force 4-byte minimal alignment for byval params of device functions.\0"
77 "-nvptx-lower-global-ctor-dtor-id\0"
78 "Override unique ID of ctor/dtor globals.\0"
79 "-nvptx-mad-wide-opt\0"
80 "Enable MAD wide optimization\0"
81 "-nvptx-no-f16-math\0"
82 "NVPTX Specific: Disable generation of f16 math ops.\0"
83 "-nvptx-no-f32x2\0"
84 "NVPTX Specific: Disable generation of f32x2 instructions and registers.\0"
85 "-nvptx-prec-divf32\0"
86 "NVPTX Specific: Override the precision of the lowering for f32 fdiv\0"
87 "<0|1|2|3>\0"
88 "0,1,2,3\0"
89 "-nvptx-prec-sqrtf32\0"
90 "NVPTX Specific: 0 use sqrt.approx, 1 use sqrt.rn.\0"
91 "-nvptx-rsqrt-approx-opt\0"
92 "Enable reciprocal sqrt optimization\0"
93 "-nvptx-sched4reg\0"
94 "NVPTX Specific: schedule for register pressure\0"
95 "-nvptx-traverse-address-aliasing-limit\0"
96 "Depth limit for finding address space through traversal\0"
97 "-nvvm-reflect-add\0"
98 "A key=value pair. Replace __nvvm_reflect(name) with value.\0"
99 "name=<int>\0"
100 "-nvvm-reflect-enable\0"
101 "NVVM reflection, enabled by default\0"
102 ;
103#ifdef __GNUC__
104#pragma GCC diagnostic pop
105#endif
106
107static constexpr llvm::StringTable
108OptionStrTable = OptionStrTableStorage;
109
110 static constexpr llvm::StringTable::Offset OptionPrefixesTable[] = {
111 0 /* prefixes */,
112 2 /* prefixes */, 1 /* '-' */, 3 /* '--' */
113 };
114
115 static constexpr llvm::opt::OptTable::HelpTextVariant OptionHelpTextVariantsTable[] = {
116 {0, 0},
117 };
118
119 static constexpr unsigned OptionSubCommandIDsTable[] = {
120 0 /* subcommands */
121 };
122
123 static constexpr llvm::opt::OptTable::InfoExtra OptionInfoExtrasTable[] = {
124 {0, 0, 0, 0, 0, 0, 0, 0},
125 {0, 0, 0, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0},
126 {1357, 0, 1367, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0},
127 {1741, 0, 0, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0},
128 };
129
130 static constexpr llvm::opt::OptTable::Info OptionInfoTable[] = {
131 {6 /* <input> */, 0, 0, 0, 1, 0, llvm::opt::Option::InputClass},
132 {14 /* <unknown> */, 0, 0, 0, 1, 0, llvm::opt::Option::UnknownClass},
133 {24 /* -disable-nvptx-ir-peephole */, 51, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
134 {77 /* -disable-nvptx-load-store-vectorizer */, 114, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
135 {144 /* -disable-nvptx-require-structured-cfg */, 182, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
136 {338 /* -line-info-inlined-at */, 360, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
137 {408 /* -nvptx-allow-ftz-atomics */, 433, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
138 {554 /* -nvptx-approx-log2f32 */, 576, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
139 {627 /* -nvptx-early-byval-copy */, 651, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
140 {700 /* -nvptx-emit-init-fini-kernel */, 729, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
141 {769 /* -nvptx-fma-level */, 786, 0, 0, 1, 1, llvm::opt::Option::SeparateOrEqClass},
142 {868 /* -nvptx-force-min-byval-param-align */, 903, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
143 {988 /* -nvptx-lower-global-ctor-dtor-id */, 1021, 0, 0, 1, 1, llvm::opt::Option::SeparateOrEqClass},
144 {1062 /* -nvptx-mad-wide-opt */, 1082, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
145 {1111 /* -nvptx-no-f16-math */, 1130, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
146 {1182 /* -nvptx-no-f32x2 */, 1198, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
147 {1270 /* -nvptx-prec-divf32 */, 1289, 0, 0, 2, 1, llvm::opt::Option::SeparateOrEqClass},
148 {1375 /* -nvptx-prec-sqrtf32 */, 1395, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
149 {1445 /* -nvptx-rsqrt-approx-opt */, 1469, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
150 {1505 /* -nvptx-sched4reg */, 1522, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
151 {1569 /* -nvptx-traverse-address-aliasing-limit */, 1608, 0, 0, 1, 1, llvm::opt::Option::SeparateOrEqClass},
152 {1664 /* -nvvm-reflect-add */, 1682, 0, 0, 3, 1, llvm::opt::Option::SeparateOrEqClass},
153 {1752 /* -nvvm-reflect-enable */, 1773, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
154 };
155
156 return {OptionStrTable, OptionPrefixesTable,
157 OptionInfoTable, OptionInfoExtrasTable, OptionHelpTextVariantsTable, {}, OptionSubCommandIDsTable};
158}
159#undef OPTTABLE_CODE
160#endif // OPTTABLE_CODE || OPTIONS_STRUCT_DEFS
161
162
163#ifdef OPTIONS_STRUCT_DECL
164#undef OPTIONS_STRUCT_DECL
165#include "llvm/ADT/ArrayRef.h"
166#include "llvm/ADT/BoolOrDefault.h"
167#include "llvm/ADT/StringRef.h"
168#include "llvm/Support/Allocator.h"
169#include "llvm/Support/LibraryOptionsContext.h"
170
171namespace llvm {
172namespace opt {
173class Arg;
174class LibraryOptionsParser;
175class OptTable;
176} // namespace opt
177} // namespace llvm
178
179namespace llvm {
180struct NVPTXOptions {
181 unsigned traverse_address_aliasing_limit{6};
182 bool early_byval_copy{false};
183 bool emit_init_fini_kernel{true};
184 StringRef lower_global_ctor_dtor_id{};
185 bool line_info_inlined_at{true};
186 bool mad_wide_opt{false};
187 bool rsqrt_approx_opt{true};
188 bool allow_ftz_atomics{false};
189 bool approx_log2f32{false};
190 std::optional<unsigned> fma_level{};
191 std::optional<NVPTX::DivPrecisionLevel> prec_divf32{};
192 llvm::BoolOrDefault prec_sqrtf32{llvm::BoolOrDefault::Default};
193 bool sched4reg{false};
194 bool no_f16_math{false};
195 bool no_f32x2{false};
196 bool disable_nvptx_ir_peephole{false};
197 bool disable_nvptx_load_store_vectorizer{false};
198 bool disable_nvptx_require_structured_cfg{false};
199 bool force_min_byval_param_align{false};
200 llvm::ArrayRef<StringRef> nvvm_reflect_add{};
201 bool nvvm_reflect_enable{true};
202
203 static const llvm::opt::OptTable &optTable();
204 /// Sets the member that \p A names, allocating a list from \p Alloc.
205 /// Returns false if the value is invalid.
206 bool apply(const llvm::opt::Arg &A, llvm::BumpPtrAllocator &Alloc);
207
208private:
209 friend class llvm::cl::LibraryOptionsContext;
210 friend class llvm::opt::LibraryOptionsParser;
211
212 static const NVPTXOptions Default;
213};
214} // namespace llvm
215#endif // OPTIONS_STRUCT_DECL
216
217#ifdef OPTIONS_STRUCT_DEFS
218#undef OPTIONS_STRUCT_DEFS
219LLVM_REQUIRE_CONSTANT_INITIALIZATION const llvm::NVPTXOptions llvm::NVPTXOptions::Default;
220
221const llvm::opt::OptTable &llvm::NVPTXOptions::optTable() {
222 static const llvm::opt::LibraryOptTable T(optionTables());
223 return T;
224}
225
226bool llvm::NVPTXOptions::apply(const llvm::opt::Arg &A, llvm::BumpPtrAllocator &Alloc) {
227 switch (A.getOption().getID()) {
228 case OPT_disable_nvptx_ir_peephole:
229 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", disable_nvptx_ir_peephole, Alloc);
230 case OPT_disable_nvptx_load_store_vectorizer:
231 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", disable_nvptx_load_store_vectorizer, Alloc);
232 case OPT_disable_nvptx_require_structured_cfg:
233 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", disable_nvptx_require_structured_cfg, Alloc);
234 case OPT_line_info_inlined_at:
235 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", line_info_inlined_at, Alloc);
236 case OPT_nvptx_allow_ftz_atomics:
237 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", allow_ftz_atomics, Alloc);
238 case OPT_nvptx_approx_log2f32:
239 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", approx_log2f32, Alloc);
240 case OPT_nvptx_early_byval_copy:
241 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", early_byval_copy, Alloc);
242 case OPT_nvptx_emit_init_fini_kernel:
243 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", emit_init_fini_kernel, Alloc);
244 case OPT_nvptx_fma_level:
245 return llvm::opt::parseArgValue(A.getValue(), fma_level, Alloc);
246 case OPT_nvptx_force_min_byval_param_align:
247 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", force_min_byval_param_align, Alloc);
248 case OPT_nvptx_lower_global_ctor_dtor_id:
249 return llvm::opt::parseArgValue(A.getValue(), lower_global_ctor_dtor_id, Alloc);
250 case OPT_nvptx_mad_wide_opt:
251 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", mad_wide_opt, Alloc);
252 case OPT_nvptx_no_f16_math:
253 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", no_f16_math, Alloc);
254 case OPT_nvptx_no_f32x2:
255 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", no_f32x2, Alloc);
256 case OPT_nvptx_prec_divf32:
257 return llvm::opt::parseArgValue(A.getValue(), prec_divf32, Alloc, [](llvm::StringRef V, auto &X) {
258 if (V == "0") {
259 X = NVPTX::DivPrecisionLevel::Approx;
260 return true;
261 }
262 if (V == "1") {
263 X = NVPTX::DivPrecisionLevel::Full;
264 return true;
265 }
266 if (V == "2") {
267 X = NVPTX::DivPrecisionLevel::IEEE754;
268 return true;
269 }
270 if (V == "3") {
271 X = NVPTX::DivPrecisionLevel::IEEE754_NoFTZ;
272 return true;
273 }
274 return false;
275 });
276 case OPT_nvptx_prec_sqrtf32:
277 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", prec_sqrtf32, Alloc);
278 case OPT_nvptx_rsqrt_approx_opt:
279 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", rsqrt_approx_opt, Alloc);
280 case OPT_nvptx_sched4reg:
281 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", sched4reg, Alloc);
282 case OPT_nvptx_traverse_address_aliasing_limit:
283 return llvm::opt::parseArgValue(A.getValue(), traverse_address_aliasing_limit, Alloc);
284 case OPT_nvvm_reflect_add:
285 return llvm::opt::parseArgValue(A.getValue(), nvvm_reflect_add, Alloc);
286 case OPT_nvvm_reflect_enable:
287 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", nvvm_reflect_enable, Alloc);
288 }
289 llvm_unreachable("option without a member");
290}
291#endif // OPTIONS_STRUCT_DEFS
292/////////
293// ValuesCode
294
295#ifdef OPTTABLE_VALUES_CODE
296static llvm::StringRef getOptionValuesCode(unsigned ID) {
297 switch (ID) {
298 }
299 return {};
300}
301#undef OPTTABLE_VALUES_CODE
302#endif // OPTTABLE_VALUES_CODE
303/////////
304// Groups
305
306#ifdef OPTION
307
308//////////
309// Options
310
311OPTION(0, 6 /* <input> */, INPUT, Input, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0, 0, 0, 0)
312OPTION(0, 14 /* <unknown> */, UNKNOWN, Unknown, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0, 0, 0, 0)
313OPTION(1, 24 /* -disable-nvptx-ir-peephole */, anonymous_15, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 51, 0, 0, 0, 0)
314OPTION(1, 77 /* -disable-nvptx-load-store-vectorizer */, anonymous_16, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 114, 0, 0, 0, 0)
315OPTION(1, 144 /* -disable-nvptx-require-structured-cfg */, anonymous_17, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 182, 0, 0, 0, 0)
316OPTION(1, 338 /* -line-info-inlined-at */, anonymous_4, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 360, 0, 0, 0, 0)
317OPTION(1, 408 /* -nvptx-allow-ftz-atomics */, anonymous_7, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 433, 0, 0, 0, 0)
318OPTION(1, 554 /* -nvptx-approx-log2f32 */, anonymous_8, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 576, 0, 0, 0, 0)
319OPTION(1, 627 /* -nvptx-early-byval-copy */, anonymous_1, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 651, 0, 0, 0, 0)
320OPTION(1, 700 /* -nvptx-emit-init-fini-kernel */, anonymous_2, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 729, 0, 0, 0, 0)
321OPTION(1, 769 /* -nvptx-fma-level */, anonymous_9, SeparateOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 786, 0, 0, 0, 0)
322OPTION(1, 868 /* -nvptx-force-min-byval-param-align */, anonymous_18, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 903, 0, 0, 0, 0)
323OPTION(1, 988 /* -nvptx-lower-global-ctor-dtor-id */, anonymous_3, SeparateOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1021, 0, 0, 0, 0)
324OPTION(1, 1062 /* -nvptx-mad-wide-opt */, anonymous_5, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1082, 0, 0, 0, 0)
325OPTION(1, 1111 /* -nvptx-no-f16-math */, anonymous_13, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1130, 0, 0, 0, 0)
326OPTION(1, 1182 /* -nvptx-no-f32x2 */, anonymous_14, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1198, 0, 0, 0, 0)
327OPTION(1, 1270 /* -nvptx-prec-divf32 */, anonymous_10, SeparateOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1289, 0, 1357, 1367, 0)
328OPTION(1, 1375 /* -nvptx-prec-sqrtf32 */, anonymous_11, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1395, 0, 0, 0, 0)
329OPTION(1, 1445 /* -nvptx-rsqrt-approx-opt */, anonymous_6, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1469, 0, 0, 0, 0)
330OPTION(1, 1505 /* -nvptx-sched4reg */, anonymous_12, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1522, 0, 0, 0, 0)
331OPTION(1, 1569 /* -nvptx-traverse-address-aliasing-limit */, anonymous_0, SeparateOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1608, 0, 0, 0, 0)
332OPTION(1, 1664 /* -nvvm-reflect-add */, anonymous_19, SeparateOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1682, 0, 1741, 0, 0)
333OPTION(1, 1752 /* -nvvm-reflect-enable */, anonymous_20, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1773, 0, 0, 0, 0)
334#endif // OPTION
335
336#ifdef SIMPLE_ENUM_VALUE_TABLE
337
338struct SimpleEnumValue {
339 const char *Name;
340 unsigned Value;
341};
342
343struct SimpleEnumValueTable {
344 const SimpleEnumValue *Table;
345 unsigned Size;
346};
347static const SimpleEnumValueTable SimpleEnumValueTables[] = {};
348static const unsigned SimpleEnumValueTablesSize = std::size(SimpleEnumValueTables);
349#endif // SIMPLE_ENUM_VALUE_TABLE
350