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