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)
13static llvm::opt::OptTable::Tables optionTables() {
14 using llvm::opt::DefaultVis, llvm::opt::HelpHidden,
15 llvm::opt::RenderAsInput, llvm::opt::RenderJoined,
16 llvm::opt::RenderSeparate;
17
18#ifdef __GNUC__
19#pragma GCC diagnostic push
20#pragma GCC diagnostic ignored "-Woverlength-strings"
21#endif
22static constexpr char OptionStrTableStorage[] =
23 "\0"
24 "-\0"
25 "--\0"
26 "<input>\0"
27 "<unknown>\0"
28 "-mark-data-regions\0"
29 "Mark code section jump table data regions\0"
30 "-x86-align-branch-boundary\0"
31 "Control how the assembler should align branches with NOP. If the boundary's size is not 0, it should be a power of 2 and no less than 32. Branches will be aligned to prevent from being across or against the boundary of specified size. The default value 0 does not align branches\0"
32 "-x86-align-branch\0"
33 "Specify types of branches to align (plus separated list of types):\njcc indicates conditional jumps\nfused indicates fused conditional jumps\njmp indicates direct unconditional jumps\ncall indicates direct and indirect calls\nret indicates rets\nindirect indicates indirect unconditional jumps\0"
34 "-x86-asm-syntax\0"
35 "Select the assembly style for input\0"
36 "<att|intel>\0"
37 "att,intel\0"
38 "-x86-branches-within-32B-boundaries\0"
39 "Align selected instructions to mitigate negative performance impact of Intel's micro code update for errata skx102. May break assumptions about labels corresponding to particular instructions, and should be used with caution\0"
40 "-x86-experimental-lvi-inline-asm-hardening\0"
41 "Harden inline assembly code that may be vulnerable to Load Value Injection (LVI). This feature is experimental\0"
42 "-x86-pad-for-align\0"
43 "Pad previous instructions to implement align directives\0"
44 "-x86-pad-for-branch-align\0"
45 "Pad previous instructions to implement branch alignment\0"
46 "-x86-pad-max-prefix-size\0"
47 "Maximum number of prefixes to use for padding\0"
48 ;
49#ifdef __GNUC__
50#pragma GCC diagnostic pop
51#endif
52
53static constexpr llvm::StringTable
54OptionStrTable = OptionStrTableStorage;
55
56 static constexpr llvm::StringTable::Offset OptionPrefixesTable[] = {
57 0 /* prefixes */,
58 2 /* prefixes */, 1 /* '-' */, 3 /* '--' */
59 };
60
61 static constexpr llvm::opt::OptTable::HelpTextVariant OptionHelpTextVariantsTable[] = {
62 {0, 0},
63 };
64
65 static constexpr unsigned OptionSubCommandIDsTable[] = {
66 0 /* subcommands */
67 };
68
69 static constexpr llvm::opt::OptTable::InfoExtra OptionInfoExtrasTable[] = {
70 {0, 0, 0, 0, 0, 0, 0, 0},
71 {0, 0, 0, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0},
72 {771, 0, 783, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0},
73 };
74
75 static constexpr llvm::opt::OptTable::Info OptionInfoTable[] = {
76 {6 /* <input> */, 0, 0, 0, 1, 0, llvm::opt::Option::InputClass},
77 {14 /* <unknown> */, 0, 0, 0, 1, 0, llvm::opt::Option::UnknownClass},
78 {24 /* -mark-data-regions */, 43, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
79 {85 /* -x86-align-branch-boundary */, 112, 0, 0, 1, 1, llvm::opt::Option::SeparateOrEqClass},
80 {391 /* -x86-align-branch */, 409, 0, 0, 1, 1, llvm::opt::Option::SeparateOrEqClass},
81 {719 /* -x86-asm-syntax */, 735, 0, 0, 2, 1, llvm::opt::Option::SeparateOrEqClass},
82 {793 /* -x86-branches-within-32B-boundaries */, 829, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
83 {1054 /* -x86-experimental-lvi-inline-asm-hardening */, 1097, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
84 {1208 /* -x86-pad-for-align */, 1227, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
85 {1283 /* -x86-pad-for-branch-align */, 1309, 0, 0, 1, 1, llvm::opt::Option::FlagOrEqClass},
86 {1365 /* -x86-pad-max-prefix-size */, 1390, 0, 0, 1, 1, llvm::opt::Option::SeparateOrEqClass},
87 };
88
89 return {OptionStrTable, OptionPrefixesTable,
90 OptionInfoTable, OptionInfoExtrasTable, OptionHelpTextVariantsTable, {}, OptionSubCommandIDsTable};
91}
92#undef OPTTABLE_CODE
93#endif // OPTTABLE_CODE || OPTIONS_STRUCT_DEFS
94
95
96#ifdef OPTIONS_STRUCT_DECL
97#undef OPTIONS_STRUCT_DECL
98#include "llvm/ADT/ArrayRef.h"
99#include "llvm/ADT/BoolOrDefault.h"
100#include "llvm/ADT/StringRef.h"
101#include "llvm/Support/Allocator.h"
102
103namespace llvm {
104namespace opt {
105class Arg;
106class OptTable;
107} // namespace opt
108} // namespace llvm
109
110namespace llvm {
111struct X86MCOptions {
112 bool experimental_lvi_inline_asm_hardening{false};
113 std::optional<StringRef> align_branch{std::nullopt};
114 std::optional<unsigned> align_branch_boundary{std::nullopt};
115 bool branches_within_32B_boundaries{false};
116 bool pad_for_align{false};
117 bool pad_for_branch_align{true};
118 std::optional<unsigned> pad_max_prefix_size{std::nullopt};
119 X86::AsmWriterFlavorTy asm_syntax{X86::ATT};
120 bool mark_data_regions{true};
121
122 /// The instance cl::ParseCommandLineOptions sets.
123 static X86MCOptions Global;
124
125 static const llvm::opt::OptTable &optTable();
126 /// Sets the member that \p A names, allocating a list from \p Alloc.
127 /// Returns false if the value is invalid.
128 bool apply(const llvm::opt::Arg &A, llvm::BumpPtrAllocator &Alloc);
129};
130} // namespace llvm
131#endif // OPTIONS_STRUCT_DECL
132
133#ifdef OPTIONS_STRUCT_DEFS
134#undef OPTIONS_STRUCT_DEFS
135llvm::X86MCOptions llvm::X86MCOptions::Global;
136
137namespace {
138enum ID : unsigned {
139 OPT_INVALID = 0,
140 OPT_INPUT,
141 OPT_UNKNOWN,
142 OPT_mark_data_regions,
143 OPT_x86_align_branch_boundary,
144 OPT_x86_align_branch,
145 OPT_x86_asm_syntax,
146 OPT_x86_branches_within_32B_boundaries,
147 OPT_x86_experimental_lvi_inline_asm_hardening,
148 OPT_x86_pad_for_align,
149 OPT_x86_pad_for_branch_align,
150 OPT_x86_pad_max_prefix_size,
151};
152} // namespace
153
154const llvm::opt::OptTable &llvm::X86MCOptions::optTable() {
155 static const llvm::opt::LibraryOptTable T(optionTables());
156 return T;
157}
158
159bool llvm::X86MCOptions::apply(const llvm::opt::Arg &A, llvm::BumpPtrAllocator &Alloc) {
160 switch (A.getOption().getID()) {
161 case OPT_mark_data_regions:
162 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", mark_data_regions, Alloc);
163 case OPT_x86_align_branch_boundary:
164 return llvm::opt::parseArgValue(A.getValue(), align_branch_boundary, Alloc);
165 case OPT_x86_align_branch:
166 return llvm::opt::parseArgValue(A.getValue(), align_branch, Alloc);
167 case OPT_x86_asm_syntax:
168 return llvm::opt::parseArgValue(A.getValue(), asm_syntax, Alloc, [](llvm::StringRef V, auto &X) {
169 if (V == "att") {
170 X = X86::ATT;
171 return true;
172 }
173 if (V == "intel") {
174 X = X86::Intel;
175 return true;
176 }
177 return false;
178 });
179 case OPT_x86_branches_within_32B_boundaries:
180 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", branches_within_32B_boundaries, Alloc);
181 case OPT_x86_experimental_lvi_inline_asm_hardening:
182 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", experimental_lvi_inline_asm_hardening, Alloc);
183 case OPT_x86_pad_for_align:
184 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", pad_for_align, Alloc);
185 case OPT_x86_pad_for_branch_align:
186 return llvm::opt::parseArgValue(A.getNumValues() ? A.getValue() : "true", pad_for_branch_align, Alloc);
187 case OPT_x86_pad_max_prefix_size:
188 return llvm::opt::parseArgValue(A.getValue(), pad_max_prefix_size, Alloc);
189 }
190 llvm_unreachable("option without a member");
191}
192#endif // OPTIONS_STRUCT_DEFS
193/////////
194// ValuesCode
195
196#ifdef OPTTABLE_VALUES_CODE
197static llvm::StringRef getOptionValuesCode(unsigned ID) {
198 switch (ID) {
199 }
200 return {};
201}
202#undef OPTTABLE_VALUES_CODE
203#endif // OPTTABLE_VALUES_CODE
204/////////
205// Groups
206
207#ifdef OPTION
208
209//////////
210// Options
211
212OPTION(0, 6 /* <input> */, INPUT, Input, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0, 0, 0, 0)
213OPTION(0, 14 /* <unknown> */, UNKNOWN, Unknown, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 0, 0, 0, 0, 0)
214OPTION(1, 24 /* -mark-data-regions */, anonymous_8, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 43, 0, 0, 0, 0)
215OPTION(1, 85 /* -x86-align-branch-boundary */, anonymous_2, SeparateOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 112, 0, 0, 0, 0)
216OPTION(1, 391 /* -x86-align-branch */, anonymous_1, SeparateOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 409, 0, 0, 0, 0)
217OPTION(1, 719 /* -x86-asm-syntax */, anonymous_7, SeparateOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 735, 0, 771, 783, 0)
218OPTION(1, 793 /* -x86-branches-within-32B-boundaries */, anonymous_3, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 829, 0, 0, 0, 0)
219OPTION(1, 1054 /* -x86-experimental-lvi-inline-asm-hardening */, anonymous_0, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1097, 0, 0, 0, 0)
220OPTION(1, 1208 /* -x86-pad-for-align */, anonymous_4, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1227, 0, 0, 0, 0)
221OPTION(1, 1283 /* -x86-pad-for-branch-align */, anonymous_5, FlagOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1309, 0, 0, 0, 0)
222OPTION(1, 1365 /* -x86-pad-max-prefix-size */, anonymous_6, SeparateOrEq, INVALID, INVALID, 0, 0, static_cast<unsigned>(DefaultVis), 0, 1390, 0, 0, 0, 0)
223#endif // OPTION
224
225#ifdef SIMPLE_ENUM_VALUE_TABLE
226
227struct SimpleEnumValue {
228 const char *Name;
229 unsigned Value;
230};
231
232struct SimpleEnumValueTable {
233 const SimpleEnumValue *Table;
234 unsigned Size;
235};
236static const SimpleEnumValueTable SimpleEnumValueTables[] = {};
237static const unsigned SimpleEnumValueTablesSize = std::size(SimpleEnumValueTables);
238#endif // SIMPLE_ENUM_VALUE_TABLE
239