1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* MipsPostLegalizerCombinerImpl Combiner Match Table *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* *|
7\*===----------------------------------------------------------------------===*/
8
9#ifdef GET_GICOMBINER_DEPS
10
11#include "llvm/ADT/SparseBitVector.h"
12namespace llvm {
13
14extern cl::OptionCategory GICombinerOptionCategory;
15
16} // namespace llvm
17
18#endif // GET_GICOMBINER_DEPS
19
20#ifdef GET_GICOMBINER_TYPES
21
22struct MipsPostLegalizerCombinerImplRuleConfig {
23 SparseBitVector<> DisabledRules;
24
25 bool isRuleEnabled(unsigned RuleID) const;
26 bool parseCommandLineOption();
27 bool setRuleEnabled(StringRef RuleIdentifier);
28 bool setRuleDisabled(StringRef RuleIdentifier);
29};
30
31static std::optional<uint64_t> getRuleIdxForIdentifier(StringRef RuleIdentifier) {
32 uint64_t I;
33 // getAtInteger(...) returns false on success
34 bool Parsed = !RuleIdentifier.getAsInteger(0, I);
35 if (Parsed)
36 return I;
37
38#ifndef NDEBUG
39#endif // ifndef NDEBUG
40
41 return std::nullopt;
42}
43static std::optional<std::pair<uint64_t, uint64_t>> getRuleRangeForIdentifier(StringRef RuleIdentifier) {
44 std::pair<StringRef, StringRef> RangePair = RuleIdentifier.split('-');
45 if (!RangePair.second.empty()) {
46 const auto First = getRuleIdxForIdentifier(RangePair.first);
47 const auto Last = getRuleIdxForIdentifier(RangePair.second);
48 if (!First || !Last)
49 return std::nullopt;
50 if (First >= Last)
51 report_fatal_error("Beginning of range should be before end of range");
52 return {{*First, *Last + 1}};
53 }
54 if (RangePair.first == "*") {
55 return {{0, 0}};
56 }
57 const auto I = getRuleIdxForIdentifier(RangePair.first);
58 if (!I)
59 return std::nullopt;
60 return {{*I, *I + 1}};
61}
62
63bool MipsPostLegalizerCombinerImplRuleConfig::setRuleEnabled(StringRef RuleIdentifier) {
64 auto MaybeRange = getRuleRangeForIdentifier(RuleIdentifier);
65 if (!MaybeRange)
66 return false;
67 for (auto I = MaybeRange->first; I < MaybeRange->second; ++I)
68 DisabledRules.reset(I);
69 return true;
70}
71
72bool MipsPostLegalizerCombinerImplRuleConfig::setRuleDisabled(StringRef RuleIdentifier) {
73 auto MaybeRange = getRuleRangeForIdentifier(RuleIdentifier);
74 if (!MaybeRange)
75 return false;
76 for (auto I = MaybeRange->first; I < MaybeRange->second; ++I)
77 DisabledRules.set(I);
78 return true;
79}
80
81static std::vector<std::string> MipsPostLegalizerCombinerOption;
82static cl::list<std::string> MipsPostLegalizerCombinerDisableOption(
83 "mipspostlegalizercombiner-disable-rule",
84 cl::desc("Disable one or more combiner rules temporarily in the MipsPostLegalizerCombiner pass"),
85 cl::CommaSeparated,
86 cl::Hidden,
87 cl::cat(GICombinerOptionCategory),
88 cl::callback([](const std::string &Str) {
89 MipsPostLegalizerCombinerOption.push_back(Str);
90 }));
91static cl::list<std::string> MipsPostLegalizerCombinerOnlyEnableOption(
92 "mipspostlegalizercombiner-only-enable-rule",
93 cl::desc("Disable all rules in the MipsPostLegalizerCombiner pass then re-enable the specified ones"),
94 cl::Hidden,
95 cl::cat(GICombinerOptionCategory),
96 cl::callback([](const std::string &CommaSeparatedArg) {
97 StringRef Str = CommaSeparatedArg;
98 MipsPostLegalizerCombinerOption.push_back("*");
99 do {
100 auto X = Str.split(",");
101 MipsPostLegalizerCombinerOption.push_back(("!" + X.first).str());
102 Str = X.second;
103 } while (!Str.empty());
104 }));
105
106
107bool MipsPostLegalizerCombinerImplRuleConfig::isRuleEnabled(unsigned RuleID) const {
108 return !DisabledRules.test(RuleID);
109}
110bool MipsPostLegalizerCombinerImplRuleConfig::parseCommandLineOption() {
111 for (StringRef Identifier : MipsPostLegalizerCombinerOption) {
112 bool Enabled = Identifier.consume_front("!");
113 if (Enabled && !setRuleEnabled(Identifier))
114 return false;
115 if (!Enabled && !setRuleDisabled(Identifier))
116 return false;
117 }
118 return true;
119}
120
121
122#endif // GET_GICOMBINER_TYPES
123
124#ifdef GET_GICOMBINER_TYPES
125
126const unsigned MAX_SUBTARGET_PREDICATES = 0;
127using PredicateBitset = llvm::Bitset<MAX_SUBTARGET_PREDICATES>;
128
129#endif // GET_GICOMBINER_TYPES
130
131#ifdef GET_GICOMBINER_CLASS_MEMBERS
132
133 bool canMatchOpcode(unsigned Opc) const override;
134
135#endif // GET_GICOMBINER_CLASS_MEMBERS
136
137#ifdef GET_GICOMBINER_CLASS_MEMBERS
138
139PredicateBitset AvailableModuleFeatures;
140mutable PredicateBitset AvailableFunctionFeatures;
141PredicateBitset getAvailableFeatures() const {
142 return AvailableModuleFeatures | AvailableFunctionFeatures;
143}
144PredicateBitset
145computeAvailableModuleFeatures(const MipsSubtarget *Subtarget) const;
146PredicateBitset
147computeAvailableFunctionFeatures(const MipsSubtarget *Subtarget,
148 const MachineFunction *MF) const;
149void setupGeneratedPerFunctionState(MachineFunction &MF) override;
150
151#endif // GET_GICOMBINER_CLASS_MEMBERS
152
153#ifdef GET_GICOMBINER_CLASS_MEMBERS
154
155 mutable MatcherState State;
156 typedef ComplexRendererFns(MipsPostLegalizerCombinerImpl::*ComplexMatcherMemFn)(MachineOperand &) const;
157 typedef void(MipsPostLegalizerCombinerImpl::*CustomRendererFn)(MachineInstrBuilder &, const MachineInstr &, int) const;
158 const ExecInfoTy<PredicateBitset, ComplexMatcherMemFn, CustomRendererFn> ExecInfo;
159 static MipsPostLegalizerCombinerImpl::ComplexMatcherMemFn ComplexPredicateFns[];
160 static MipsPostLegalizerCombinerImpl::CustomRendererFn CustomRenderers[];
161 bool testImmPredicate_I64(unsigned PredicateID, int64_t Imm) const override;
162 bool testImmPredicate_APInt(unsigned PredicateID, const APInt &Imm) const override;
163 bool testImmPredicate_APFloat(unsigned PredicateID, const APFloat &Imm) const override;
164 const uint8_t *getMatchTable() const override;
165 bool testMIPredicate_MI(unsigned PredicateID, const MachineInstr &MI, const MatcherState &State) const override;
166 bool testMOPredicate_MO(unsigned PredicateID, const MachineOperand &MO, const MatcherState &State) const override;
167 bool testSimplePredicate(unsigned PredicateID) const override;
168 bool runCustomAction(unsigned FnID, const MatcherState &State, NewMIVector &OutMIs) const override;
169
170#endif // GET_GICOMBINER_CLASS_MEMBERS
171
172#ifdef GET_GICOMBINER_IMPL
173
174// LLT Objects.
175enum {
176 GILLT_s1,
177};
178const static size_t NumTypeObjects = 1;
179const static LLT TypeObjects[] = {
180 LLT::scalar(1),
181};
182
183// Bits for subtarget features that participate in instruction matching.
184enum SubtargetFeatureBits : uint8_t {
185};
186
187PredicateBitset MipsPostLegalizerCombinerImpl::
188computeAvailableModuleFeatures(const MipsSubtarget *Subtarget) const {
189 PredicateBitset Features{};
190 return Features;
191}
192
193void MipsPostLegalizerCombinerImpl::setupGeneratedPerFunctionState(MachineFunction &MF) {
194 AvailableFunctionFeatures = computeAvailableFunctionFeatures((const MipsSubtarget *)&MF.getSubtarget(), &MF);
195}
196PredicateBitset MipsPostLegalizerCombinerImpl::
197computeAvailableFunctionFeatures(const MipsSubtarget *Subtarget, const MachineFunction *MF) const {
198 PredicateBitset Features{};
199 return Features;
200}
201
202// Feature bitsets.
203enum {
204 GIFBS_Invalid,
205};
206constexpr static PredicateBitset FeatureBitsets[] {
207 {}, // GIFBS_Invalid
208};
209
210// ComplexPattern predicates.
211enum {
212 GICP_Invalid,
213};
214// See constructor for table contents
215
216MipsPostLegalizerCombinerImpl::ComplexMatcherMemFn
217MipsPostLegalizerCombinerImpl::ComplexPredicateFns[] = {
218 nullptr, // GICP_Invalid
219};
220
221bool MipsPostLegalizerCombinerImpl::testMIPredicate_MI(unsigned PredicateID, const MachineInstr & MI, const MatcherState &State) const {
222 llvm_unreachable("Unknown predicate");
223 return false;
224}
225bool MipsPostLegalizerCombinerImpl::testMOPredicate_MO(unsigned PredicateID, const MachineOperand & MO, const MatcherState &State) const {
226 llvm_unreachable("Unknown predicate");
227 return false;
228}
229bool MipsPostLegalizerCombinerImpl::testImmPredicate_I64(unsigned PredicateID, int64_t Imm) const {
230 llvm_unreachable("Unknown predicate");
231 return false;
232}
233bool MipsPostLegalizerCombinerImpl::testImmPredicate_APFloat(unsigned PredicateID, const APFloat & Imm) const {
234 llvm_unreachable("Unknown predicate");
235 return false;
236}
237bool MipsPostLegalizerCombinerImpl::testImmPredicate_APInt(unsigned PredicateID, const APInt & Imm) const {
238 llvm_unreachable("Unknown predicate");
239 return false;
240}
241bool MipsPostLegalizerCombinerImpl::testSimplePredicate(unsigned Predicate) const {
242 return RuleConfig.isRuleEnabled(Predicate - GICXXPred_Invalid - 1);
243}
244// Custom renderers.
245enum {
246 GICR_Invalid,
247};
248MipsPostLegalizerCombinerImpl::CustomRendererFn
249MipsPostLegalizerCombinerImpl::CustomRenderers[] = {
250 nullptr, // GICR_Invalid
251};
252
253bool MipsPostLegalizerCombinerImpl::canMatchOpcode(unsigned Opc) const {
254 (void)Opc;
255 return false;
256}
257
258bool MipsPostLegalizerCombinerImpl::tryCombineAll(MachineInstr &I) const {
259 const PredicateBitset AvailableFeatures = getAvailableFeatures();
260 State.MIs.clear();
261 State.MIs.push_back(&I);
262 if (executeMatchTable(*this, State, ExecInfo, B, getMatchTable(), Helper.getTII(), MRI, Helper.getTRI(), Helper.getRBI(), AvailableFeatures, /*CoverageInfo*/ nullptr)) {
263 return true;
264 }
265
266 return false;
267}
268
269bool MipsPostLegalizerCombinerImpl::runCustomAction(unsigned ApplyID, const MatcherState &State, NewMIVector &OutMIs) const {
270 Helper.getBuilder().setInstrAndDebugLoc(*State.MIs[0]);
271 llvm_unreachable("Unknown Apply Action");
272}
273#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
274#define GIMT_Encode2(Val) uint8_t(Val), uint8_t((Val) >> 8)
275#define GIMT_Encode4(Val) uint8_t(Val), uint8_t((Val) >> 8), uint8_t((Val) >> 16), uint8_t((Val) >> 24)
276#define GIMT_Encode8(Val) uint8_t(Val), uint8_t((Val) >> 8), uint8_t((Val) >> 16), uint8_t((Val) >> 24), uint8_t(uint64_t(Val) >> 32), uint8_t(uint64_t(Val) >> 40), uint8_t(uint64_t(Val) >> 48), uint8_t(uint64_t(Val) >> 56)
277#else
278#define GIMT_Encode2(Val) uint8_t((Val) >> 8), uint8_t(Val)
279#define GIMT_Encode4(Val) uint8_t((Val) >> 24), uint8_t((Val) >> 16), uint8_t((Val) >> 8), uint8_t(Val)
280#define GIMT_Encode8(Val) uint8_t(uint64_t(Val) >> 56), uint8_t(uint64_t(Val) >> 48), uint8_t(uint64_t(Val) >> 40), uint8_t(uint64_t(Val) >> 32), uint8_t((Val) >> 24), uint8_t((Val) >> 16), uint8_t((Val) >> 8), uint8_t(Val)
281#endif
282const uint8_t *MipsPostLegalizerCombinerImpl::getMatchTable() const {
283 constexpr static uint8_t MatchTable0[] = {
284 /* 0 */ GIM_Reject,
285 /* 1 */ }; // Size: 1 bytes
286 return MatchTable0;
287}
288#undef GIMT_Encode2
289#undef GIMT_Encode4
290#undef GIMT_Encode8
291
292
293#endif // GET_GICOMBINER_IMPL
294
295#ifdef GET_GICOMBINER_CONSTRUCTOR_INITS
296
297AvailableModuleFeatures(computeAvailableModuleFeatures(&STI)),
298AvailableFunctionFeatures()
299
300#endif // GET_GICOMBINER_CONSTRUCTOR_INITS
301
302#ifdef GET_GICOMBINER_CONSTRUCTOR_INITS
303
304, State(0),
305ExecInfo(TypeObjects, NumTypeObjects, FeatureBitsets, ComplexPredicateFns, CustomRenderers)
306
307#endif // GET_GICOMBINER_CONSTRUCTOR_INITS
308
309