1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
2 | |* *| |
3 | |* RISCVPostLegalizerCombinerImpl 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" |
11 | namespace llvm { |
12 | extern cl::OptionCategory GICombinerOptionCategory; |
13 | } // end namespace llvm |
14 | #endif // ifdef GET_GICOMBINER_DEPS |
15 | |
16 | #ifdef GET_GICOMBINER_TYPES |
17 | struct RISCVPostLegalizerCombinerImplRuleConfig { |
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 | |
26 | static 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 10: // 2 strings to match. |
37 | switch (RuleIdentifier[0]) { |
38 | default: break; |
39 | case 'i': // 1 string to match. |
40 | if (memcmp(RuleIdentifier.data()+1, "2p_to_p2i" , 9) != 0) |
41 | break; |
42 | return 7; // "i2p_to_p2i" |
43 | case 'p': // 1 string to match. |
44 | if (memcmp(RuleIdentifier.data()+1, "2i_to_i2p" , 9) != 0) |
45 | break; |
46 | return 6; // "p2i_to_i2p" |
47 | } |
48 | break; |
49 | case 11: // 1 string to match. |
50 | if (memcmp(RuleIdentifier.data()+0, "add_sub_reg" , 11) != 0) |
51 | break; |
52 | return 12; // "add_sub_reg" |
53 | case 13: // 1 string to match. |
54 | if (memcmp(RuleIdentifier.data()+0, "redundant_and" , 13) != 0) |
55 | break; |
56 | return 0; // "redundant_and" |
57 | case 14: // 2 strings to match. |
58 | switch (RuleIdentifier[0]) { |
59 | default: break; |
60 | case 'b': // 1 string to match. |
61 | if (memcmp(RuleIdentifier.data()+1, "inop_same_val" , 13) != 0) |
62 | break; |
63 | return 3; // "binop_same_val" |
64 | case 'f': // 1 string to match. |
65 | if (memcmp(RuleIdentifier.data()+1, "neg_fneg_fold" , 13) != 0) |
66 | break; |
67 | return 9; // "fneg_fneg_fold" |
68 | } |
69 | break; |
70 | case 15: // 1 string to match. |
71 | if (memcmp(RuleIdentifier.data()+0, "select_same_val" , 15) != 0) |
72 | break; |
73 | return 1; // "select_same_val" |
74 | case 17: // 1 string to match. |
75 | if (memcmp(RuleIdentifier.data()+0, "anyext_trunc_fold" , 17) != 0) |
76 | break; |
77 | return 8; // "anyext_trunc_fold" |
78 | case 18: // 2 strings to match. |
79 | switch (RuleIdentifier[0]) { |
80 | default: break; |
81 | case 'b': // 1 string to match. |
82 | if (memcmp(RuleIdentifier.data()+1, "inop_left_to_zero" , 17) != 0) |
83 | break; |
84 | return 4; // "binop_left_to_zero" |
85 | case 'f': // 1 string to match. |
86 | if (memcmp(RuleIdentifier.data()+1, "ptrunc_fpext_fold" , 17) != 0) |
87 | break; |
88 | return 17; // "fptrunc_fpext_fold" |
89 | } |
90 | break; |
91 | case 19: // 2 strings to match. |
92 | switch (RuleIdentifier[0]) { |
93 | default: break; |
94 | case 'b': // 1 string to match. |
95 | if (memcmp(RuleIdentifier.data()+1, "inop_right_to_zero" , 18) != 0) |
96 | break; |
97 | return 5; // "binop_right_to_zero" |
98 | case 'r': // 1 string to match. |
99 | if (memcmp(RuleIdentifier.data()+1, "ight_identity_zero" , 18) != 0) |
100 | break; |
101 | return 2; // "right_identity_zero" |
102 | } |
103 | break; |
104 | case 20: // 1 string to match. |
105 | if (memcmp(RuleIdentifier.data()+0, "bitcast_bitcast_fold" , 20) != 0) |
106 | break; |
107 | return 16; // "bitcast_bitcast_fold" |
108 | case 21: // 1 string to match. |
109 | if (memcmp(RuleIdentifier.data()+0, "right_identity_one_fp" , 21) != 0) |
110 | break; |
111 | return 11; // "right_identity_one_fp" |
112 | case 22: // 2 strings to match. |
113 | switch (RuleIdentifier[0]) { |
114 | default: break; |
115 | case 'r': // 1 string to match. |
116 | if (memcmp(RuleIdentifier.data()+1, "ight_identity_one_int" , 21) != 0) |
117 | break; |
118 | return 10; // "right_identity_one_int" |
119 | case 't': // 1 string to match. |
120 | if (memcmp(RuleIdentifier.data()+1, "runc_buildvector_fold" , 21) != 0) |
121 | break; |
122 | return 14; // "trunc_buildvector_fold" |
123 | } |
124 | break; |
125 | case 25: // 2 strings to match. |
126 | switch (RuleIdentifier[0]) { |
127 | default: break; |
128 | case 'b': // 1 string to match. |
129 | if (memcmp(RuleIdentifier.data()+1, "uildvector_identity_fold" , 24) != 0) |
130 | break; |
131 | return 13; // "buildvector_identity_fold" |
132 | case 'r': // 1 string to match. |
133 | if (memcmp(RuleIdentifier.data()+1, "ight_identity_neg_one_fp" , 24) != 0) |
134 | break; |
135 | return 19; // "right_identity_neg_one_fp" |
136 | } |
137 | break; |
138 | case 26: // 1 string to match. |
139 | if (memcmp(RuleIdentifier.data()+0, "right_identity_neg_zero_fp" , 26) != 0) |
140 | break; |
141 | return 18; // "right_identity_neg_zero_fp" |
142 | case 27: // 1 string to match. |
143 | if (memcmp(RuleIdentifier.data()+0, "trunc_lshr_buildvector_fold" , 27) != 0) |
144 | break; |
145 | return 15; // "trunc_lshr_buildvector_fold" |
146 | } |
147 | #endif // ifndef NDEBUG |
148 | |
149 | return std::nullopt; |
150 | } |
151 | static std::optional<std::pair<uint64_t, uint64_t>> getRuleRangeForIdentifier(StringRef RuleIdentifier) { |
152 | std::pair<StringRef, StringRef> RangePair = RuleIdentifier.split('-'); |
153 | if (!RangePair.second.empty()) { |
154 | const auto First = getRuleIdxForIdentifier(RangePair.first); |
155 | const auto Last = getRuleIdxForIdentifier(RangePair.second); |
156 | if (!First || !Last) |
157 | return std::nullopt; |
158 | if (First >= Last) |
159 | report_fatal_error("Beginning of range should be before end of range" ); |
160 | return {{*First, *Last + 1}}; |
161 | } |
162 | if (RangePair.first == "*" ) { |
163 | return {{0, 20}}; |
164 | } |
165 | const auto I = getRuleIdxForIdentifier(RangePair.first); |
166 | if (!I) |
167 | return std::nullopt; |
168 | return {{*I, *I + 1}}; |
169 | } |
170 | |
171 | bool RISCVPostLegalizerCombinerImplRuleConfig::setRuleEnabled(StringRef RuleIdentifier) { |
172 | auto MaybeRange = getRuleRangeForIdentifier(RuleIdentifier); |
173 | if (!MaybeRange) |
174 | return false; |
175 | for (auto I = MaybeRange->first; I < MaybeRange->second; ++I) |
176 | DisabledRules.reset(I); |
177 | return true; |
178 | } |
179 | |
180 | bool RISCVPostLegalizerCombinerImplRuleConfig::setRuleDisabled(StringRef RuleIdentifier) { |
181 | auto MaybeRange = getRuleRangeForIdentifier(RuleIdentifier); |
182 | if (!MaybeRange) |
183 | return false; |
184 | for (auto I = MaybeRange->first; I < MaybeRange->second; ++I) |
185 | DisabledRules.set(I); |
186 | return true; |
187 | } |
188 | |
189 | static std::vector<std::string> RISCVPostLegalizerCombinerOption; |
190 | static cl::list<std::string> RISCVPostLegalizerCombinerDisableOption( |
191 | "riscvpostlegalizercombiner-disable-rule" , |
192 | cl::desc("Disable one or more combiner rules temporarily in the RISCVPostLegalizerCombiner pass" ), |
193 | cl::CommaSeparated, |
194 | cl::Hidden, |
195 | cl::cat(GICombinerOptionCategory), |
196 | cl::callback([](const std::string &Str) { |
197 | RISCVPostLegalizerCombinerOption.push_back(Str); |
198 | })); |
199 | static cl::list<std::string> RISCVPostLegalizerCombinerOnlyEnableOption( |
200 | "riscvpostlegalizercombiner-only-enable-rule" , |
201 | cl::desc("Disable all rules in the RISCVPostLegalizerCombiner pass then re-enable the specified ones" ), |
202 | cl::Hidden, |
203 | cl::cat(GICombinerOptionCategory), |
204 | cl::callback([](const std::string &CommaSeparatedArg) { |
205 | StringRef Str = CommaSeparatedArg; |
206 | RISCVPostLegalizerCombinerOption.push_back("*" ); |
207 | do { |
208 | auto X = Str.split("," ); |
209 | RISCVPostLegalizerCombinerOption.push_back(("!" + X.first).str()); |
210 | Str = X.second; |
211 | } while (!Str.empty()); |
212 | })); |
213 | |
214 | |
215 | bool RISCVPostLegalizerCombinerImplRuleConfig::isRuleEnabled(unsigned RuleID) const { |
216 | return !DisabledRules.test(RuleID); |
217 | } |
218 | bool RISCVPostLegalizerCombinerImplRuleConfig::parseCommandLineOption() { |
219 | for (StringRef Identifier : RISCVPostLegalizerCombinerOption) { |
220 | bool Enabled = Identifier.consume_front("!" ); |
221 | if (Enabled && !setRuleEnabled(Identifier)) |
222 | return false; |
223 | if (!Enabled && !setRuleDisabled(Identifier)) |
224 | return false; |
225 | } |
226 | return true; |
227 | } |
228 | |
229 | #endif // ifdef GET_GICOMBINER_TYPES |
230 | |
231 | #ifdef GET_GICOMBINER_TYPES |
232 | const unsigned MAX_SUBTARGET_PREDICATES = 0; |
233 | using PredicateBitset = llvm::Bitset<MAX_SUBTARGET_PREDICATES>; |
234 | #endif // ifdef GET_GICOMBINER_TYPES |
235 | |
236 | #ifdef GET_GICOMBINER_CLASS_MEMBERS |
237 | PredicateBitset AvailableModuleFeatures; |
238 | mutable PredicateBitset AvailableFunctionFeatures; |
239 | PredicateBitset getAvailableFeatures() const { |
240 | return AvailableModuleFeatures | AvailableFunctionFeatures; |
241 | } |
242 | PredicateBitset |
243 | computeAvailableModuleFeatures(const RISCVSubtarget *Subtarget) const; |
244 | PredicateBitset |
245 | computeAvailableFunctionFeatures(const RISCVSubtarget *Subtarget, |
246 | const MachineFunction *MF) const; |
247 | void setupGeneratedPerFunctionState(MachineFunction &MF) override; |
248 | #endif // ifdef GET_GICOMBINER_CLASS_MEMBERS |
249 | #ifdef GET_GICOMBINER_CLASS_MEMBERS |
250 | mutable MatcherState State; |
251 | typedef ComplexRendererFns(RISCVPostLegalizerCombinerImpl::*ComplexMatcherMemFn)(MachineOperand &) const; |
252 | typedef void(RISCVPostLegalizerCombinerImpl::*CustomRendererFn)(MachineInstrBuilder &, const MachineInstr &, int) const; |
253 | const ExecInfoTy<PredicateBitset, ComplexMatcherMemFn, CustomRendererFn> ExecInfo; |
254 | static RISCVPostLegalizerCombinerImpl::ComplexMatcherMemFn ComplexPredicateFns[]; |
255 | static RISCVPostLegalizerCombinerImpl::CustomRendererFn CustomRenderers[]; |
256 | bool testImmPredicate_I64(unsigned PredicateID, int64_t Imm) const override; |
257 | bool testImmPredicate_APInt(unsigned PredicateID, const APInt &Imm) const override; |
258 | bool testImmPredicate_APFloat(unsigned PredicateID, const APFloat &Imm) const override; |
259 | const uint8_t *getMatchTable() const override; |
260 | bool testMIPredicate_MI(unsigned PredicateID, const MachineInstr &MI, const MatcherState &State) const override; |
261 | bool testSimplePredicate(unsigned PredicateID) const override; |
262 | bool runCustomAction(unsigned FnID, const MatcherState &State, NewMIVector &OutMIs) const override; |
263 | #endif // ifdef GET_GICOMBINER_CLASS_MEMBERS |
264 | |
265 | #ifdef GET_GICOMBINER_IMPL |
266 | // LLT Objects. |
267 | enum { |
268 | GILLT_s1, |
269 | }; |
270 | const static size_t NumTypeObjects = 1; |
271 | const static LLT TypeObjects[] = { |
272 | LLT::scalar(1), |
273 | }; |
274 | |
275 | // Bits for subtarget features that participate in instruction matching. |
276 | enum SubtargetFeatureBits : uint8_t { |
277 | }; |
278 | |
279 | PredicateBitset RISCVPostLegalizerCombinerImpl:: |
280 | computeAvailableModuleFeatures(const RISCVSubtarget *Subtarget) const { |
281 | PredicateBitset Features{}; |
282 | return Features; |
283 | } |
284 | |
285 | void RISCVPostLegalizerCombinerImpl::setupGeneratedPerFunctionState(MachineFunction &MF) { |
286 | AvailableFunctionFeatures = computeAvailableFunctionFeatures((const RISCVSubtarget *)&MF.getSubtarget(), &MF); |
287 | } |
288 | PredicateBitset RISCVPostLegalizerCombinerImpl:: |
289 | computeAvailableFunctionFeatures(const RISCVSubtarget *Subtarget, const MachineFunction *MF) const { |
290 | PredicateBitset Features{}; |
291 | return Features; |
292 | } |
293 | |
294 | // Feature bitsets. |
295 | enum { |
296 | GIFBS_Invalid, |
297 | }; |
298 | constexpr static PredicateBitset FeatureBitsets[] { |
299 | {}, // GIFBS_Invalid |
300 | }; |
301 | |
302 | // ComplexPattern predicates. |
303 | enum { |
304 | GICP_Invalid, |
305 | }; |
306 | // See constructor for table contents |
307 | |
308 | RISCVPostLegalizerCombinerImpl::ComplexMatcherMemFn |
309 | RISCVPostLegalizerCombinerImpl::ComplexPredicateFns[] = { |
310 | nullptr, // GICP_Invalid |
311 | }; |
312 | |
313 | enum { |
314 | GICXXPred_MI_Predicate_GICombiner0 = GICXXPred_Invalid + 1, |
315 | GICXXPred_MI_Predicate_GICombiner1, |
316 | GICXXPred_MI_Predicate_GICombiner2, |
317 | }; |
318 | bool RISCVPostLegalizerCombinerImpl::testMIPredicate_MI(unsigned PredicateID, const MachineInstr & MI, const MatcherState &State) const { |
319 | switch (PredicateID) { |
320 | case GICXXPred_MI_Predicate_GICombiner0: { |
321 | return Helper.matchConstantFPOp(State.MIs[0]->getOperand(2), 1.0); |
322 | } |
323 | case GICXXPred_MI_Predicate_GICombiner1: { |
324 | return Helper.matchConstantFPOp(State.MIs[0]->getOperand(2), -0.0); |
325 | } |
326 | case GICXXPred_MI_Predicate_GICombiner2: { |
327 | return Helper.matchConstantFPOp(State.MIs[0]->getOperand(2), -1.0); |
328 | } |
329 | } |
330 | llvm_unreachable("Unknown predicate" ); |
331 | return false; |
332 | } |
333 | bool RISCVPostLegalizerCombinerImpl::testImmPredicate_I64(unsigned PredicateID, int64_t Imm) const { |
334 | llvm_unreachable("Unknown predicate" ); |
335 | return false; |
336 | } |
337 | bool RISCVPostLegalizerCombinerImpl::testImmPredicate_APFloat(unsigned PredicateID, const APFloat & Imm) const { |
338 | llvm_unreachable("Unknown predicate" ); |
339 | return false; |
340 | } |
341 | bool RISCVPostLegalizerCombinerImpl::testImmPredicate_APInt(unsigned PredicateID, const APInt & Imm) const { |
342 | llvm_unreachable("Unknown predicate" ); |
343 | return false; |
344 | } |
345 | enum { |
346 | GICXXPred_Simple_IsRule0Enabled = GICXXPred_Invalid + 1, |
347 | GICXXPred_Simple_IsRule1Enabled, |
348 | GICXXPred_Simple_IsRule2Enabled, |
349 | GICXXPred_Simple_IsRule3Enabled, |
350 | GICXXPred_Simple_IsRule4Enabled, |
351 | GICXXPred_Simple_IsRule5Enabled, |
352 | GICXXPred_Simple_IsRule6Enabled, |
353 | GICXXPred_Simple_IsRule7Enabled, |
354 | GICXXPred_Simple_IsRule8Enabled, |
355 | GICXXPred_Simple_IsRule9Enabled, |
356 | GICXXPred_Simple_IsRule10Enabled, |
357 | GICXXPred_Simple_IsRule11Enabled, |
358 | GICXXPred_Simple_IsRule12Enabled, |
359 | GICXXPred_Simple_IsRule13Enabled, |
360 | GICXXPred_Simple_IsRule14Enabled, |
361 | GICXXPred_Simple_IsRule15Enabled, |
362 | GICXXPred_Simple_IsRule16Enabled, |
363 | GICXXPred_Simple_IsRule17Enabled, |
364 | GICXXPred_Simple_IsRule18Enabled, |
365 | GICXXPred_Simple_IsRule19Enabled, |
366 | }; |
367 | |
368 | bool RISCVPostLegalizerCombinerImpl::testSimplePredicate(unsigned Predicate) const { |
369 | return RuleConfig.isRuleEnabled(Predicate - GICXXPred_Invalid - 1); |
370 | } |
371 | // Custom renderers. |
372 | enum { |
373 | GICR_Invalid, |
374 | }; |
375 | RISCVPostLegalizerCombinerImpl::CustomRendererFn |
376 | RISCVPostLegalizerCombinerImpl::CustomRenderers[] = { |
377 | nullptr, // GICR_Invalid |
378 | }; |
379 | |
380 | bool RISCVPostLegalizerCombinerImpl::tryCombineAll(MachineInstr &I) const { |
381 | const TargetSubtargetInfo &ST = MF.getSubtarget(); |
382 | const PredicateBitset AvailableFeatures = getAvailableFeatures(); |
383 | B.setInstrAndDebugLoc(I); |
384 | State.MIs.clear(); |
385 | State.MIs.push_back(&I); |
386 | if (executeMatchTable(*this, State, ExecInfo, B, getMatchTable(), *ST.getInstrInfo(), MRI, *MRI.getTargetRegisterInfo(), *ST.getRegBankInfo(), AvailableFeatures, /*CoverageInfo*/ nullptr)) { |
387 | return true; |
388 | } |
389 | |
390 | return false; |
391 | } |
392 | |
393 | enum { |
394 | GICXXCustomAction_GICombiner0 = GICXXCustomAction_Invalid + 1, |
395 | GICXXCustomAction_GICombiner1, |
396 | GICXXCustomAction_GICombiner2, |
397 | GICXXCustomAction_GICombiner3, |
398 | GICXXCustomAction_GICombiner4, |
399 | GICXXCustomAction_GICombiner5, |
400 | GICXXCustomAction_GICombiner6, |
401 | GICXXCustomAction_GICombiner7, |
402 | GICXXCustomAction_GICombiner8, |
403 | GICXXCustomAction_GICombiner9, |
404 | }; |
405 | bool RISCVPostLegalizerCombinerImpl::runCustomAction(unsigned ApplyID, const MatcherState &State, NewMIVector &OutMIs) const { |
406 | Helper.getBuilder().setInstrAndDebugLoc(*State.MIs[0]); |
407 | switch(ApplyID) { |
408 | case GICXXCustomAction_GICombiner0:{ |
409 | Register GIMatchData_matchinfo; |
410 | // Match Patterns |
411 | if(![&](){return Helper.matchRedundantAnd(*State.MIs[0], GIMatchData_matchinfo);}()) { |
412 | return false; |
413 | } |
414 | // Apply Patterns |
415 | Helper.replaceSingleDefInstWithReg(*State.MIs[0], GIMatchData_matchinfo); |
416 | return true; |
417 | } |
418 | case GICXXCustomAction_GICombiner1:{ |
419 | // Match Patterns |
420 | if(![&](){return Helper.matchSelectSameVal(*State.MIs[0]);}()) { |
421 | return false; |
422 | } |
423 | // Apply Patterns |
424 | Helper.replaceSingleDefInstWithOperand(*State.MIs[0], 2); |
425 | return true; |
426 | } |
427 | case GICXXCustomAction_GICombiner2:{ |
428 | // Match Patterns |
429 | if(![&](){return Helper.matchOperandIsZero(*State.MIs[0], 1);}()) { |
430 | return false; |
431 | } |
432 | // Apply Patterns |
433 | Helper.replaceSingleDefInstWithOperand(*State.MIs[0], 1); |
434 | return true; |
435 | } |
436 | case GICXXCustomAction_GICombiner3:{ |
437 | Register GIMatchData_info; |
438 | // Match Patterns |
439 | if(![&](){return Helper.matchCombineI2PToP2I(*State.MIs[0], GIMatchData_info);}()) { |
440 | return false; |
441 | } |
442 | // Apply Patterns |
443 | Helper.applyCombineI2PToP2I(*State.MIs[0], GIMatchData_info); |
444 | return true; |
445 | } |
446 | case GICXXCustomAction_GICombiner4:{ |
447 | Register GIMatchData_info; |
448 | // Match Patterns |
449 | if(![&](){GIMatchData_info = State.MIs[1]->getOperand(1).getReg(); return true;}()) { |
450 | return false; |
451 | } |
452 | // Apply Patterns |
453 | Helper.applyCombineP2IToI2P(*State.MIs[0], GIMatchData_info); |
454 | return true; |
455 | } |
456 | case GICXXCustomAction_GICombiner5:{ |
457 | Register GIMatchData_matchinfo; |
458 | // Match Patterns |
459 | if(![&](){return Helper.matchCombineAnyExtTrunc(*State.MIs[0], GIMatchData_matchinfo);}()) { |
460 | return false; |
461 | } |
462 | // Apply Patterns |
463 | Helper.replaceSingleDefInstWithReg(*State.MIs[0], GIMatchData_matchinfo); |
464 | return true; |
465 | } |
466 | case GICXXCustomAction_GICombiner6:{ |
467 | Register GIMatchData_matchinfo; |
468 | // Match Patterns |
469 | if(![&](){return Helper.matchBuildVectorIdentityFold(*State.MIs[0], GIMatchData_matchinfo);}()) { |
470 | return false; |
471 | } |
472 | // Apply Patterns |
473 | Helper.replaceSingleDefInstWithReg(*State.MIs[0], GIMatchData_matchinfo); |
474 | return true; |
475 | } |
476 | case GICXXCustomAction_GICombiner7:{ |
477 | Register GIMatchData_matchinfo; |
478 | // Match Patterns |
479 | if(![&](){return Helper.matchTruncBuildVectorFold(*State.MIs[0], GIMatchData_matchinfo);}()) { |
480 | return false; |
481 | } |
482 | // Apply Patterns |
483 | Helper.replaceSingleDefInstWithReg(*State.MIs[0], GIMatchData_matchinfo); |
484 | return true; |
485 | } |
486 | case GICXXCustomAction_GICombiner8:{ |
487 | Register GIMatchData_matchinfo; |
488 | // Match Patterns |
489 | if(![&](){return Helper.matchTruncLshrBuildVectorFold(*State.MIs[0], GIMatchData_matchinfo);}()) { |
490 | return false; |
491 | } |
492 | // Apply Patterns |
493 | Helper.replaceSingleDefInstWithReg(*State.MIs[0], GIMatchData_matchinfo); |
494 | return true; |
495 | } |
496 | case GICXXCustomAction_GICombiner9:{ |
497 | // Match Patterns |
498 | if(![&](){return MRI.getType(State.MIs[1]->getOperand(1).getReg()) == MRI.getType(State.MIs[0]->getOperand(0).getReg());}()) { |
499 | return false; |
500 | } |
501 | // Apply Patterns |
502 | Helper.replaceSingleDefInstWithReg(*State.MIs[0], State.MIs[1]->getOperand(1).getReg()); |
503 | return true; |
504 | } |
505 | } |
506 | llvm_unreachable("Unknown Apply Action" ); |
507 | } |
508 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
509 | #define GIMT_Encode2(Val) uint8_t(Val), uint8_t((uint16_t)Val >> 8) |
510 | #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) |
511 | #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) |
512 | #else |
513 | #define GIMT_Encode2(Val) uint8_t((uint16_t)Val >> 8), uint8_t(Val) |
514 | #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) |
515 | #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) |
516 | #endif |
517 | const uint8_t *RISCVPostLegalizerCombinerImpl::getMatchTable() const { |
518 | constexpr static uint8_t MatchTable0[] = { |
519 | GIM_SwitchOpcode, /*MI*/0, /*[*/GIMT_Encode2(51), GIMT_Encode2(213), /*)*//*default:*//*Label 28*/ GIMT_Encode4(1368), |
520 | /*TargetOpcode::G_ADD*//*Label 0*/ GIMT_Encode4(658), |
521 | /*TargetOpcode::G_SUB*//*Label 1*/ GIMT_Encode4(750), |
522 | /*TargetOpcode::G_MUL*//*Label 2*/ GIMT_Encode4(774), |
523 | /*TargetOpcode::G_SDIV*//*Label 3*/ GIMT_Encode4(821), |
524 | /*TargetOpcode::G_UDIV*//*Label 4*/ GIMT_Encode4(833), |
525 | /*TargetOpcode::G_SREM*//*Label 5*/ GIMT_Encode4(845), |
526 | /*TargetOpcode::G_UREM*//*Label 6*/ GIMT_Encode4(857), GIMT_Encode4(0), GIMT_Encode4(0), |
527 | /*TargetOpcode::G_AND*//*Label 7*/ GIMT_Encode4(869), |
528 | /*TargetOpcode::G_OR*//*Label 8*/ GIMT_Encode4(905), |
529 | /*TargetOpcode::G_XOR*//*Label 9*/ GIMT_Encode4(953), 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), |
530 | /*TargetOpcode::G_BUILD_VECTOR*//*Label 10*/ GIMT_Encode4(977), |
531 | /*TargetOpcode::G_BUILD_VECTOR_TRUNC*//*Label 11*/ GIMT_Encode4(989), GIMT_Encode4(0), |
532 | /*TargetOpcode::G_PTRTOINT*//*Label 12*/ GIMT_Encode4(1001), |
533 | /*TargetOpcode::G_INTTOPTR*//*Label 13*/ GIMT_Encode4(1023), |
534 | /*TargetOpcode::G_BITCAST*//*Label 14*/ GIMT_Encode4(1035), 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), |
535 | /*TargetOpcode::G_ANYEXT*//*Label 15*/ GIMT_Encode4(1057), |
536 | /*TargetOpcode::G_TRUNC*//*Label 16*/ GIMT_Encode4(1069), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), |
537 | /*TargetOpcode::G_SHL*//*Label 17*/ GIMT_Encode4(1092), |
538 | /*TargetOpcode::G_LSHR*//*Label 18*/ GIMT_Encode4(1116), |
539 | /*TargetOpcode::G_ASHR*//*Label 19*/ GIMT_Encode4(1140), GIMT_Encode4(0), GIMT_Encode4(0), |
540 | /*TargetOpcode::G_ROTR*//*Label 20*/ GIMT_Encode4(1164), |
541 | /*TargetOpcode::G_ROTL*//*Label 21*/ GIMT_Encode4(1188), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), |
542 | /*TargetOpcode::G_SELECT*//*Label 22*/ GIMT_Encode4(1212), 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), |
543 | /*TargetOpcode::G_FADD*//*Label 23*/ GIMT_Encode4(1224), GIMT_Encode4(0), |
544 | /*TargetOpcode::G_FMUL*//*Label 24*/ GIMT_Encode4(1248), 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), |
545 | /*TargetOpcode::G_FNEG*//*Label 25*/ GIMT_Encode4(1292), GIMT_Encode4(0), |
546 | /*TargetOpcode::G_FPTRUNC*//*Label 26*/ GIMT_Encode4(1322), 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), |
547 | /*TargetOpcode::G_PTR_ADD*//*Label 27*/ GIMT_Encode4(1344), |
548 | // Label 0: @658 |
549 | GIM_Try, /*On fail goto*//*Label 29*/ GIMT_Encode4(692), // Rule ID 26 // |
550 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule12Enabled), |
551 | // MIs[0] dst |
552 | // No operand predicates |
553 | // MIs[0] __add_sub_reg_match_0.tmp |
554 | GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1] |
555 | GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_SUB), |
556 | // MIs[1] src |
557 | // No operand predicates |
558 | // MIs[1] __add_sub_reg_match_0.x |
559 | // No operand predicates |
560 | // MIs[0] __add_sub_reg_match_0.x |
561 | GIM_CheckIsSameOperandIgnoreCopies, /*MI*/0, /*OpIdx*/2, /*OtherMI*/1, /*OtherOpIdx*/2, |
562 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/1, /*NewOpIdx*/1, |
563 | GIM_CheckIsSafeToFold, /*NumInsns*/1, |
564 | // Combiner Rule #12: add_sub_reg @ [__add_sub_reg_match_0[1]] |
565 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/1, /*NewOpIdx*/1, |
566 | GIR_EraseRootFromParent_Done, |
567 | // Label 29: @692 |
568 | GIM_Try, /*On fail goto*//*Label 30*/ GIMT_Encode4(726), // Rule ID 25 // |
569 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule12Enabled), |
570 | // MIs[0] dst |
571 | // No operand predicates |
572 | // MIs[0] __add_sub_reg_match_0.x |
573 | // No operand predicates |
574 | // MIs[0] __add_sub_reg_match_0.tmp |
575 | GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/2, // MIs[1] |
576 | GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_SUB), |
577 | // MIs[1] src |
578 | // No operand predicates |
579 | // MIs[1] __add_sub_reg_match_0.x |
580 | GIM_CheckIsSameOperandIgnoreCopies, /*MI*/1, /*OpIdx*/2, /*OtherMI*/0, /*OtherOpIdx*/1, |
581 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/1, /*NewOpIdx*/1, |
582 | GIM_CheckIsSafeToFold, /*NumInsns*/1, |
583 | // Combiner Rule #12: add_sub_reg @ [__add_sub_reg_match_0[0]] |
584 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/1, /*NewOpIdx*/1, |
585 | GIR_EraseRootFromParent_Done, |
586 | // Label 30: @726 |
587 | GIM_Try, /*On fail goto*//*Label 31*/ GIMT_Encode4(749), // Rule ID 3 // |
588 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled), |
589 | // MIs[0] dst |
590 | // No operand predicates |
591 | // MIs[0] lhs |
592 | // No operand predicates |
593 | // MIs[0] Operand 2 |
594 | GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, 0, |
595 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
596 | // Combiner Rule #2: right_identity_zero @ [__right_identity_zero_match_0[1]] |
597 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
598 | GIR_EraseRootFromParent_Done, |
599 | // Label 31: @749 |
600 | GIM_Reject, |
601 | // Label 1: @750 |
602 | GIM_Try, /*On fail goto*//*Label 32*/ GIMT_Encode4(773), // Rule ID 2 // |
603 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled), |
604 | // MIs[0] dst |
605 | // No operand predicates |
606 | // MIs[0] lhs |
607 | // No operand predicates |
608 | // MIs[0] Operand 2 |
609 | GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, 0, |
610 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
611 | // Combiner Rule #2: right_identity_zero @ [__right_identity_zero_match_0[0]] |
612 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
613 | GIR_EraseRootFromParent_Done, |
614 | // Label 32: @773 |
615 | GIM_Reject, |
616 | // Label 2: @774 |
617 | GIM_Try, /*On fail goto*//*Label 33*/ GIMT_Encode4(797), // Rule ID 18 // |
618 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule5Enabled), |
619 | // MIs[0] dst |
620 | // No operand predicates |
621 | // MIs[0] lhs |
622 | // No operand predicates |
623 | // MIs[0] zero |
624 | GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, 0, |
625 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/2, |
626 | // Combiner Rule #5: binop_right_to_zero |
627 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/2, |
628 | GIR_EraseRootFromParent_Done, |
629 | // Label 33: @797 |
630 | GIM_Try, /*On fail goto*//*Label 34*/ GIMT_Encode4(820), // Rule ID 23 // |
631 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule10Enabled), |
632 | // MIs[0] dst |
633 | // No operand predicates |
634 | // MIs[0] x |
635 | // No operand predicates |
636 | // MIs[0] Operand 2 |
637 | GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, 1, |
638 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
639 | // Combiner Rule #10: right_identity_one_int |
640 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
641 | GIR_EraseRootFromParent_Done, |
642 | // Label 34: @820 |
643 | GIM_Reject, |
644 | // Label 3: @821 |
645 | GIM_Try, /*On fail goto*//*Label 35*/ GIMT_Encode4(832), // Rule ID 14 // |
646 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule4Enabled), |
647 | // Combiner Rule #4: binop_left_to_zero; wip_match_opcode 'G_SDIV' |
648 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner2), |
649 | // Label 35: @832 |
650 | GIM_Reject, |
651 | // Label 4: @833 |
652 | GIM_Try, /*On fail goto*//*Label 36*/ GIMT_Encode4(844), // Rule ID 15 // |
653 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule4Enabled), |
654 | // Combiner Rule #4: binop_left_to_zero; wip_match_opcode 'G_UDIV' |
655 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner2), |
656 | // Label 36: @844 |
657 | GIM_Reject, |
658 | // Label 5: @845 |
659 | GIM_Try, /*On fail goto*//*Label 37*/ GIMT_Encode4(856), // Rule ID 16 // |
660 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule4Enabled), |
661 | // Combiner Rule #4: binop_left_to_zero; wip_match_opcode 'G_SREM' |
662 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner2), |
663 | // Label 37: @856 |
664 | GIM_Reject, |
665 | // Label 6: @857 |
666 | GIM_Try, /*On fail goto*//*Label 38*/ GIMT_Encode4(868), // Rule ID 17 // |
667 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule4Enabled), |
668 | // Combiner Rule #4: binop_left_to_zero; wip_match_opcode 'G_UREM' |
669 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner2), |
670 | // Label 38: @868 |
671 | GIM_Reject, |
672 | // Label 7: @869 |
673 | GIM_Try, /*On fail goto*//*Label 39*/ GIMT_Encode4(880), // Rule ID 0 // |
674 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled), |
675 | // Combiner Rule #0: redundant_and; wip_match_opcode 'G_AND' |
676 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner0), |
677 | // Label 39: @880 |
678 | GIM_Try, /*On fail goto*//*Label 40*/ GIMT_Encode4(904), // Rule ID 12 // |
679 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule3Enabled), |
680 | // MIs[0] dst |
681 | // No operand predicates |
682 | // MIs[0] src |
683 | // No operand predicates |
684 | // MIs[0] src |
685 | GIM_CheckIsSameOperandIgnoreCopies, /*MI*/0, /*OpIdx*/2, /*OtherMI*/0, /*OtherOpIdx*/1, |
686 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
687 | // Combiner Rule #3: binop_same_val @ [__binop_same_val_match_0[0]] |
688 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
689 | GIR_EraseRootFromParent_Done, |
690 | // Label 40: @904 |
691 | GIM_Reject, |
692 | // Label 8: @905 |
693 | GIM_Try, /*On fail goto*//*Label 41*/ GIMT_Encode4(929), // Rule ID 13 // |
694 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule3Enabled), |
695 | // MIs[0] dst |
696 | // No operand predicates |
697 | // MIs[0] src |
698 | // No operand predicates |
699 | // MIs[0] src |
700 | GIM_CheckIsSameOperandIgnoreCopies, /*MI*/0, /*OpIdx*/2, /*OtherMI*/0, /*OtherOpIdx*/1, |
701 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
702 | // Combiner Rule #3: binop_same_val @ [__binop_same_val_match_0[1]] |
703 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
704 | GIR_EraseRootFromParent_Done, |
705 | // Label 41: @929 |
706 | GIM_Try, /*On fail goto*//*Label 42*/ GIMT_Encode4(952), // Rule ID 4 // |
707 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled), |
708 | // MIs[0] dst |
709 | // No operand predicates |
710 | // MIs[0] lhs |
711 | // No operand predicates |
712 | // MIs[0] Operand 2 |
713 | GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, 0, |
714 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
715 | // Combiner Rule #2: right_identity_zero @ [__right_identity_zero_match_0[2]] |
716 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
717 | GIR_EraseRootFromParent_Done, |
718 | // Label 42: @952 |
719 | GIM_Reject, |
720 | // Label 9: @953 |
721 | GIM_Try, /*On fail goto*//*Label 43*/ GIMT_Encode4(976), // Rule ID 5 // |
722 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled), |
723 | // MIs[0] dst |
724 | // No operand predicates |
725 | // MIs[0] lhs |
726 | // No operand predicates |
727 | // MIs[0] Operand 2 |
728 | GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, 0, |
729 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
730 | // Combiner Rule #2: right_identity_zero @ [__right_identity_zero_match_0[3]] |
731 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
732 | GIR_EraseRootFromParent_Done, |
733 | // Label 43: @976 |
734 | GIM_Reject, |
735 | // Label 10: @977 |
736 | GIM_Try, /*On fail goto*//*Label 44*/ GIMT_Encode4(988), // Rule ID 28 // |
737 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule13Enabled), |
738 | // Combiner Rule #13: buildvector_identity_fold; wip_match_opcode 'G_BUILD_VECTOR' |
739 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner6), |
740 | // Label 44: @988 |
741 | GIM_Reject, |
742 | // Label 11: @989 |
743 | GIM_Try, /*On fail goto*//*Label 45*/ GIMT_Encode4(1000), // Rule ID 27 // |
744 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule13Enabled), |
745 | // Combiner Rule #13: buildvector_identity_fold; wip_match_opcode 'G_BUILD_VECTOR_TRUNC' |
746 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner6), |
747 | // Label 45: @1000 |
748 | GIM_Reject, |
749 | // Label 12: @1001 |
750 | GIM_Try, /*On fail goto*//*Label 46*/ GIMT_Encode4(1022), // Rule ID 20 // |
751 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule7Enabled), |
752 | // MIs[0] dst |
753 | // No operand predicates |
754 | // MIs[0] t |
755 | GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1] |
756 | GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_INTTOPTR), |
757 | // MIs[1] ptr |
758 | // No operand predicates |
759 | GIM_CheckIsSafeToFold, /*NumInsns*/1, |
760 | // Combiner Rule #7: i2p_to_p2i |
761 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner4), |
762 | // Label 46: @1022 |
763 | GIM_Reject, |
764 | // Label 13: @1023 |
765 | GIM_Try, /*On fail goto*//*Label 47*/ GIMT_Encode4(1034), // Rule ID 19 // |
766 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule6Enabled), |
767 | // Combiner Rule #6: p2i_to_i2p; wip_match_opcode 'G_INTTOPTR' |
768 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner3), |
769 | // Label 47: @1034 |
770 | GIM_Reject, |
771 | // Label 14: @1035 |
772 | GIM_Try, /*On fail goto*//*Label 48*/ GIMT_Encode4(1056), // Rule ID 31 // |
773 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule16Enabled), |
774 | // MIs[0] dst |
775 | // No operand predicates |
776 | // MIs[0] src1 |
777 | GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1] |
778 | GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_BITCAST), |
779 | // MIs[1] src0 |
780 | // No operand predicates |
781 | GIM_CheckIsSafeToFold, /*NumInsns*/1, |
782 | // Combiner Rule #16: bitcast_bitcast_fold |
783 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner9), |
784 | // Label 48: @1056 |
785 | GIM_Reject, |
786 | // Label 15: @1057 |
787 | GIM_Try, /*On fail goto*//*Label 49*/ GIMT_Encode4(1068), // Rule ID 21 // |
788 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule8Enabled), |
789 | // Combiner Rule #8: anyext_trunc_fold; wip_match_opcode 'G_ANYEXT' |
790 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner5), |
791 | // Label 49: @1068 |
792 | GIM_Reject, |
793 | // Label 16: @1069 |
794 | GIM_Try, /*On fail goto*//*Label 50*/ GIMT_Encode4(1080), // Rule ID 29 // |
795 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule14Enabled), |
796 | // Combiner Rule #14: trunc_buildvector_fold; wip_match_opcode 'G_TRUNC' |
797 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner7), |
798 | // Label 50: @1080 |
799 | GIM_Try, /*On fail goto*//*Label 51*/ GIMT_Encode4(1091), // Rule ID 30 // |
800 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule15Enabled), |
801 | // Combiner Rule #15: trunc_lshr_buildvector_fold; wip_match_opcode 'G_TRUNC' |
802 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner8), |
803 | // Label 51: @1091 |
804 | GIM_Reject, |
805 | // Label 17: @1092 |
806 | GIM_Try, /*On fail goto*//*Label 52*/ GIMT_Encode4(1115), // Rule ID 6 // |
807 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled), |
808 | // MIs[0] dst |
809 | // No operand predicates |
810 | // MIs[0] lhs |
811 | // No operand predicates |
812 | // MIs[0] Operand 2 |
813 | GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, 0, |
814 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
815 | // Combiner Rule #2: right_identity_zero @ [__right_identity_zero_match_0[4]] |
816 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
817 | GIR_EraseRootFromParent_Done, |
818 | // Label 52: @1115 |
819 | GIM_Reject, |
820 | // Label 18: @1116 |
821 | GIM_Try, /*On fail goto*//*Label 53*/ GIMT_Encode4(1139), // Rule ID 8 // |
822 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled), |
823 | // MIs[0] dst |
824 | // No operand predicates |
825 | // MIs[0] lhs |
826 | // No operand predicates |
827 | // MIs[0] Operand 2 |
828 | GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, 0, |
829 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
830 | // Combiner Rule #2: right_identity_zero @ [__right_identity_zero_match_0[6]] |
831 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
832 | GIR_EraseRootFromParent_Done, |
833 | // Label 53: @1139 |
834 | GIM_Reject, |
835 | // Label 19: @1140 |
836 | GIM_Try, /*On fail goto*//*Label 54*/ GIMT_Encode4(1163), // Rule ID 7 // |
837 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled), |
838 | // MIs[0] dst |
839 | // No operand predicates |
840 | // MIs[0] lhs |
841 | // No operand predicates |
842 | // MIs[0] Operand 2 |
843 | GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, 0, |
844 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
845 | // Combiner Rule #2: right_identity_zero @ [__right_identity_zero_match_0[5]] |
846 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
847 | GIR_EraseRootFromParent_Done, |
848 | // Label 54: @1163 |
849 | GIM_Reject, |
850 | // Label 20: @1164 |
851 | GIM_Try, /*On fail goto*//*Label 55*/ GIMT_Encode4(1187), // Rule ID 11 // |
852 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled), |
853 | // MIs[0] dst |
854 | // No operand predicates |
855 | // MIs[0] lhs |
856 | // No operand predicates |
857 | // MIs[0] Operand 2 |
858 | GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, 0, |
859 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
860 | // Combiner Rule #2: right_identity_zero @ [__right_identity_zero_match_0[9]] |
861 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
862 | GIR_EraseRootFromParent_Done, |
863 | // Label 55: @1187 |
864 | GIM_Reject, |
865 | // Label 21: @1188 |
866 | GIM_Try, /*On fail goto*//*Label 56*/ GIMT_Encode4(1211), // Rule ID 10 // |
867 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled), |
868 | // MIs[0] dst |
869 | // No operand predicates |
870 | // MIs[0] lhs |
871 | // No operand predicates |
872 | // MIs[0] Operand 2 |
873 | GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, 0, |
874 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
875 | // Combiner Rule #2: right_identity_zero @ [__right_identity_zero_match_0[8]] |
876 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
877 | GIR_EraseRootFromParent_Done, |
878 | // Label 56: @1211 |
879 | GIM_Reject, |
880 | // Label 22: @1212 |
881 | GIM_Try, /*On fail goto*//*Label 57*/ GIMT_Encode4(1223), // Rule ID 1 // |
882 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule1Enabled), |
883 | // Combiner Rule #1: select_same_val; wip_match_opcode 'G_SELECT' |
884 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner1), |
885 | // Label 57: @1223 |
886 | GIM_Reject, |
887 | // Label 23: @1224 |
888 | GIM_Try, /*On fail goto*//*Label 58*/ GIMT_Encode4(1247), // Rule ID 33 // |
889 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule18Enabled), |
890 | // MIs[0] dst |
891 | // No operand predicates |
892 | // MIs[0] x |
893 | // No operand predicates |
894 | // MIs[0] y |
895 | // No operand predicates |
896 | GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GIMT_Encode2(GICXXPred_MI_Predicate_GICombiner1), |
897 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
898 | // Combiner Rule #18: right_identity_neg_zero_fp |
899 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
900 | GIR_EraseRootFromParent_Done, |
901 | // Label 58: @1247 |
902 | GIM_Reject, |
903 | // Label 24: @1248 |
904 | GIM_Try, /*On fail goto*//*Label 59*/ GIMT_Encode4(1271), // Rule ID 24 // |
905 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule11Enabled), |
906 | // MIs[0] dst |
907 | // No operand predicates |
908 | // MIs[0] x |
909 | // No operand predicates |
910 | // MIs[0] y |
911 | // No operand predicates |
912 | GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GIMT_Encode2(GICXXPred_MI_Predicate_GICombiner0), |
913 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
914 | // Combiner Rule #11: right_identity_one_fp |
915 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
916 | GIR_EraseRootFromParent_Done, |
917 | // Label 59: @1271 |
918 | GIM_Try, /*On fail goto*//*Label 60*/ GIMT_Encode4(1291), // Rule ID 34 // |
919 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule19Enabled), |
920 | // MIs[0] dst |
921 | // No operand predicates |
922 | // MIs[0] x |
923 | // No operand predicates |
924 | // MIs[0] y |
925 | // No operand predicates |
926 | GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GIMT_Encode2(GICXXPred_MI_Predicate_GICombiner2), |
927 | // Combiner Rule #19: right_identity_neg_one_fp |
928 | GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::G_FNEG), |
929 | GIR_RootToRootCopy, /*OpIdx*/0, // dst |
930 | GIR_RootToRootCopy, /*OpIdx*/1, // x |
931 | GIR_EraseRootFromParent_Done, |
932 | // Label 60: @1291 |
933 | GIM_Reject, |
934 | // Label 25: @1292 |
935 | GIM_Try, /*On fail goto*//*Label 61*/ GIMT_Encode4(1321), // Rule ID 22 // |
936 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule9Enabled), |
937 | // MIs[0] dst |
938 | // No operand predicates |
939 | // MIs[0] t |
940 | GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1] |
941 | GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_FNEG), |
942 | // MIs[1] src |
943 | // No operand predicates |
944 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/1, /*NewOpIdx*/1, |
945 | GIM_CheckIsSafeToFold, /*NumInsns*/1, |
946 | // Combiner Rule #9: fneg_fneg_fold |
947 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/1, /*NewOpIdx*/1, |
948 | GIR_EraseRootFromParent_Done, |
949 | // Label 61: @1321 |
950 | GIM_Reject, |
951 | // Label 26: @1322 |
952 | GIM_Try, /*On fail goto*//*Label 62*/ GIMT_Encode4(1343), // Rule ID 32 // |
953 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule17Enabled), |
954 | // MIs[0] dst |
955 | // No operand predicates |
956 | // MIs[0] src1 |
957 | GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1] |
958 | GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_FPEXT), |
959 | // MIs[1] src0 |
960 | // No operand predicates |
961 | GIM_CheckIsSafeToFold, /*NumInsns*/1, |
962 | // Combiner Rule #17: fptrunc_fpext_fold |
963 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner9), |
964 | // Label 62: @1343 |
965 | GIM_Reject, |
966 | // Label 27: @1344 |
967 | GIM_Try, /*On fail goto*//*Label 63*/ GIMT_Encode4(1367), // Rule ID 9 // |
968 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled), |
969 | // MIs[0] dst |
970 | // No operand predicates |
971 | // MIs[0] lhs |
972 | // No operand predicates |
973 | // MIs[0] Operand 2 |
974 | GIM_CheckConstantInt8, /*MI*/0, /*Op*/2, 0, |
975 | GIM_CheckCanReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
976 | // Combiner Rule #2: right_identity_zero @ [__right_identity_zero_match_0[7]] |
977 | GIR_ReplaceReg, /*OldInsnID*/0, /*OldOpIdx*/0, /*NewInsnId*/0, /*NewOpIdx*/1, |
978 | GIR_EraseRootFromParent_Done, |
979 | // Label 63: @1367 |
980 | GIM_Reject, |
981 | // Label 28: @1368 |
982 | GIM_Reject, |
983 | }; // Size: 1369 bytes |
984 | return MatchTable0; |
985 | } |
986 | #undef GIMT_Encode2 |
987 | #undef GIMT_Encode4 |
988 | #undef GIMT_Encode8 |
989 | |
990 | #endif // ifdef GET_GICOMBINER_IMPL |
991 | |
992 | #ifdef GET_GICOMBINER_CONSTRUCTOR_INITS |
993 | AvailableModuleFeatures(computeAvailableModuleFeatures(&STI)), |
994 | AvailableFunctionFeatures() |
995 | #endif // ifdef GET_GICOMBINER_CONSTRUCTOR_INITS |
996 | #ifdef GET_GICOMBINER_CONSTRUCTOR_INITS |
997 | , State(0), |
998 | ExecInfo(TypeObjects, NumTypeObjects, FeatureBitsets, ComplexPredicateFns, CustomRenderers) |
999 | #endif // ifdef GET_GICOMBINER_CONSTRUCTOR_INITS |
1000 | |
1001 | |