1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* RISCVO0PreLegalizerCombinerImpl Combiner Match Table *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* *|
7\*===----------------------------------------------------------------------===*/
8
9#ifdef GET_GICOMBINER_DEPS
10#include "llvm/ADT/SparseBitVector.h"
11namespace llvm {
12extern cl::OptionCategory GICombinerOptionCategory;
13} // end namespace llvm
14#endif // ifdef GET_GICOMBINER_DEPS
15
16#ifdef GET_GICOMBINER_TYPES
17struct RISCVO0PreLegalizerCombinerImplRuleConfig {
18 SparseBitVector<> DisabledRules;
19
20 bool isRuleEnabled(unsigned RuleID) const;
21 bool parseCommandLineOption();
22 bool setRuleEnabled(StringRef RuleIdentifier);
23 bool setRuleDisabled(StringRef RuleIdentifier);
24};
25
26static std::optional<uint64_t> getRuleIdxForIdentifier(StringRef RuleIdentifier) {
27 uint64_t I;
28 // getAtInteger(...) returns false on success
29 bool Parsed = !RuleIdentifier.getAsInteger(0, I);
30 if (Parsed)
31 return I;
32
33#ifndef NDEBUG
34 switch (RuleIdentifier.size()) {
35 default: break;
36 case 9: // 1 string to match.
37 if (memcmp(RuleIdentifier.data()+0, "copy_prop", 9) != 0)
38 break;
39 return 0; // "copy_prop"
40 case 10: // 2 strings to match.
41 switch (RuleIdentifier[0]) {
42 default: break;
43 case 'm': // 1 string to match.
44 if (memcmp(RuleIdentifier.data()+1, "ul_to_shl", 9) != 0)
45 break;
46 return 1; // "mul_to_shl"
47 case 's': // 1 string to match.
48 if (memcmp(RuleIdentifier.data()+1, "ub_to_add", 9) != 0)
49 break;
50 return 2; // "sub_to_add"
51 }
52 break;
53 case 12: // 1 string to match.
54 if (memcmp(RuleIdentifier.data()+0, "not_cmp_fold", 12) != 0)
55 break;
56 return 9; // "not_cmp_fold"
57 case 13: // 1 string to match.
58 if (memcmp(RuleIdentifier.data()+0, "load_and_mask", 13) != 0)
59 break;
60 return 8; // "load_and_mask"
61 case 14: // 1 string to match.
62 if (memcmp(RuleIdentifier.data()+0, "mul_by_neg_one", 14) != 0)
63 break;
64 return 4; // "mul_by_neg_one"
65 case 15: // 2 strings to match.
66 switch (RuleIdentifier[0]) {
67 default: break;
68 case 'e': // 1 string to match.
69 if (memcmp(RuleIdentifier.data()+1, "xtending_loads", 14) != 0)
70 break;
71 return 7; // "extending_loads"
72 case 'i': // 1 string to match.
73 if (memcmp(RuleIdentifier.data()+1, "dempotent_prop", 14) != 0)
74 break;
75 return 5; // "idempotent_prop"
76 }
77 break;
78 case 17: // 1 string to match.
79 if (memcmp(RuleIdentifier.data()+0, "add_p2i_to_ptradd", 17) != 0)
80 break;
81 return 3; // "add_p2i_to_ptradd"
82 case 19: // 1 string to match.
83 if (memcmp(RuleIdentifier.data()+0, "ptr_add_immed_chain", 19) != 0)
84 break;
85 return 6; // "ptr_add_immed_chain"
86 case 21: // 1 string to match.
87 if (memcmp(RuleIdentifier.data()+0, "combine_concat_vector", 21) != 0)
88 break;
89 return 11; // "combine_concat_vector"
90 case 28: // 1 string to match.
91 if (memcmp(RuleIdentifier.data()+0, "opt_brcond_by_inverting_cond", 28) != 0)
92 break;
93 return 10; // "opt_brcond_by_inverting_cond"
94 }
95#endif // ifndef NDEBUG
96
97 return std::nullopt;
98}
99static std::optional<std::pair<uint64_t, uint64_t>> getRuleRangeForIdentifier(StringRef RuleIdentifier) {
100 std::pair<StringRef, StringRef> RangePair = RuleIdentifier.split('-');
101 if (!RangePair.second.empty()) {
102 const auto First = getRuleIdxForIdentifier(RangePair.first);
103 const auto Last = getRuleIdxForIdentifier(RangePair.second);
104 if (!First || !Last)
105 return std::nullopt;
106 if (First >= Last)
107 report_fatal_error("Beginning of range should be before end of range");
108 return {{*First, *Last + 1}};
109 }
110 if (RangePair.first == "*") {
111 return {{0, 12}};
112 }
113 const auto I = getRuleIdxForIdentifier(RangePair.first);
114 if (!I)
115 return std::nullopt;
116 return {{*I, *I + 1}};
117}
118
119bool RISCVO0PreLegalizerCombinerImplRuleConfig::setRuleEnabled(StringRef RuleIdentifier) {
120 auto MaybeRange = getRuleRangeForIdentifier(RuleIdentifier);
121 if (!MaybeRange)
122 return false;
123 for (auto I = MaybeRange->first; I < MaybeRange->second; ++I)
124 DisabledRules.reset(I);
125 return true;
126}
127
128bool RISCVO0PreLegalizerCombinerImplRuleConfig::setRuleDisabled(StringRef RuleIdentifier) {
129 auto MaybeRange = getRuleRangeForIdentifier(RuleIdentifier);
130 if (!MaybeRange)
131 return false;
132 for (auto I = MaybeRange->first; I < MaybeRange->second; ++I)
133 DisabledRules.set(I);
134 return true;
135}
136
137static std::vector<std::string> RISCVO0PreLegalizerCombinerOption;
138static cl::list<std::string> RISCVO0PreLegalizerCombinerDisableOption(
139 "riscvo0prelegalizercombiner-disable-rule",
140 cl::desc("Disable one or more combiner rules temporarily in the RISCVO0PreLegalizerCombiner pass"),
141 cl::CommaSeparated,
142 cl::Hidden,
143 cl::cat(GICombinerOptionCategory),
144 cl::callback([](const std::string &Str) {
145 RISCVO0PreLegalizerCombinerOption.push_back(Str);
146 }));
147static cl::list<std::string> RISCVO0PreLegalizerCombinerOnlyEnableOption(
148 "riscvo0prelegalizercombiner-only-enable-rule",
149 cl::desc("Disable all rules in the RISCVO0PreLegalizerCombiner pass then re-enable the specified ones"),
150 cl::Hidden,
151 cl::cat(GICombinerOptionCategory),
152 cl::callback([](const std::string &CommaSeparatedArg) {
153 StringRef Str = CommaSeparatedArg;
154 RISCVO0PreLegalizerCombinerOption.push_back("*");
155 do {
156 auto X = Str.split(",");
157 RISCVO0PreLegalizerCombinerOption.push_back(("!" + X.first).str());
158 Str = X.second;
159 } while (!Str.empty());
160 }));
161
162
163bool RISCVO0PreLegalizerCombinerImplRuleConfig::isRuleEnabled(unsigned RuleID) const {
164 return !DisabledRules.test(RuleID);
165}
166bool RISCVO0PreLegalizerCombinerImplRuleConfig::parseCommandLineOption() {
167 for (StringRef Identifier : RISCVO0PreLegalizerCombinerOption) {
168 bool Enabled = Identifier.consume_front("!");
169 if (Enabled && !setRuleEnabled(Identifier))
170 return false;
171 if (!Enabled && !setRuleDisabled(Identifier))
172 return false;
173 }
174 return true;
175}
176
177#endif // ifdef GET_GICOMBINER_TYPES
178
179#ifdef GET_GICOMBINER_TYPES
180const unsigned MAX_SUBTARGET_PREDICATES = 0;
181using PredicateBitset = llvm::Bitset<MAX_SUBTARGET_PREDICATES>;
182#endif // ifdef GET_GICOMBINER_TYPES
183
184#ifdef GET_GICOMBINER_CLASS_MEMBERS
185PredicateBitset AvailableModuleFeatures;
186mutable PredicateBitset AvailableFunctionFeatures;
187PredicateBitset getAvailableFeatures() const {
188 return AvailableModuleFeatures | AvailableFunctionFeatures;
189}
190PredicateBitset
191computeAvailableModuleFeatures(const RISCVSubtarget *Subtarget) const;
192PredicateBitset
193computeAvailableFunctionFeatures(const RISCVSubtarget *Subtarget,
194 const MachineFunction *MF) const;
195void setupGeneratedPerFunctionState(MachineFunction &MF) override;
196#endif // ifdef GET_GICOMBINER_CLASS_MEMBERS
197#ifdef GET_GICOMBINER_CLASS_MEMBERS
198 mutable MatcherState State;
199 typedef ComplexRendererFns(RISCVO0PreLegalizerCombinerImpl::*ComplexMatcherMemFn)(MachineOperand &) const;
200 typedef void(RISCVO0PreLegalizerCombinerImpl::*CustomRendererFn)(MachineInstrBuilder &, const MachineInstr &, int) const;
201 const ExecInfoTy<PredicateBitset, ComplexMatcherMemFn, CustomRendererFn> ExecInfo;
202 static RISCVO0PreLegalizerCombinerImpl::ComplexMatcherMemFn ComplexPredicateFns[];
203 static RISCVO0PreLegalizerCombinerImpl::CustomRendererFn CustomRenderers[];
204 bool testImmPredicate_I64(unsigned PredicateID, int64_t Imm) const override;
205 bool testImmPredicate_APInt(unsigned PredicateID, const APInt &Imm) const override;
206 bool testImmPredicate_APFloat(unsigned PredicateID, const APFloat &Imm) const override;
207 const uint8_t *getMatchTable() const override;
208 bool testMIPredicate_MI(unsigned PredicateID, const MachineInstr &MI, const MatcherState &State) const override;
209 bool testMOPredicate_MO(unsigned PredicateID, const MachineOperand &MO, const MatcherState &State) const override;
210 bool testSimplePredicate(unsigned PredicateID) const override;
211 bool runCustomAction(unsigned FnID, const MatcherState &State, NewMIVector &OutMIs) const override;
212#endif // ifdef GET_GICOMBINER_CLASS_MEMBERS
213
214#ifdef GET_GICOMBINER_IMPL
215// LLT Objects.
216enum {
217 GILLT_s1,
218};
219const static size_t NumTypeObjects = 1;
220const static LLT TypeObjects[] = {
221 LLT::scalar(1),
222};
223
224// Bits for subtarget features that participate in instruction matching.
225enum SubtargetFeatureBits : uint8_t {
226};
227
228PredicateBitset RISCVO0PreLegalizerCombinerImpl::
229computeAvailableModuleFeatures(const RISCVSubtarget *Subtarget) const {
230 PredicateBitset Features{};
231 return Features;
232}
233
234void RISCVO0PreLegalizerCombinerImpl::setupGeneratedPerFunctionState(MachineFunction &MF) {
235 AvailableFunctionFeatures = computeAvailableFunctionFeatures((const RISCVSubtarget *)&MF.getSubtarget(), &MF);
236}
237PredicateBitset RISCVO0PreLegalizerCombinerImpl::
238computeAvailableFunctionFeatures(const RISCVSubtarget *Subtarget, const MachineFunction *MF) const {
239 PredicateBitset Features{};
240 return Features;
241}
242
243// Feature bitsets.
244enum {
245 GIFBS_Invalid,
246};
247constexpr static PredicateBitset FeatureBitsets[] {
248 {}, // GIFBS_Invalid
249};
250
251// ComplexPattern predicates.
252enum {
253 GICP_Invalid,
254};
255// See constructor for table contents
256
257RISCVO0PreLegalizerCombinerImpl::ComplexMatcherMemFn
258RISCVO0PreLegalizerCombinerImpl::ComplexPredicateFns[] = {
259 nullptr, // GICP_Invalid
260};
261
262bool RISCVO0PreLegalizerCombinerImpl::testMIPredicate_MI(unsigned PredicateID, const MachineInstr & MI, const MatcherState &State) const {
263 llvm_unreachable("Unknown predicate");
264 return false;
265}
266bool RISCVO0PreLegalizerCombinerImpl::testMOPredicate_MO(unsigned PredicateID, const MachineOperand & MO, const MatcherState &State) const {
267 llvm_unreachable("Unknown predicate");
268 return false;
269}
270bool RISCVO0PreLegalizerCombinerImpl::testImmPredicate_I64(unsigned PredicateID, int64_t Imm) const {
271 llvm_unreachable("Unknown predicate");
272 return false;
273}
274bool RISCVO0PreLegalizerCombinerImpl::testImmPredicate_APFloat(unsigned PredicateID, const APFloat & Imm) const {
275 llvm_unreachable("Unknown predicate");
276 return false;
277}
278bool RISCVO0PreLegalizerCombinerImpl::testImmPredicate_APInt(unsigned PredicateID, const APInt & Imm) const {
279 llvm_unreachable("Unknown predicate");
280 return false;
281}
282enum {
283 GICXXPred_Simple_IsRule0Enabled = GICXXPred_Invalid + 1,
284 GICXXPred_Simple_IsRule1Enabled,
285 GICXXPred_Simple_IsRule2Enabled,
286 GICXXPred_Simple_IsRule3Enabled,
287 GICXXPred_Simple_IsRule4Enabled,
288 GICXXPred_Simple_IsRule5Enabled,
289 GICXXPred_Simple_IsRule6Enabled,
290 GICXXPred_Simple_IsRule7Enabled,
291 GICXXPred_Simple_IsRule8Enabled,
292 GICXXPred_Simple_IsRule9Enabled,
293 GICXXPred_Simple_IsRule10Enabled,
294 GICXXPred_Simple_IsRule11Enabled,
295};
296
297bool RISCVO0PreLegalizerCombinerImpl::testSimplePredicate(unsigned Predicate) const {
298 return RuleConfig.isRuleEnabled(Predicate - GICXXPred_Invalid - 1);
299}
300// Custom renderers.
301enum {
302 GICR_Invalid,
303};
304RISCVO0PreLegalizerCombinerImpl::CustomRendererFn
305RISCVO0PreLegalizerCombinerImpl::CustomRenderers[] = {
306 nullptr, // GICR_Invalid
307};
308
309bool RISCVO0PreLegalizerCombinerImpl::tryCombineAll(MachineInstr &I) const {
310 const TargetSubtargetInfo &ST = MF.getSubtarget();
311 const PredicateBitset AvailableFeatures = getAvailableFeatures();
312 B.setInstrAndDebugLoc(I);
313 State.MIs.clear();
314 State.MIs.push_back(&I);
315 if (executeMatchTable(*this, State, ExecInfo, B, getMatchTable(), *ST.getInstrInfo(), MRI, *MRI.getTargetRegisterInfo(), *ST.getRegBankInfo(), AvailableFeatures, /*CoverageInfo*/ nullptr)) {
316 return true;
317 }
318
319 return false;
320}
321
322enum {
323 GICXXCustomAction_GICombiner0 = GICXXCustomAction_Invalid + 1,
324 GICXXCustomAction_GICombiner1,
325 GICXXCustomAction_GICombiner2,
326 GICXXCustomAction_GICombiner3,
327 GICXXCustomAction_GICombiner4,
328 GICXXCustomAction_GICombiner5,
329 GICXXCustomAction_GICombiner6,
330 GICXXCustomAction_GICombiner7,
331 GICXXCustomAction_GICombiner8,
332 GICXXCustomAction_GICombiner9,
333};
334bool RISCVO0PreLegalizerCombinerImpl::runCustomAction(unsigned ApplyID, const MatcherState &State, NewMIVector &OutMIs) const {
335 Helper.getBuilder().setInstrAndDebugLoc(*State.MIs[0]);
336 switch(ApplyID) {
337 case GICXXCustomAction_GICombiner0:{
338 // Match Patterns
339 if(![&](){return Helper.matchCombineCopy(*State.MIs[0]);}()) {
340 return false;
341 }
342 // Apply Patterns
343 Helper.applyCombineCopy(*State.MIs[0]);
344 return true;
345 }
346 case GICXXCustomAction_GICombiner1:{
347 unsigned GIMatchData_matchinfo;
348 // Match Patterns
349 if(![&](){return Helper.matchCombineMulToShl(*State.MIs[0], GIMatchData_matchinfo);}()) {
350 return false;
351 }
352 // Apply Patterns
353 Helper.applyCombineMulToShl(*State.MIs[0], GIMatchData_matchinfo);
354 return true;
355 }
356 case GICXXCustomAction_GICombiner2:{
357 std::function<void(MachineIRBuilder &)> GIMatchData_matchinfo;
358 // Match Patterns
359 if(![&](){return Helper.matchCombineSubToAdd(*State.MIs[0], GIMatchData_matchinfo);}()) {
360 return false;
361 }
362 // Apply Patterns
363 Helper.applyBuildFnNoErase(*State.MIs[0], GIMatchData_matchinfo);
364 return true;
365 }
366 case GICXXCustomAction_GICombiner3:{
367 std::pair<Register, bool> GIMatchData_info;
368 // Match Patterns
369 if(![&](){return Helper.matchCombineAddP2IToPtrAdd(*State.MIs[0], GIMatchData_info);}()) {
370 return false;
371 }
372 // Apply Patterns
373 Helper.applyCombineAddP2IToPtrAdd(*State.MIs[0], GIMatchData_info);
374 return true;
375 }
376 case GICXXCustomAction_GICombiner4:{
377 PtrAddChain GIMatchData_matchinfo;
378 // Match Patterns
379 if(![&](){return Helper.matchPtrAddImmedChain(*State.MIs[0], GIMatchData_matchinfo);}()) {
380 return false;
381 }
382 // Apply Patterns
383 Helper.applyPtrAddImmedChain(*State.MIs[0], GIMatchData_matchinfo);
384 return true;
385 }
386 case GICXXCustomAction_GICombiner5:{
387 PreferredTuple GIMatchData_matchinfo;
388 // Match Patterns
389 if(![&](){return Helper.matchCombineExtendingLoads(*State.MIs[0], GIMatchData_matchinfo);}()) {
390 return false;
391 }
392 // Apply Patterns
393 Helper.applyCombineExtendingLoads(*State.MIs[0], GIMatchData_matchinfo);
394 return true;
395 }
396 case GICXXCustomAction_GICombiner6:{
397 std::function<void(MachineIRBuilder &)> GIMatchData_matchinfo;
398 // Match Patterns
399 if(![&](){return Helper.matchCombineLoadWithAndMask(*State.MIs[0], GIMatchData_matchinfo);}()) {
400 return false;
401 }
402 // Apply Patterns
403 Helper.applyBuildFn(*State.MIs[0], GIMatchData_matchinfo);
404 return true;
405 }
406 case GICXXCustomAction_GICombiner7:{
407 SmallVector<Register> GIMatchData_info;
408 // Match Patterns
409 if(![&](){return Helper.matchNotCmp(*State.MIs[0], GIMatchData_info);}()) {
410 return false;
411 }
412 // Apply Patterns
413 Helper.applyNotCmp(*State.MIs[0], GIMatchData_info);
414 return true;
415 }
416 case GICXXCustomAction_GICombiner8:{
417 MachineInstr * GIMatchData_matchinfo;
418 // Match Patterns
419 if(![&](){return Helper.matchOptBrCondByInvertingCond(*State.MIs[0], GIMatchData_matchinfo);}()) {
420 return false;
421 }
422 // Apply Patterns
423 Helper.applyOptBrCondByInvertingCond(*State.MIs[0], GIMatchData_matchinfo);
424 return true;
425 }
426 case GICXXCustomAction_GICombiner9:{
427 SmallVector<Register> GIMatchData_matchinfo;
428 // Match Patterns
429 if(![&](){return Helper.matchCombineConcatVectors(*State.MIs[0], GIMatchData_matchinfo);}()) {
430 return false;
431 }
432 // Apply Patterns
433 Helper.applyCombineConcatVectors(*State.MIs[0], GIMatchData_matchinfo);
434 return true;
435 }
436 }
437 llvm_unreachable("Unknown Apply Action");
438}
439#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
440#define GIMT_Encode2(Val) uint8_t(Val), uint8_t((uint16_t)Val >> 8)
441#define GIMT_Encode4(Val) uint8_t(Val), uint8_t((uint32_t)Val >> 8), uint8_t((uint32_t)Val >> 16), uint8_t((uint32_t)Val >> 24)
442#define GIMT_Encode8(Val) uint8_t(Val), uint8_t((uint64_t)Val >> 8), uint8_t((uint64_t)Val >> 16), uint8_t((uint64_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)
443#else
444#define GIMT_Encode2(Val) uint8_t((uint16_t)Val >> 8), uint8_t(Val)
445#define GIMT_Encode4(Val) uint8_t((uint32_t)Val >> 24), uint8_t((uint32_t)Val >> 16), uint8_t((uint32_t)Val >> 8), uint8_t(Val)
446#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((uint64_t)Val >> 24), uint8_t((uint64_t)Val >> 16), uint8_t((uint64_t)Val >> 8), uint8_t(Val)
447#endif
448const uint8_t *RISCVO0PreLegalizerCombinerImpl::getMatchTable() const {
449 constexpr static uint8_t MatchTable0[] = {
450 /* 0 */ GIM_SwitchOpcode, /*MI*/0, /*[*/GIMT_Encode2(20), GIMT_Encode2(234), /*)*//*default:*//*Label 15*/ GIMT_Encode4(1150),
451 /* 10 */ /*TargetOpcode::COPY*//*Label 0*/ GIMT_Encode4(866), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
452 /* 142 */ /*TargetOpcode::G_ADD*//*Label 1*/ GIMT_Encode4(878),
453 /* 146 */ /*TargetOpcode::G_SUB*//*Label 2*/ GIMT_Encode4(890),
454 /* 150 */ /*TargetOpcode::G_MUL*//*Label 3*/ GIMT_Encode4(912), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
455 /* 178 */ /*TargetOpcode::G_AND*//*Label 4*/ GIMT_Encode4(964), GIMT_Encode4(0),
456 /* 186 */ /*TargetOpcode::G_XOR*//*Label 5*/ GIMT_Encode4(976), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
457 /* 246 */ /*TargetOpcode::G_CONCAT_VECTORS*//*Label 6*/ GIMT_Encode4(988), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
458 /* 262 */ /*TargetOpcode::G_FREEZE*//*Label 7*/ GIMT_Encode4(1000), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
459 /* 302 */ /*TargetOpcode::G_LOAD*//*Label 8*/ GIMT_Encode4(1030),
460 /* 306 */ /*TargetOpcode::G_SEXTLOAD*//*Label 9*/ GIMT_Encode4(1042),
461 /* 310 */ /*TargetOpcode::G_ZEXTLOAD*//*Label 10*/ GIMT_Encode4(1054), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
462 /* 754 */ /*TargetOpcode::G_FABS*//*Label 11*/ GIMT_Encode4(1066), GIMT_Encode4(0), GIMT_Encode4(0),
463 /* 766 */ /*TargetOpcode::G_FCANONICALIZE*//*Label 12*/ GIMT_Encode4(1096), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
464 /* 826 */ /*TargetOpcode::G_PTR_ADD*//*Label 13*/ GIMT_Encode4(1126), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
465 /* 862 */ /*TargetOpcode::G_BR*//*Label 14*/ GIMT_Encode4(1138),
466 /* 866 */ // Label 0: @866
467 /* 866 */ GIM_Try, /*On fail goto*//*Label 16*/ GIMT_Encode4(877), // Rule ID 0 //
468 /* 871 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled),
469 /* 874 */ // MIs[0] d
470 /* 874 */ // No operand predicates
471 /* 874 */ // MIs[0] s
472 /* 874 */ // No operand predicates
473 /* 874 */ // Combiner Rule #0: copy_prop
474 /* 874 */ GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner0),
475 /* 877 */ // Label 16: @877
476 /* 877 */ GIM_Reject,
477 /* 878 */ // Label 1: @878
478 /* 878 */ GIM_Try, /*On fail goto*//*Label 17*/ GIMT_Encode4(889), // Rule ID 3 //
479 /* 883 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule3Enabled),
480 /* 886 */ // Combiner Rule #3: add_p2i_to_ptradd; wip_match_opcode 'G_ADD'
481 /* 886 */ GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner3),
482 /* 889 */ // Label 17: @889
483 /* 889 */ GIM_Reject,
484 /* 890 */ // Label 2: @890
485 /* 890 */ GIM_Try, /*On fail goto*//*Label 18*/ GIMT_Encode4(911), // Rule ID 2 //
486 /* 895 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled),
487 /* 898 */ // MIs[0] d
488 /* 898 */ // No operand predicates
489 /* 898 */ // MIs[0] op1
490 /* 898 */ // No operand predicates
491 /* 898 */ // MIs[0] c
492 /* 898 */ GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/2, // MIs[1]
493 /* 902 */ GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_CONSTANT),
494 /* 906 */ // MIs[1] imm
495 /* 906 */ // No operand predicates
496 /* 906 */ GIM_CheckIsSafeToFold, /*NumInsns*/1,
497 /* 908 */ // Combiner Rule #2: sub_to_add
498 /* 908 */ GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner2),
499 /* 911 */ // Label 18: @911
500 /* 911 */ GIM_Reject,
501 /* 912 */ // Label 3: @912
502 /* 912 */ GIM_Try, /*On fail goto*//*Label 19*/ GIMT_Encode4(952), // Rule ID 4 //
503 /* 917 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule4Enabled),
504 /* 920 */ // MIs[0] dst
505 /* 920 */ GIM_RecordRegType, /*MI*/0, /*Op*/0, /*TempTypeIdx*/uint8_t(-1),
506 /* 924 */ // MIs[0] x
507 /* 924 */ // No operand predicates
508 /* 924 */ // MIs[0] Operand 2
509 /* 924 */ GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, uint8_t(-1),
510 /* 928 */ GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/uint8_t(-1),
511 /* 931 */ GIR_BuildConstant, /*TempRegID*/0, /*Val*/GIMT_Encode8(0),
512 /* 941 */ // Combiner Rule #4: mul_by_neg_one
513 /* 941 */ GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_SUB),
514 /* 944 */ GIR_RootToRootCopy, /*OpIdx*/0, // dst
515 /* 946 */ GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
516 /* 949 */ GIR_RootToRootCopy, /*OpIdx*/1, // x
517 /* 951 */ GIR_EraseRootFromParent_Done,
518 /* 952 */ // Label 19: @952
519 /* 952 */ GIM_Try, /*On fail goto*//*Label 20*/ GIMT_Encode4(963), // Rule ID 1 //
520 /* 957 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule1Enabled),
521 /* 960 */ // MIs[0] d
522 /* 960 */ // No operand predicates
523 /* 960 */ // MIs[0] op1
524 /* 960 */ // No operand predicates
525 /* 960 */ // MIs[0] op2
526 /* 960 */ // No operand predicates
527 /* 960 */ // Combiner Rule #1: mul_to_shl
528 /* 960 */ GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner1),
529 /* 963 */ // Label 20: @963
530 /* 963 */ GIM_Reject,
531 /* 964 */ // Label 4: @964
532 /* 964 */ GIM_Try, /*On fail goto*//*Label 21*/ GIMT_Encode4(975), // Rule ID 12 //
533 /* 969 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule8Enabled),
534 /* 972 */ // Combiner Rule #8: load_and_mask; wip_match_opcode 'G_AND'
535 /* 972 */ GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner6),
536 /* 975 */ // Label 21: @975
537 /* 975 */ GIM_Reject,
538 /* 976 */ // Label 5: @976
539 /* 976 */ GIM_Try, /*On fail goto*//*Label 22*/ GIMT_Encode4(987), // Rule ID 13 //
540 /* 981 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule9Enabled),
541 /* 984 */ // Combiner Rule #9: not_cmp_fold; wip_match_opcode 'G_XOR'
542 /* 984 */ GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner7),
543 /* 987 */ // Label 22: @987
544 /* 987 */ GIM_Reject,
545 /* 988 */ // Label 6: @988
546 /* 988 */ GIM_Try, /*On fail goto*//*Label 23*/ GIMT_Encode4(999), // Rule ID 15 //
547 /* 993 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule11Enabled),
548 /* 996 */ // Combiner Rule #11: combine_concat_vector; wip_match_opcode 'G_CONCAT_VECTORS'
549 /* 996 */ GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner9),
550 /* 999 */ // Label 23: @999
551 /* 999 */ GIM_Reject,
552 /* 1000 */ // Label 7: @1000
553 /* 1000 */ GIM_Try, /*On fail goto*//*Label 24*/ GIMT_Encode4(1029), // Rule ID 5 //
554 /* 1005 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule5Enabled),
555 /* 1008 */ // MIs[0] dst
556 /* 1008 */ // No operand predicates
557 /* 1008 */ // MIs[0] src
558 /* 1008 */ GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
559 /* 1012 */ GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_FREEZE),
560 /* 1016 */ // MIs[1] __idempotent_prop_match_0.x
561 /* 1016 */ // No operand predicates
562 /* 1016 */ GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1,
563 /* 1021 */ GIM_CheckIsSafeToFold, /*NumInsns*/1,
564 /* 1023 */ // Combiner Rule #5: idempotent_prop @ [__idempotent_prop_match_0[0]]
565 /* 1023 */ GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1,
566 /* 1028 */ GIR_EraseRootFromParent_Done,
567 /* 1029 */ // Label 24: @1029
568 /* 1029 */ GIM_Reject,
569 /* 1030 */ // Label 8: @1030
570 /* 1030 */ GIM_Try, /*On fail goto*//*Label 25*/ GIMT_Encode4(1041), // Rule ID 9 //
571 /* 1035 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule7Enabled),
572 /* 1038 */ // Combiner Rule #7: extending_loads; wip_match_opcode 'G_LOAD'
573 /* 1038 */ GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner5),
574 /* 1041 */ // Label 25: @1041
575 /* 1041 */ GIM_Reject,
576 /* 1042 */ // Label 9: @1042
577 /* 1042 */ GIM_Try, /*On fail goto*//*Label 26*/ GIMT_Encode4(1053), // Rule ID 10 //
578 /* 1047 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule7Enabled),
579 /* 1050 */ // Combiner Rule #7: extending_loads; wip_match_opcode 'G_SEXTLOAD'
580 /* 1050 */ GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner5),
581 /* 1053 */ // Label 26: @1053
582 /* 1053 */ GIM_Reject,
583 /* 1054 */ // Label 10: @1054
584 /* 1054 */ GIM_Try, /*On fail goto*//*Label 27*/ GIMT_Encode4(1065), // Rule ID 11 //
585 /* 1059 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule7Enabled),
586 /* 1062 */ // Combiner Rule #7: extending_loads; wip_match_opcode 'G_ZEXTLOAD'
587 /* 1062 */ GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner5),
588 /* 1065 */ // Label 27: @1065
589 /* 1065 */ GIM_Reject,
590 /* 1066 */ // Label 11: @1066
591 /* 1066 */ GIM_Try, /*On fail goto*//*Label 28*/ GIMT_Encode4(1095), // Rule ID 6 //
592 /* 1071 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule5Enabled),
593 /* 1074 */ // MIs[0] dst
594 /* 1074 */ // No operand predicates
595 /* 1074 */ // MIs[0] src
596 /* 1074 */ GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
597 /* 1078 */ GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_FABS),
598 /* 1082 */ // MIs[1] __idempotent_prop_match_0.x
599 /* 1082 */ // No operand predicates
600 /* 1082 */ GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1,
601 /* 1087 */ GIM_CheckIsSafeToFold, /*NumInsns*/1,
602 /* 1089 */ // Combiner Rule #5: idempotent_prop @ [__idempotent_prop_match_0[1]]
603 /* 1089 */ GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1,
604 /* 1094 */ GIR_EraseRootFromParent_Done,
605 /* 1095 */ // Label 28: @1095
606 /* 1095 */ GIM_Reject,
607 /* 1096 */ // Label 12: @1096
608 /* 1096 */ GIM_Try, /*On fail goto*//*Label 29*/ GIMT_Encode4(1125), // Rule ID 7 //
609 /* 1101 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule5Enabled),
610 /* 1104 */ // MIs[0] dst
611 /* 1104 */ // No operand predicates
612 /* 1104 */ // MIs[0] src
613 /* 1104 */ GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
614 /* 1108 */ GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_FCANONICALIZE),
615 /* 1112 */ // MIs[1] __idempotent_prop_match_0.x
616 /* 1112 */ // No operand predicates
617 /* 1112 */ GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1,
618 /* 1117 */ GIM_CheckIsSafeToFold, /*NumInsns*/1,
619 /* 1119 */ // Combiner Rule #5: idempotent_prop @ [__idempotent_prop_match_0[2]]
620 /* 1119 */ GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1,
621 /* 1124 */ GIR_EraseRootFromParent_Done,
622 /* 1125 */ // Label 29: @1125
623 /* 1125 */ GIM_Reject,
624 /* 1126 */ // Label 13: @1126
625 /* 1126 */ GIM_Try, /*On fail goto*//*Label 30*/ GIMT_Encode4(1137), // Rule ID 8 //
626 /* 1131 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule6Enabled),
627 /* 1134 */ // Combiner Rule #6: ptr_add_immed_chain; wip_match_opcode 'G_PTR_ADD'
628 /* 1134 */ GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner4),
629 /* 1137 */ // Label 30: @1137
630 /* 1137 */ GIM_Reject,
631 /* 1138 */ // Label 14: @1138
632 /* 1138 */ GIM_Try, /*On fail goto*//*Label 31*/ GIMT_Encode4(1149), // Rule ID 14 //
633 /* 1143 */ GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule10Enabled),
634 /* 1146 */ // Combiner Rule #10: opt_brcond_by_inverting_cond; wip_match_opcode 'G_BR'
635 /* 1146 */ GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner8),
636 /* 1149 */ // Label 31: @1149
637 /* 1149 */ GIM_Reject,
638 /* 1150 */ // Label 15: @1150
639 /* 1150 */ GIM_Reject,
640 /* 1151 */ }; // Size: 1151 bytes
641 return MatchTable0;
642}
643#undef GIMT_Encode2
644#undef GIMT_Encode4
645#undef GIMT_Encode8
646
647#endif // ifdef GET_GICOMBINER_IMPL
648
649#ifdef GET_GICOMBINER_CONSTRUCTOR_INITS
650AvailableModuleFeatures(computeAvailableModuleFeatures(&STI)),
651AvailableFunctionFeatures()
652#endif // ifdef GET_GICOMBINER_CONSTRUCTOR_INITS
653#ifdef GET_GICOMBINER_CONSTRUCTOR_INITS
654, State(0),
655ExecInfo(TypeObjects, NumTypeObjects, FeatureBitsets, ComplexPredicateFns, CustomRenderers)
656#endif // ifdef GET_GICOMBINER_CONSTRUCTOR_INITS
657
658