llvm.org GIT mirror llvm / 0bfd526
[C++11] Add 'override' keywords to tablegen code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202937 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 5 years ago
6 changed file(s) with 481 addition(s) and 488 deletion(s). Raw diff Collapse all Expand all
149149
150150 static BitRecTy *get() { return &Shared; }
151151
152 virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; }
153 virtual Init *convertValue( BitInit *BI) { return (Init*)BI; }
154 virtual Init *convertValue( BitsInit *BI);
155 virtual Init *convertValue( IntInit *II);
156 virtual Init *convertValue(StringInit *SI) { return 0; }
157 virtual Init *convertValue( ListInit *LI) { return 0; }
158 virtual Init *convertValue(VarBitInit *VB) { return (Init*)VB; }
159 virtual Init *convertValue( DefInit *DI) { return 0; }
160 virtual Init *convertValue( DagInit *DI) { return 0; }
161 virtual Init *convertValue( UnOpInit *UI) { return RecTy::convertValue(UI);}
162 virtual Init *convertValue( BinOpInit *UI) { return RecTy::convertValue(UI);}
163 virtual Init *convertValue( TernOpInit *UI) { return RecTy::convertValue(UI);}
164 virtual Init *convertValue( TypedInit *TI);
165 virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
166 virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
167
168 virtual std::string getAsString() const { return "bit"; }
169
170 virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
152 Init *convertValue( UnsetInit *UI) override { return (Init*)UI; }
153 Init *convertValue( BitInit *BI) override { return (Init*)BI; }
154 Init *convertValue( BitsInit *BI) override;
155 Init *convertValue( IntInit *II) override;
156 Init *convertValue(StringInit *SI) override { return 0; }
157 Init *convertValue( ListInit *LI) override { return 0; }
158 Init *convertValue(VarBitInit *VB) override { return (Init*)VB; }
159 Init *convertValue( DefInit *DI) override { return 0; }
160 Init *convertValue( DagInit *DI) override { return 0; }
161 Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);}
162 Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);}
163 Init *convertValue( TernOpInit *UI) override {return RecTy::convertValue(UI);}
164 Init *convertValue( TypedInit *TI) override;
165 Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);}
166 Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);}
167
168 std::string getAsString() const override { return "bit"; }
169
170 bool typeIsConvertibleTo(const RecTy *RHS) const override {
171171 return RHS->baseClassOf(this);
172172 }
173 virtual bool baseClassOf(const RecTy*) const;
173 bool baseClassOf(const RecTy*) const override;
174174 };
175175
176176
188188
189189 unsigned getNumBits() const { return Size; }
190190
191 virtual Init *convertValue( UnsetInit *UI);
192 virtual Init *convertValue( BitInit *UI);
193 virtual Init *convertValue( BitsInit *BI);
194 virtual Init *convertValue( IntInit *II);
195 virtual Init *convertValue(StringInit *SI) { return 0; }
196 virtual Init *convertValue( ListInit *LI) { return 0; }
197 virtual Init *convertValue(VarBitInit *VB) { return 0; }
198 virtual Init *convertValue( DefInit *DI) { return 0; }
199 virtual Init *convertValue( DagInit *DI) { return 0; }
200 virtual Init *convertValue( UnOpInit *UI) { return RecTy::convertValue(UI);}
201 virtual Init *convertValue( BinOpInit *UI) { return RecTy::convertValue(UI);}
202 virtual Init *convertValue( TernOpInit *UI) { return RecTy::convertValue(UI);}
203 virtual Init *convertValue( TypedInit *TI);
204 virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
205 virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
206
207 virtual std::string getAsString() const;
208
209 virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
191 Init *convertValue( UnsetInit *UI) override;
192 Init *convertValue( BitInit *UI) override;
193 Init *convertValue( BitsInit *BI) override;
194 Init *convertValue( IntInit *II) override;
195 Init *convertValue(StringInit *SI) override { return 0; }
196 Init *convertValue( ListInit *LI) override { return 0; }
197 Init *convertValue(VarBitInit *VB) override { return 0; }
198 Init *convertValue( DefInit *DI) override { return 0; }
199 Init *convertValue( DagInit *DI) override { return 0; }
200 Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);}
201 Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);}
202 Init *convertValue( TernOpInit *UI) override {return RecTy::convertValue(UI);}
203 Init *convertValue( TypedInit *TI) override;
204 Init *convertValue( VarInit *VI) override{ return RecTy::convertValue(VI);}
205 Init *convertValue( FieldInit *FI) override{ return RecTy::convertValue(FI);}
206
207 std::string getAsString() const override;
208
209 bool typeIsConvertibleTo(const RecTy *RHS) const override{
210210 return RHS->baseClassOf(this);
211211 }
212 virtual bool baseClassOf(const RecTy*) const;
212 bool baseClassOf(const RecTy*) const override;
213213 };
214214
215215
225225
226226 static IntRecTy *get() { return &Shared; }
227227
228 virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; }
229 virtual Init *convertValue( BitInit *BI);
230 virtual Init *convertValue( BitsInit *BI);
231 virtual Init *convertValue( IntInit *II) { return (Init*)II; }
232 virtual Init *convertValue(StringInit *SI) { return 0; }
233 virtual Init *convertValue( ListInit *LI) { return 0; }
234 virtual Init *convertValue(VarBitInit *VB) { return 0; }
235 virtual Init *convertValue( DefInit *DI) { return 0; }
236 virtual Init *convertValue( DagInit *DI) { return 0; }
237 virtual Init *convertValue( UnOpInit *UI) { return RecTy::convertValue(UI);}
238 virtual Init *convertValue( BinOpInit *UI) { return RecTy::convertValue(UI);}
239 virtual Init *convertValue( TernOpInit *UI) { return RecTy::convertValue(UI);}
240 virtual Init *convertValue( TypedInit *TI);
241 virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
242 virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
243
244 virtual std::string getAsString() const { return "int"; }
245
246 virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
228 Init *convertValue( UnsetInit *UI) override { return (Init*)UI; }
229 Init *convertValue( BitInit *BI) override;
230 Init *convertValue( BitsInit *BI) override;
231 Init *convertValue( IntInit *II) override { return (Init*)II; }
232 Init *convertValue(StringInit *SI) override { return 0; }
233 Init *convertValue( ListInit *LI) override { return 0; }
234 Init *convertValue(VarBitInit *VB) override { return 0; }
235 Init *convertValue( DefInit *DI) override { return 0; }
236 Init *convertValue( DagInit *DI) override { return 0; }
237 Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);}
238 Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);}
239 Init *convertValue( TernOpInit *UI) override {return RecTy::convertValue(UI);}
240 Init *convertValue( TypedInit *TI) override;
241 Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);}
242 Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);}
243
244 std::string getAsString() const override { return "int"; }
245
246 bool typeIsConvertibleTo(const RecTy *RHS) const override {
247247 return RHS->baseClassOf(this);
248248 }
249249
250 virtual bool baseClassOf(const RecTy*) const;
250 bool baseClassOf(const RecTy*) const override;
251251 };
252252
253253 /// StringRecTy - 'string' - Represent an string value
262262
263263 static StringRecTy *get() { return &Shared; }
264264
265 virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; }
266 virtual Init *convertValue( BitInit *BI) { return 0; }
267 virtual Init *convertValue( BitsInit *BI) { return 0; }
268 virtual Init *convertValue( IntInit *II) { return 0; }
269 virtual Init *convertValue(StringInit *SI) { return (Init*)SI; }
270 virtual Init *convertValue( ListInit *LI) { return 0; }
271 virtual Init *convertValue( UnOpInit *BO);
272 virtual Init *convertValue( BinOpInit *BO);
273 virtual Init *convertValue( TernOpInit *BO) { return RecTy::convertValue(BO);}
274
275 virtual Init *convertValue(VarBitInit *VB) { return 0; }
276 virtual Init *convertValue( DefInit *DI) { return 0; }
277 virtual Init *convertValue( DagInit *DI) { return 0; }
278 virtual Init *convertValue( TypedInit *TI);
279 virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
280 virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
281
282 virtual std::string getAsString() const { return "string"; }
283
284 virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
265 Init *convertValue( UnsetInit *UI) override { return (Init*)UI; }
266 Init *convertValue( BitInit *BI) override { return 0; }
267 Init *convertValue( BitsInit *BI) override { return 0; }
268 Init *convertValue( IntInit *II) override { return 0; }
269 Init *convertValue(StringInit *SI) override { return (Init*)SI; }
270 Init *convertValue( ListInit *LI) override { return 0; }
271 Init *convertValue( UnOpInit *BO) override;
272 Init *convertValue( BinOpInit *BO) override;
273 Init *convertValue( TernOpInit *BO) override {return RecTy::convertValue(BO);}
274
275 Init *convertValue(VarBitInit *VB) override { return 0; }
276 Init *convertValue( DefInit *DI) override { return 0; }
277 Init *convertValue( DagInit *DI) override { return 0; }
278 Init *convertValue( TypedInit *TI) override;
279 Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);}
280 Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);}
281
282 std::string getAsString() const override { return "string"; }
283
284 bool typeIsConvertibleTo(const RecTy *RHS) const override {
285285 return RHS->baseClassOf(this);
286286 }
287287 };
301301 static ListRecTy *get(RecTy *T) { return T->getListTy(); }
302302 RecTy *getElementType() const { return Ty; }
303303
304 virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; }
305 virtual Init *convertValue( BitInit *BI) { return 0; }
306 virtual Init *convertValue( BitsInit *BI) { return 0; }
307 virtual Init *convertValue( IntInit *II) { return 0; }
308 virtual Init *convertValue(StringInit *SI) { return 0; }
309 virtual Init *convertValue( ListInit *LI);
310 virtual Init *convertValue(VarBitInit *VB) { return 0; }
311 virtual Init *convertValue( DefInit *DI) { return 0; }
312 virtual Init *convertValue( DagInit *DI) { return 0; }
313 virtual Init *convertValue( UnOpInit *UI) { return RecTy::convertValue(UI);}
314 virtual Init *convertValue( BinOpInit *UI) { return RecTy::convertValue(UI);}
315 virtual Init *convertValue( TernOpInit *UI) { return RecTy::convertValue(UI);}
316 virtual Init *convertValue( TypedInit *TI);
317 virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
318 virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
319
320 virtual std::string getAsString() const;
321
322 virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
304 Init *convertValue( UnsetInit *UI) override { return (Init*)UI; }
305 Init *convertValue( BitInit *BI) override { return 0; }
306 Init *convertValue( BitsInit *BI) override { return 0; }
307 Init *convertValue( IntInit *II) override { return 0; }
308 Init *convertValue(StringInit *SI) override { return 0; }
309 Init *convertValue( ListInit *LI) override;
310 Init *convertValue(VarBitInit *VB) override { return 0; }
311 Init *convertValue( DefInit *DI) override { return 0; }
312 Init *convertValue( DagInit *DI) override { return 0; }
313 Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);}
314 Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);}
315 Init *convertValue( TernOpInit *UI) override{ return RecTy::convertValue(UI);}
316 Init *convertValue( TypedInit *TI) override;
317 Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);}
318 Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);}
319
320 std::string getAsString() const override;
321
322 bool typeIsConvertibleTo(const RecTy *RHS) const override{
323323 return RHS->baseClassOf(this);
324324 }
325325
326 virtual bool baseClassOf(const RecTy*) const;
326 bool baseClassOf(const RecTy*) const override;
327327 };
328328
329329 /// DagRecTy - 'dag' - Represent a dag fragment
338338
339339 static DagRecTy *get() { return &Shared; }
340340
341 virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; }
342 virtual Init *convertValue( BitInit *BI) { return 0; }
343 virtual Init *convertValue( BitsInit *BI) { return 0; }
344 virtual Init *convertValue( IntInit *II) { return 0; }
345 virtual Init *convertValue(StringInit *SI) { return 0; }
346 virtual Init *convertValue( ListInit *LI) { return 0; }
347 virtual Init *convertValue(VarBitInit *VB) { return 0; }
348 virtual Init *convertValue( DefInit *DI) { return 0; }
349 virtual Init *convertValue( UnOpInit *BO);
350 virtual Init *convertValue( BinOpInit *BO);
351 virtual Init *convertValue( TernOpInit *BO) { return RecTy::convertValue(BO);}
352 virtual Init *convertValue( DagInit *CI) { return (Init*)CI; }
353 virtual Init *convertValue( TypedInit *TI);
354 virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
355 virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
356
357 virtual std::string getAsString() const { return "dag"; }
358
359 virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
341 Init *convertValue( UnsetInit *UI) override { return (Init*)UI; }
342 Init *convertValue( BitInit *BI) override { return 0; }
343 Init *convertValue( BitsInit *BI) override { return 0; }
344 Init *convertValue( IntInit *II) override { return 0; }
345 Init *convertValue(StringInit *SI) override { return 0; }
346 Init *convertValue( ListInit *LI) override { return 0; }
347 Init *convertValue(VarBitInit *VB) override { return 0; }
348 Init *convertValue( DefInit *DI) override { return 0; }
349 Init *convertValue( UnOpInit *BO) override;
350 Init *convertValue( BinOpInit *BO) override;
351 Init *convertValue( TernOpInit *BO) override {return RecTy::convertValue(BO);}
352 Init *convertValue( DagInit *CI) override { return (Init*)CI; }
353 Init *convertValue( TypedInit *TI) override;
354 Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);}
355 Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);}
356
357 std::string getAsString() const override { return "dag"; }
358
359 bool typeIsConvertibleTo(const RecTy *RHS) const override{
360360 return RHS->baseClassOf(this);
361361 }
362362 };
378378
379379 Record *getRecord() const { return Rec; }
380380
381 virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; }
382 virtual Init *convertValue( BitInit *BI) { return 0; }
383 virtual Init *convertValue( BitsInit *BI) { return 0; }
384 virtual Init *convertValue( IntInit *II) { return 0; }
385 virtual Init *convertValue(StringInit *SI) { return 0; }
386 virtual Init *convertValue( ListInit *LI) { return 0; }
387 virtual Init *convertValue(VarBitInit *VB) { return 0; }
388 virtual Init *convertValue( UnOpInit *UI) { return RecTy::convertValue(UI);}
389 virtual Init *convertValue( BinOpInit *UI) { return RecTy::convertValue(UI);}
390 virtual Init *convertValue( TernOpInit *UI) { return RecTy::convertValue(UI);}
391 virtual Init *convertValue( DefInit *DI);
392 virtual Init *convertValue( DagInit *DI) { return 0; }
393 virtual Init *convertValue( TypedInit *VI);
394 virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);}
395 virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);}
396
397 virtual std::string getAsString() const;
398
399 virtual bool typeIsConvertibleTo(const RecTy *RHS) const {
381 Init *convertValue( UnsetInit *UI) override { return (Init*)UI; }
382 Init *convertValue( BitInit *BI) override { return 0; }
383 Init *convertValue( BitsInit *BI) override { return 0; }
384 Init *convertValue( IntInit *II) override { return 0; }
385 Init *convertValue(StringInit *SI) override { return 0; }
386 Init *convertValue( ListInit *LI) override { return 0; }
387 Init *convertValue(VarBitInit *VB) override { return 0; }
388 Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);}
389 Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);}
390 Init *convertValue( TernOpInit *UI) override {return RecTy::convertValue(UI);}
391 Init *convertValue( DefInit *DI) override;
392 Init *convertValue( DagInit *DI) override { return 0; }
393 Init *convertValue( TypedInit *VI) override;
394 Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);}
395 Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);}
396
397 std::string getAsString() const override;
398
399 bool typeIsConvertibleTo(const RecTy *RHS) const override {
400400 return RHS->baseClassOf(this);
401401 }
402 virtual bool baseClassOf(const RecTy*) const;
402 bool baseClassOf(const RecTy*) const override;
403403 };
404404
405405 /// resolveTypes - Find a common type that T1 and T2 convert to.
568568 }
569569 RecTy *getType() const { return Ty; }
570570
571 virtual Init *
572 convertInitializerBitRange(const std::vector &Bits) const;
573 virtual Init *
574 convertInitListSlice(const std::vector &Elements) const;
571 Init *
572 convertInitializerBitRange(const std::vector &Bits) const override;
573 Init *
574 convertInitListSlice(const std::vector &Elements) const override;
575575
576576 /// getFieldType - This method is used to implement the FieldInit class.
577577 /// Implementors of this method should return the type of the named field if
578578 /// they are of record type.
579579 ///
580 virtual RecTy *getFieldType(const std::string &FieldName) const;
580 RecTy *getFieldType(const std::string &FieldName) const override;
581581
582582 /// resolveListElementReference - This method is used to implement
583583 /// VarListElementInit::resolveReferences. If the list element is resolvable
593593 UnsetInit() : Init(IK_UnsetInit) {}
594594 UnsetInit(const UnsetInit &) LLVM_DELETED_FUNCTION;
595595 UnsetInit &operator=(const UnsetInit &Other) LLVM_DELETED_FUNCTION;
596 virtual void anchor();
596 void anchor() override;
597597
598598 public:
599599 static bool classof(const Init *I) {
601601 }
602602 static UnsetInit *get();
603603
604 virtual Init *convertInitializerTo(RecTy *Ty) const {
604 Init *convertInitializerTo(RecTy *Ty) const override {
605605 return Ty->convertValue(const_cast(this));
606606 }
607607
608 virtual Init *getBit(unsigned Bit) const {
608 Init *getBit(unsigned Bit) const override {
609609 return const_cast(this);
610610 }
611611
612 virtual bool isComplete() const { return false; }
613 virtual std::string getAsString() const { return "?"; }
612 bool isComplete() const override { return false; }
613 std::string getAsString() const override { return "?"; }
614614 };
615615
616616
622622 explicit BitInit(bool V) : Init(IK_BitInit), Value(V) {}
623623 BitInit(const BitInit &Other) LLVM_DELETED_FUNCTION;
624624 BitInit &operator=(BitInit &Other) LLVM_DELETED_FUNCTION;
625 virtual void anchor();
625 void anchor() override;
626626
627627 public:
628628 static bool classof(const Init *I) {
632632
633633 bool getValue() const { return Value; }
634634
635 virtual Init *convertInitializerTo(RecTy *Ty) const {
635 Init *convertInitializerTo(RecTy *Ty) const override {
636636 return Ty->convertValue(const_cast(this));
637637 }
638638
639 virtual Init *getBit(unsigned Bit) const {
639 Init *getBit(unsigned Bit) const override {
640640 assert(Bit < 1 && "Bit index out of range!");
641641 return const_cast(this);
642642 }
643643
644 virtual std::string getAsString() const { return Value ? "1" : "0"; }
644 std::string getAsString() const override { return Value ? "1" : "0"; }
645645 };
646646
647647 /// BitsInit - { a, b, c } - Represents an initializer for a BitsRecTy value.
666666
667667 unsigned getNumBits() const { return Bits.size(); }
668668
669 virtual Init *convertInitializerTo(RecTy *Ty) const {
669 Init *convertInitializerTo(RecTy *Ty) const override {
670670 return Ty->convertValue(const_cast(this));
671671 }
672 virtual Init *
673 convertInitializerBitRange(const std::vector &Bits) const;
674
675 virtual bool isComplete() const {
672 Init *
673 convertInitializerBitRange(const std::vector &Bits) const override;
674
675 bool isComplete() const override {
676676 for (unsigned i = 0; i != getNumBits(); ++i)
677677 if (!getBit(i)->isComplete()) return false;
678678 return true;
682682 if (getBit(i)->isComplete()) return false;
683683 return true;
684684 }
685 virtual std::string getAsString() const;
686
687 virtual Init *resolveReferences(Record &R, const RecordVal *RV) const;
688
689 virtual Init *getBit(unsigned Bit) const {
685 std::string getAsString() const override;
686
687 Init *resolveReferences(Record &R, const RecordVal *RV) const override;
688
689 Init *getBit(unsigned Bit) const override {
690690 assert(Bit < Bits.size() && "Bit index out of range!");
691691 return Bits[Bit];
692692 }
712712
713713 int64_t getValue() const { return Value; }
714714
715 virtual Init *convertInitializerTo(RecTy *Ty) const {
715 Init *convertInitializerTo(RecTy *Ty) const override {
716716 return Ty->convertValue(const_cast(this));
717717 }
718 virtual Init *
719 convertInitializerBitRange(const std::vector &Bits) const;
720
721 virtual std::string getAsString() const;
718 Init *
719 convertInitializerBitRange(const std::vector &Bits) const override;
720
721 std::string getAsString() const override;
722722
723723 /// resolveListElementReference - This method is used to implement
724724 /// VarListElementInit::resolveReferences. If the list element is resolvable
725725 /// now, we return the resolved value, otherwise we return null.
726 virtual Init *resolveListElementReference(Record &R, const RecordVal *RV,
727 unsigned Elt) const {
726 Init *resolveListElementReference(Record &R, const RecordVal *RV,
727 unsigned Elt) const override {
728728 llvm_unreachable("Illegal element reference off int");
729729 }
730730
731 virtual Init *getBit(unsigned Bit) const {
731 Init *getBit(unsigned Bit) const override {
732732 return BitInit::get((Value & (1ULL << Bit)) != 0);
733733 }
734734 };
744744
745745 StringInit(const StringInit &Other) LLVM_DELETED_FUNCTION;
746746 StringInit &operator=(const StringInit &Other) LLVM_DELETED_FUNCTION;
747 virtual void anchor();
747 void anchor() override;
748748
749749 public:
750750 static bool classof(const Init *I) {
754754
755755 const std::string &getValue() const { return Value; }
756756
757 virtual Init *convertInitializerTo(RecTy *Ty) const {
757 Init *convertInitializerTo(RecTy *Ty) const override {
758758 return Ty->convertValue(const_cast(this));
759759 }
760760
761 virtual std::string getAsString() const { return "\"" + Value + "\""; }
762 virtual std::string getAsUnquotedString() const { return Value; }
761 std::string getAsString() const override { return "\"" + Value + "\""; }
762 std::string getAsUnquotedString() const override { return Value; }
763763
764764 /// resolveListElementReference - This method is used to implement
765765 /// VarListElementInit::resolveReferences. If the list element is resolvable
766766 /// now, we return the resolved value, otherwise we return null.
767 virtual Init *resolveListElementReference(Record &R, const RecordVal *RV,
768 unsigned Elt) const {
767 Init *resolveListElementReference(Record &R, const RecordVal *RV,
768 unsigned Elt) const override {
769769 llvm_unreachable("Illegal element reference off string");
770770 }
771771
772 virtual Init *getBit(unsigned Bit) const {
772 Init *getBit(unsigned Bit) const override {
773773 llvm_unreachable("Illegal bit reference off string");
774774 }
775775 };
805805
806806 Record *getElementAsRecord(unsigned i) const;
807807
808 virtual Init *
809 convertInitListSlice(const std::vector &Elements) const;
810
811 virtual Init *convertInitializerTo(RecTy *Ty) const {
808 Init *
809 convertInitListSlice(const std::vector &Elements) const override;
810
811 Init *convertInitializerTo(RecTy *Ty) const override {
812812 return Ty->convertValue(const_cast(this));
813813 }
814814
817817 /// If a value is set for the variable later, this method will be called on
818818 /// users of the value to allow the value to propagate out.
819819 ///
820 virtual Init *resolveReferences(Record &R, const RecordVal *RV) const;
821
822 virtual std::string getAsString() const;
820 Init *resolveReferences(Record &R, const RecordVal *RV) const override;
821
822 std::string getAsString() const override;
823823
824824 ArrayRef getValues() const { return Values; }
825825
832832 /// resolveListElementReference - This method is used to implement
833833 /// VarListElementInit::resolveReferences. If the list element is resolvable
834834 /// now, we return the resolved value, otherwise we return null.
835 virtual Init *resolveListElementReference(Record &R, const RecordVal *RV,
836 unsigned Elt) const;
837
838 virtual Init *getBit(unsigned Bit) const {
835 Init *resolveListElementReference(Record &R, const RecordVal *RV,
836 unsigned Elt) const override;
837
838 Init *getBit(unsigned Bit) const override {
839839 llvm_unreachable("Illegal bit reference off list");
840840 }
841841 };
865865 // possible to fold.
866866 virtual Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const = 0;
867867
868 virtual Init *convertInitializerTo(RecTy *Ty) const {
868 Init *convertInitializerTo(RecTy *Ty) const override {
869869 return Ty->convertValue(const_cast(this));
870870 }
871871
872 virtual Init *resolveListElementReference(Record &R, const RecordVal *RV,
873 unsigned Elt) const;
874
875 virtual Init *getBit(unsigned Bit) const;
872 Init *resolveListElementReference(Record &R, const RecordVal *RV,
873 unsigned Elt) const override;
874
875 Init *getBit(unsigned Bit) const override;
876876 };
877877
878878
898898 static UnOpInit *get(UnaryOp opc, Init *lhs, RecTy *Type);
899899
900900 // Clone - Clone this operator, replacing arguments with the new list
901 virtual OpInit *clone(std::vector &Operands) const {
901 OpInit *clone(std::vector &Operands) const override {
902902 assert(Operands.size() == 1 &&
903903 "Wrong number of operands for unary operation");
904904 return UnOpInit::get(getOpcode(), *Operands.begin(), getType());
905905 }
906906
907 virtual int getNumOperands() const { return 1; }
908 virtual Init *getOperand(int i) const {
907 int getNumOperands() const override { return 1; }
908 Init *getOperand(int i) const override {
909909 assert(i == 0 && "Invalid operand id for unary operator");
910910 return getOperand();
911911 }
915915
916916 // Fold - If possible, fold this to a simpler init. Return this if not
917917 // possible to fold.
918 virtual Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const;
919
920 virtual Init *resolveReferences(Record &R, const RecordVal *RV) const;
921
922 virtual std::string getAsString() const;
918 Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const override;
919
920 Init *resolveReferences(Record &R, const RecordVal *RV) const override;
921
922 std::string getAsString() const override;
923923 };
924924
925925 /// BinOpInit - !op (X, Y) - Combine two inits.
945945 RecTy *Type);
946946
947947 // Clone - Clone this operator, replacing arguments with the new list
948 virtual OpInit *clone(std::vector &Operands) const {
948 OpInit *clone(std::vector &Operands) const override {
949949 assert(Operands.size() == 2 &&
950950 "Wrong number of operands for binary operation");
951951 return BinOpInit::get(getOpcode(), Operands[0], Operands[1], getType());
952952 }
953953
954 virtual int getNumOperands() const { return 2; }
955 virtual Init *getOperand(int i) const {
954 int getNumOperands() const override { return 2; }
955 Init *getOperand(int i) const override {
956956 assert((i == 0 || i == 1) && "Invalid operand id for binary operator");
957957 if (i == 0) {
958958 return getLHS();
967967
968968 // Fold - If possible, fold this to a simpler init. Return this if not
969969 // possible to fold.
970 virtual Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const;
971
972 virtual Init *resolveReferences(Record &R, const RecordVal *RV) const;
973
974 virtual std::string getAsString() const;
970 Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const override;
971
972 Init *resolveReferences(Record &R, const RecordVal *RV) const override;
973
974 std::string getAsString() const override;
975975 };
976976
977977 /// TernOpInit - !op (X, Y, Z) - Combine two inits.
999999 RecTy *Type);
10001000
10011001 // Clone - Clone this operator, replacing arguments with the new list
1002 virtual OpInit *clone(std::vector &Operands) const {
1002 OpInit *clone(std::vector &Operands) const override {
10031003 assert(Operands.size() == 3 &&
10041004 "Wrong number of operands for ternary operation");
10051005 return TernOpInit::get(getOpcode(), Operands[0], Operands[1], Operands[2],
10061006 getType());
10071007 }
10081008
1009 virtual int getNumOperands() const { return 3; }
1010 virtual Init *getOperand(int i) const {
1009 int getNumOperands() const override { return 3; }
1010 Init *getOperand(int i) const override {
10111011 assert((i == 0 || i == 1 || i == 2) &&
10121012 "Invalid operand id for ternary operator");
10131013 if (i == 0) {
10261026
10271027 // Fold - If possible, fold this to a simpler init. Return this if not
10281028 // possible to fold.
1029 virtual Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const;
1030
1031 virtual bool isComplete() const { return false; }
1032
1033 virtual Init *resolveReferences(Record &R, const RecordVal *RV) const;
1034
1035 virtual std::string getAsString() const;
1029 Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const override;
1030
1031 bool isComplete() const override { return false; }
1032
1033 Init *resolveReferences(Record &R, const RecordVal *RV) const override;
1034
1035 std::string getAsString() const override;
10361036 };
10371037
10381038
10561056 static VarInit *get(const std::string &VN, RecTy *T);
10571057 static VarInit *get(Init *VN, RecTy *T);
10581058
1059 virtual Init *convertInitializerTo(RecTy *Ty) const {
1059 Init *convertInitializerTo(RecTy *Ty) const override {
10601060 return Ty->convertValue(const_cast(this));
10611061 }
10621062
10661066 return getNameInit()->getAsUnquotedString();
10671067 }
10681068
1069 virtual Init *resolveListElementReference(Record &R, const RecordVal *RV,
1070 unsigned Elt) const;
1071
1072 virtual RecTy *getFieldType(const std::string &FieldName) const;
1073 virtual Init *getFieldInit(Record &R, const RecordVal *RV,
1074 const std::string &FieldName) const;
1069 Init *resolveListElementReference(Record &R, const RecordVal *RV,
1070 unsigned Elt) const override;
1071
1072 RecTy *getFieldType(const std::string &FieldName) const override;
1073 Init *getFieldInit(Record &R, const RecordVal *RV,
1074 const std::string &FieldName) const override;
10751075
10761076 /// resolveReferences - This method is used by classes that refer to other
10771077 /// variables which may not be defined at the time they expression is formed.
10781078 /// If a value is set for the variable later, this method will be called on
10791079 /// users of the value to allow the value to propagate out.
10801080 ///
1081 virtual Init *resolveReferences(Record &R, const RecordVal *RV) const;
1082
1083 virtual Init *getBit(unsigned Bit) const;
1084
1085 virtual std::string getAsString() const { return getName(); }
1081 Init *resolveReferences(Record &R, const RecordVal *RV) const override;
1082
1083 Init *getBit(unsigned Bit) const override;
1084
1085 std::string getAsString() const override { return getName(); }
10861086 };
10871087
10881088
11091109 }
11101110 static VarBitInit *get(TypedInit *T, unsigned B);
11111111
1112 virtual Init *convertInitializerTo(RecTy *Ty) const {
1112 Init *convertInitializerTo(RecTy *Ty) const override {
11131113 return Ty->convertValue(const_cast(this));
11141114 }
11151115
1116 virtual Init *getBitVar() const { return TI; }
1117 virtual unsigned getBitNum() const { return Bit; }
1118
1119 virtual std::string getAsString() const;
1120 virtual Init *resolveReferences(Record &R, const RecordVal *RV) const;
1121
1122 virtual Init *getBit(unsigned B) const {
1116 Init *getBitVar() const override { return TI; }
1117 unsigned getBitNum() const override { return Bit; }
1118
1119 std::string getAsString() const override;
1120 Init *resolveReferences(Record &R, const RecordVal *RV) const override;
1121
1122 Init *getBit(unsigned B) const override {
11231123 assert(B < 1 && "Bit index out of range!");
11241124 return const_cast(this);
11251125 }
11481148 }
11491149 static VarListElementInit *get(TypedInit *T, unsigned E);
11501150
1151 virtual Init *convertInitializerTo(RecTy *Ty) const {
1151 Init *convertInitializerTo(RecTy *Ty) const override {
11521152 return Ty->convertValue(const_cast(this));
11531153 }
11541154
11581158 /// resolveListElementReference - This method is used to implement
11591159 /// VarListElementInit::resolveReferences. If the list element is resolvable
11601160 /// now, we return the resolved value, otherwise we return null.
1161 virtual Init *resolveListElementReference(Record &R,
1162 const RecordVal *RV,
1163 unsigned Elt) const;
1164
1165 virtual std::string getAsString() const;
1166 virtual Init *resolveReferences(Record &R, const RecordVal *RV) const;
1167
1168 virtual Init *getBit(unsigned Bit) const;
1161 Init *resolveListElementReference(Record &R, const RecordVal *RV,
1162 unsigned Elt) const override;
1163
1164 std::string getAsString() const override;
1165 Init *resolveReferences(Record &R, const RecordVal *RV) const override;
1166
1167 Init *getBit(unsigned Bit) const override;
11691168 };
11701169
11711170 /// DefInit - AL - Represent a reference to a 'def' in the description
11851184 }
11861185 static DefInit *get(Record*);
11871186
1188 virtual Init *convertInitializerTo(RecTy *Ty) const {
1187 Init *convertInitializerTo(RecTy *Ty) const override {
11891188 return Ty->convertValue(const_cast(this));
11901189 }
11911190
11931192
11941193 //virtual Init *convertInitializerBitRange(const std::vector &Bits);
11951194
1196 virtual RecTy *getFieldType(const std::string &FieldName) const;
1197 virtual Init *getFieldInit(Record &R, const RecordVal *RV,
1198 const std::string &FieldName) const;
1199
1200 virtual std::string getAsString() const;
1201
1202 virtual Init *getBit(unsigned Bit) const {
1195 RecTy *getFieldType(const std::string &FieldName) const override;
1196 Init *getFieldInit(Record &R, const RecordVal *RV,
1197 const std::string &FieldName) const override;
1198
1199 std::string getAsString() const override;
1200
1201 Init *getBit(unsigned Bit) const override {
12031202 llvm_unreachable("Illegal bit reference off def");
12041203 }
12051204
12061205 /// resolveListElementReference - This method is used to implement
12071206 /// VarListElementInit::resolveReferences. If the list element is resolvable
12081207 /// now, we return the resolved value, otherwise we return null.
1209 virtual Init *resolveListElementReference(Record &R, const RecordVal *RV,
1210 unsigned Elt) const {
1208 Init *resolveListElementReference(Record &R, const RecordVal *RV,
1209 unsigned Elt) const override {
12111210 llvm_unreachable("Illegal element reference off def");
12121211 }
12131212 };
12341233 static FieldInit *get(Init *R, const std::string &FN);
12351234 static FieldInit *get(Init *R, const Init *FN);
12361235
1237 virtual Init *convertInitializerTo(RecTy *Ty) const {
1236 Init *convertInitializerTo(RecTy *Ty) const override {
12381237 return Ty->convertValue(const_cast(this));
12391238 }
12401239
1241 virtual Init *getBit(unsigned Bit) const;
1242
1243 virtual Init *resolveListElementReference(Record &R,
1244 const RecordVal *RV,
1245 unsigned Elt) const;
1246
1247 virtual Init *resolveReferences(Record &R, const RecordVal *RV) const;
1248
1249 virtual std::string getAsString() const {
1240 Init *getBit(unsigned Bit) const override;
1241
1242 Init *resolveListElementReference(Record &R, const RecordVal *RV,
1243 unsigned Elt) const override;
1244
1245 Init *resolveReferences(Record &R, const RecordVal *RV) const override;
1246
1247 std::string getAsString() const override {
12501248 return Rec->getAsString() + "." + FieldName;
12511249 }
12521250 };
12841282
12851283 void Profile(FoldingSetNodeID &ID) const;
12861284
1287 virtual Init *convertInitializerTo(RecTy *Ty) const {
1285 Init *convertInitializerTo(RecTy *Ty) const override {
12881286 return Ty->convertValue(const_cast(this));
12891287 }
12901288
13021300 return ArgNames[Num];
13031301 }
13041302
1305 virtual Init *resolveReferences(Record &R, const RecordVal *RV) const;
1306
1307 virtual std::string getAsString() const;
1303 Init *resolveReferences(Record &R, const RecordVal *RV) const override;
1304
1305 std::string getAsString() const override;
13081306
13091307 typedef std::vector::const_iterator const_arg_iterator;
13101308 typedef std::vector::const_iterator const_name_iterator;
13211319 inline size_t name_size () const { return ArgNames.size(); }
13221320 inline bool name_empty() const { return ArgNames.empty(); }
13231321
1324 virtual Init *getBit(unsigned Bit) const {
1322 Init *getBit(unsigned Bit) const override {
13251323 llvm_unreachable("Illegal bit reference off dag");
13261324 }
13271325
1328 virtual Init *resolveListElementReference(Record &R, const RecordVal *RV,
1329 unsigned Elt) const {
1326 Init *resolveListElementReference(Record &R, const RecordVal *RV,
1327 unsigned Elt) const override {
13301328 llvm_unreachable("Illegal element reference off dag");
13311329 }
13321330 };
549549 // registers.
550550 namespace {
551551 struct TupleExpander : SetTheory::Expander {
552 void expand(SetTheory &ST, Record *Def, SetTheory::RecSet &Elts) {
552 void expand(SetTheory &ST, Record *Def, SetTheory::RecSet &Elts) override {
553553 std::vector Indices = Def->getValueAsListOfDefs("SubRegIndices");
554554 unsigned Dim = Indices.size();
555555 ListInit *SubRegs = Def->getValueAsListInit("SubRegs");
3838 namespace {
3939 // (instrs a, b, ...) Evaluate and union all arguments. Identical to AddOp.
4040 struct InstrsOp : public SetTheory::Operator {
41 virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
42 ArrayRef Loc) {
41 void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
42 ArrayRef Loc) override {
4343 ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
4444 }
4545 };
5757 InstRegexOp(const CodeGenTarget &t): Target(t) {}
5858
5959 void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
60 ArrayRef Loc) {
60 ArrayRef Loc) override {
6161 SmallVector RegexList;
6262 for (DagInit::const_arg_iterator
6363 AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) {
225225 }
226226
227227 private:
228 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
229 virtual bool isEqualImpl(const Matcher *M) const { return false; }
230 virtual unsigned getHashImpl() const { return 12312; }
228 void printImpl(raw_ostream &OS, unsigned indent) const override;
229 bool isEqualImpl(const Matcher *M) const override { return false; }
230 unsigned getHashImpl() const override { return 12312; }
231231 };
232232
233233 /// RecordMatcher - Save the current node in the operand list.
250250 return N->getKind() == RecordNode;
251251 }
252252
253 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
254 private:
255 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
256 virtual bool isEqualImpl(const Matcher *M) const { return true; }
257 virtual unsigned getHashImpl() const { return 0; }
253 bool isSafeToReorderWithPatternPredicate() const override { return true; }
254 private:
255 void printImpl(raw_ostream &OS, unsigned indent) const override;
256 bool isEqualImpl(const Matcher *M) const override { return true; }
257 unsigned getHashImpl() const override { return 0; }
258258 };
259259
260260 /// RecordChildMatcher - Save a numbered child of the current node, or fail
284284 return N->getKind() == RecordChild;
285285 }
286286
287 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
288
289 private:
290 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
291 virtual bool isEqualImpl(const Matcher *M) const {
287 bool isSafeToReorderWithPatternPredicate() const override { return true; }
288
289 private:
290 void printImpl(raw_ostream &OS, unsigned indent) const override;
291 bool isEqualImpl(const Matcher *M) const override {
292292 return cast(M)->getChildNo() == getChildNo();
293293 }
294 virtual unsigned getHashImpl() const { return getChildNo(); }
294 unsigned getHashImpl() const override { return getChildNo(); }
295295 };
296296
297297 /// RecordMemRefMatcher - Save the current node's memref.
303303 return N->getKind() == RecordMemRef;
304304 }
305305
306 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
307
308 private:
309 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
310 virtual bool isEqualImpl(const Matcher *M) const { return true; }
311 virtual unsigned getHashImpl() const { return 0; }
306 bool isSafeToReorderWithPatternPredicate() const override { return true; }
307
308 private:
309 void printImpl(raw_ostream &OS, unsigned indent) const override;
310 bool isEqualImpl(const Matcher *M) const override { return true; }
311 unsigned getHashImpl() const override { return 0; }
312312 };
313313
314314
322322 return N->getKind() == CaptureGlueInput;
323323 }
324324
325 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
326
327 private:
328 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
329 virtual bool isEqualImpl(const Matcher *M) const { return true; }
330 virtual unsigned getHashImpl() const { return 0; }
325 bool isSafeToReorderWithPatternPredicate() const override { return true; }
326
327 private:
328 void printImpl(raw_ostream &OS, unsigned indent) const override;
329 bool isEqualImpl(const Matcher *M) const override { return true; }
330 unsigned getHashImpl() const override { return 0; }
331331 };
332332
333333 /// MoveChildMatcher - This tells the interpreter to move into the
343343 return N->getKind() == MoveChild;
344344 }
345345
346 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
347
348 private:
349 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
350 virtual bool isEqualImpl(const Matcher *M) const {
346 bool isSafeToReorderWithPatternPredicate() const override { return true; }
347
348 private:
349 void printImpl(raw_ostream &OS, unsigned indent) const override;
350 bool isEqualImpl(const Matcher *M) const override {
351351 return cast(M)->getChildNo() == getChildNo();
352352 }
353 virtual unsigned getHashImpl() const { return getChildNo(); }
353 unsigned getHashImpl() const override { return getChildNo(); }
354354 };
355355
356356 /// MoveParentMatcher - This tells the interpreter to move to the parent
363363 return N->getKind() == MoveParent;
364364 }
365365
366 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
367
368 private:
369 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
370 virtual bool isEqualImpl(const Matcher *M) const { return true; }
371 virtual unsigned getHashImpl() const { return 0; }
366 bool isSafeToReorderWithPatternPredicate() const override { return true; }
367
368 private:
369 void printImpl(raw_ostream &OS, unsigned indent) const override;
370 bool isEqualImpl(const Matcher *M) const override { return true; }
371 unsigned getHashImpl() const override { return 0; }
372372 };
373373
374374 /// CheckSameMatcher - This checks to see if this node is exactly the same
386386 return N->getKind() == CheckSame;
387387 }
388388
389 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
390
391 private:
392 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
393 virtual bool isEqualImpl(const Matcher *M) const {
389 bool isSafeToReorderWithPatternPredicate() const override { return true; }
390
391 private:
392 void printImpl(raw_ostream &OS, unsigned indent) const override;
393 bool isEqualImpl(const Matcher *M) const override {
394394 return cast(M)->getMatchNumber() == getMatchNumber();
395395 }
396 virtual unsigned getHashImpl() const { return getMatchNumber(); }
396 unsigned getHashImpl() const override { return getMatchNumber(); }
397397 };
398398
399399 /// CheckChildSameMatcher - This checks to see if child node is exactly the same
413413 return N->getKind() == CheckChildSame;
414414 }
415415
416 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
417
418 private:
419 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
420 virtual bool isEqualImpl(const Matcher *M) const {
416 bool isSafeToReorderWithPatternPredicate() const override { return true; }
417
418 private:
419 void printImpl(raw_ostream &OS, unsigned indent) const override;
420 bool isEqualImpl(const Matcher *M) const override {
421421 return cast(M)->ChildNo == ChildNo &&
422422 cast(M)->MatchNumber == MatchNumber;
423423 }
424 virtual unsigned getHashImpl() const { return (MatchNumber << 2) | ChildNo; }
424 unsigned getHashImpl() const override { return (MatchNumber << 2) | ChildNo; }
425425 };
426426
427427 /// CheckPatternPredicateMatcher - This checks the target-specific predicate
439439 return N->getKind() == CheckPatternPredicate;
440440 }
441441
442 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
443
444 private:
445 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
446 virtual bool isEqualImpl(const Matcher *M) const {
442 bool isSafeToReorderWithPatternPredicate() const override { return true; }
443
444 private:
445 void printImpl(raw_ostream &OS, unsigned indent) const override;
446 bool isEqualImpl(const Matcher *M) const override {
447447 return cast(M)->getPredicate() == Predicate;
448448 }
449 virtual unsigned getHashImpl() const;
449 unsigned getHashImpl() const override;
450450 };
451451
452452 /// CheckPredicateMatcher - This checks the target-specific predicate to
466466 //virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
467467
468468 private:
469 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
470 virtual bool isEqualImpl(const Matcher *M) const {
469 void printImpl(raw_ostream &OS, unsigned indent) const override;
470 bool isEqualImpl(const Matcher *M) const override {
471471 return cast(M)->Pred == Pred;
472472 }
473 virtual unsigned getHashImpl() const;
473 unsigned getHashImpl() const override;
474474 };
475475
476476
488488 return N->getKind() == CheckOpcode;
489489 }
490490
491 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
492
493 private:
494 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
495 virtual bool isEqualImpl(const Matcher *M) const;
496 virtual unsigned getHashImpl() const;
497 virtual bool isContradictoryImpl(const Matcher *M) const;
491 bool isSafeToReorderWithPatternPredicate() const override { return true; }
492
493 private:
494 void printImpl(raw_ostream &OS, unsigned indent) const override;
495 bool isEqualImpl(const Matcher *M) const override;
496 unsigned getHashImpl() const override;
497 bool isContradictoryImpl(const Matcher *M) const override;
498498 };
499499
500500 /// SwitchOpcodeMatcher - Switch based on the current node's opcode, dispatching
519519 const Matcher *getCaseMatcher(unsigned i) const { return Cases[i].second; }
520520
521521 private:
522 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
523 virtual bool isEqualImpl(const Matcher *M) const { return false; }
524 virtual unsigned getHashImpl() const { return 4123; }
522 void printImpl(raw_ostream &OS, unsigned indent) const override;
523 bool isEqualImpl(const Matcher *M) const override { return false; }
524 unsigned getHashImpl() const override { return 4123; }
525525 };
526526
527527 /// CheckTypeMatcher - This checks to see if the current node has the
540540 return N->getKind() == CheckType;
541541 }
542542
543 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
544
545 private:
546 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
547 virtual bool isEqualImpl(const Matcher *M) const {
543 bool isSafeToReorderWithPatternPredicate() const override { return true; }
544
545 private:
546 void printImpl(raw_ostream &OS, unsigned indent) const override;
547 bool isEqualImpl(const Matcher *M) const override {
548548 return cast(M)->Type == Type;
549549 }
550 virtual unsigned getHashImpl() const { return Type; }
551 virtual bool isContradictoryImpl(const Matcher *M) const;
550 unsigned getHashImpl() const override { return Type; }
551 bool isContradictoryImpl(const Matcher *M) const override;
552552 };
553553
554554 /// SwitchTypeMatcher - Switch based on the current node's type, dispatching
573573 const Matcher *getCaseMatcher(unsigned i) const { return Cases[i].second; }
574574
575575 private:
576 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
577 virtual bool isEqualImpl(const Matcher *M) const { return false; }
578 virtual unsigned getHashImpl() const { return 4123; }
576 void printImpl(raw_ostream &OS, unsigned indent) const override;
577 bool isEqualImpl(const Matcher *M) const override { return false; }
578 unsigned getHashImpl() const override { return 4123; }
579579 };
580580
581581
595595 return N->getKind() == CheckChildType;
596596 }
597597
598 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
599
600 private:
601 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
602 virtual bool isEqualImpl(const Matcher *M) const {
598 bool isSafeToReorderWithPatternPredicate() const override { return true; }
599
600 private:
601 void printImpl(raw_ostream &OS, unsigned indent) const override;
602 bool isEqualImpl(const Matcher *M) const override {
603603 return cast(M)->ChildNo == ChildNo &&
604604 cast(M)->Type == Type;
605605 }
606 virtual unsigned getHashImpl() const { return (Type << 3) | ChildNo; }
607 virtual bool isContradictoryImpl(const Matcher *M) const;
606 unsigned getHashImpl() const override { return (Type << 3) | ChildNo; }
607 bool isContradictoryImpl(const Matcher *M) const override;
608608 };
609609
610610
622622 return N->getKind() == CheckInteger;
623623 }
624624
625 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
626
627 private:
628 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
629 virtual bool isEqualImpl(const Matcher *M) const {
625 bool isSafeToReorderWithPatternPredicate() const override { return true; }
626
627 private:
628 void printImpl(raw_ostream &OS, unsigned indent) const override;
629 bool isEqualImpl(const Matcher *M) const override {
630630 return cast(M)->Value == Value;
631631 }
632 virtual unsigned getHashImpl() const { return Value; }
633 virtual bool isContradictoryImpl(const Matcher *M) const;
632 unsigned getHashImpl() const override { return Value; }
633 bool isContradictoryImpl(const Matcher *M) const override;
634634 };
635635
636636 /// CheckChildIntegerMatcher - This checks to see if the child node is a
649649 return N->getKind() == CheckChildInteger;
650650 }
651651
652 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
653
654 private:
655 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
656 virtual bool isEqualImpl(const Matcher *M) const {
652 bool isSafeToReorderWithPatternPredicate() const override { return true; }
653
654 private:
655 void printImpl(raw_ostream &OS, unsigned indent) const override;
656 bool isEqualImpl(const Matcher *M) const override {
657657 return cast(M)->ChildNo == ChildNo &&
658658 cast(M)->Value == Value;
659659 }
660 virtual unsigned getHashImpl() const { return (Value << 3) | ChildNo; }
661 virtual bool isContradictoryImpl(const Matcher *M) const;
660 unsigned getHashImpl() const override { return (Value << 3) | ChildNo; }
661 bool isContradictoryImpl(const Matcher *M) const override;
662662 };
663663
664664 /// CheckCondCodeMatcher - This checks to see if the current node is a
675675 return N->getKind() == CheckCondCode;
676676 }
677677
678 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
679
680 private:
681 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
682 virtual bool isEqualImpl(const Matcher *M) const {
678 bool isSafeToReorderWithPatternPredicate() const override { return true; }
679
680 private:
681 void printImpl(raw_ostream &OS, unsigned indent) const override;
682 bool isEqualImpl(const Matcher *M) const override {
683683 return cast(M)->CondCodeName == CondCodeName;
684684 }
685 virtual unsigned getHashImpl() const;
685 unsigned getHashImpl() const override;
686686 };
687687
688688 /// CheckValueTypeMatcher - This checks to see if the current node is a
699699 return N->getKind() == CheckValueType;
700700 }
701701
702 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
703
704 private:
705 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
706 virtual bool isEqualImpl(const Matcher *M) const {
702 bool isSafeToReorderWithPatternPredicate() const override { return true; }
703
704 private:
705 void printImpl(raw_ostream &OS, unsigned indent) const override;
706 bool isEqualImpl(const Matcher *M) const override {
707707 return cast(M)->TypeName == TypeName;
708708 }
709 virtual unsigned getHashImpl() const;
710 bool isContradictoryImpl(const Matcher *M) const;
709 unsigned getHashImpl() const override;
710 bool isContradictoryImpl(const Matcher *M) const override;
711711 };
712712
713713
744744 }
745745
746746 // Not safe to move a pattern predicate past a complex pattern.
747 virtual bool isSafeToReorderWithPatternPredicate() const { return false; }
748
749 private:
750 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
751 virtual bool isEqualImpl(const Matcher *M) const {
747 bool isSafeToReorderWithPatternPredicate() const override { return false; }
748
749 private:
750 void printImpl(raw_ostream &OS, unsigned indent) const override;
751 bool isEqualImpl(const Matcher *M) const override {
752752 return &cast(M)->Pattern == &Pattern &&
753753 cast(M)->MatchNumber == MatchNumber;
754754 }
755 virtual unsigned getHashImpl() const {
755 unsigned getHashImpl() const override {
756756 return (unsigned)(intptr_t)&Pattern ^ MatchNumber;
757757 }
758758 };
771771 return N->getKind() == CheckAndImm;
772772 }
773773
774 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
775
776 private:
777 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
778 virtual bool isEqualImpl(const Matcher *M) const {
774 bool isSafeToReorderWithPatternPredicate() const override { return true; }
775
776 private:
777 void printImpl(raw_ostream &OS, unsigned indent) const override;
778 bool isEqualImpl(const Matcher *M) const override {
779779 return cast(M)->Value == Value;
780780 }
781 virtual unsigned getHashImpl() const { return Value; }
781 unsigned getHashImpl() const override { return Value; }
782782 };
783783
784784 /// CheckOrImmMatcher - This checks to see if the current node is an 'and'
795795 return N->getKind() == CheckOrImm;
796796 }
797797
798 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
799
800 private:
801 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
802 virtual bool isEqualImpl(const Matcher *M) const {
798 bool isSafeToReorderWithPatternPredicate() const override { return true; }
799
800 private:
801 void printImpl(raw_ostream &OS, unsigned indent) const override;
802 bool isEqualImpl(const Matcher *M) const override {
803803 return cast(M)->Value == Value;
804804 }
805 virtual unsigned getHashImpl() const { return Value; }
805 unsigned getHashImpl() const override { return Value; }
806806 };
807807
808808 /// CheckFoldableChainNodeMatcher - This checks to see if the current node
816816 return N->getKind() == CheckFoldableChainNode;
817817 }
818818
819 virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
820
821 private:
822 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
823 virtual bool isEqualImpl(const Matcher *M) const { return true; }
824 virtual unsigned getHashImpl() const { return 0; }
819 bool isSafeToReorderWithPatternPredicate() const override { return true; }
820
821 private:
822 void printImpl(raw_ostream &OS, unsigned indent) const override;
823 bool isEqualImpl(const Matcher *M) const override { return true; }
824 unsigned getHashImpl() const override { return 0; }
825825 };
826826
827827 /// EmitIntegerMatcher - This creates a new TargetConstant.
840840 }
841841
842842 private:
843 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
844 virtual bool isEqualImpl(const Matcher *M) const {
843 void printImpl(raw_ostream &OS, unsigned indent) const override;
844 bool isEqualImpl(const Matcher *M) const override {
845845 return cast(M)->Val == Val &&
846846 cast(M)->VT == VT;
847847 }
848 virtual unsigned getHashImpl() const { return (Val << 4) | VT; }
848 unsigned getHashImpl() const override { return (Val << 4) | VT; }
849849 };
850850
851851 /// EmitStringIntegerMatcher - A target constant whose value is represented
865865 }
866866
867867 private:
868 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
869 virtual bool isEqualImpl(const Matcher *M) const {
868 void printImpl(raw_ostream &OS, unsigned indent) const override;
869 bool isEqualImpl(const Matcher *M) const override {
870870 return cast(M)->Val == Val &&
871871 cast(M)->VT == VT;
872872 }
873 virtual unsigned getHashImpl() const;
873 unsigned getHashImpl() const override;
874874 };
875875
876876 /// EmitRegisterMatcher - This creates a new TargetConstant.
891891 }
892892
893893 private:
894 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
895 virtual bool isEqualImpl(const Matcher *M) const {
894 void printImpl(raw_ostream &OS, unsigned indent) const override;
895 bool isEqualImpl(const Matcher *M) const override {
896896 return cast(M)->Reg == Reg &&
897897 cast(M)->VT == VT;
898898 }
899 virtual unsigned getHashImpl() const {
899 unsigned getHashImpl() const override {
900900 return ((unsigned)(intptr_t)Reg) << 4 | VT;
901901 }
902902 };
917917 }
918918
919919 private:
920 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
921 virtual bool isEqualImpl(const Matcher *M) const {
920 void printImpl(raw_ostream &OS, unsigned indent) const override;
921 bool isEqualImpl(const Matcher *M) const override {
922922 return cast(M)->Slot == Slot;
923923 }
924 virtual unsigned getHashImpl() const { return Slot; }
924 unsigned getHashImpl() const override { return Slot; }
925925 };
926926
927927 /// EmitMergeInputChainsMatcher - Emit a node that merges a list of input
946946 }
947947
948948 private:
949 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
950 virtual bool isEqualImpl(const Matcher *M) const {
949 void printImpl(raw_ostream &OS, unsigned indent) const override;
950 bool isEqualImpl(const Matcher *M) const override {
951951 return cast(M)->ChainNodes == ChainNodes;
952952 }
953 virtual unsigned getHashImpl() const;
953 unsigned getHashImpl() const override;
954954 };
955955
956956 /// EmitCopyToRegMatcher - Emit a CopyToReg node from a value to a physreg,
971971 }
972972
973973 private:
974 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
975 virtual bool isEqualImpl(const Matcher *M) const {
974 void printImpl(raw_ostream &OS, unsigned indent) const override;
975 bool isEqualImpl(const Matcher *M) const override {
976976 return cast(M)->SrcSlot == SrcSlot &&
977977 cast(M)->DestPhysReg == DestPhysReg;
978978 }
979 virtual unsigned getHashImpl() const {
979 unsigned getHashImpl() const override {
980980 return SrcSlot ^ ((unsigned)(intptr_t)DestPhysReg << 4);
981981 }
982982 };
10001000 }
10011001
10021002 private:
1003 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
1004 virtual bool isEqualImpl(const Matcher *M) const {
1003 void printImpl(raw_ostream &OS, unsigned indent) const override;
1004 bool isEqualImpl(const Matcher *M) const override {
10051005 return cast(M)->Slot == Slot &&
10061006 cast(M)->NodeXForm == NodeXForm;
10071007 }
1008 virtual unsigned getHashImpl() const {
1008 unsigned getHashImpl() const override {
10091009 return Slot ^ ((unsigned)(intptr_t)NodeXForm << 4);
10101010 }
10111011 };
10631063 }
10641064
10651065 private:
1066 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
1067 virtual bool isEqualImpl(const Matcher *M) const;
1068 virtual unsigned getHashImpl() const;
1066 void printImpl(raw_ostream &OS, unsigned indent) const override;
1067 bool isEqualImpl(const Matcher *M) const override;
1068 unsigned getHashImpl() const override;
10691069 };
10701070
10711071 /// EmitNodeMatcher - This signals a successful match and generates a node.
10721072 class EmitNodeMatcher : public EmitNodeMatcherCommon {
1073 virtual void anchor();
1073 void anchor() override;
10741074 unsigned FirstResultSlot;
10751075 public:
10761076 EmitNodeMatcher(const std::string &opcodeName,
10931093 };
10941094
10951095 class MorphNodeToMatcher : public EmitNodeMatcherCommon {
1096 virtual void anchor();
1096 void anchor() override;
10971097 const PatternToMatch &Pattern;
10981098 public:
10991099 MorphNodeToMatcher(const std::string &opcodeName,
11361136 }
11371137
11381138 private:
1139 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
1140 virtual bool isEqualImpl(const Matcher *M) const {
1139 void printImpl(raw_ostream &OS, unsigned indent) const override;
1140 bool isEqualImpl(const Matcher *M) const override {
11411141 return cast(M)->GlueResultNodes == GlueResultNodes;
11421142 }
1143 virtual unsigned getHashImpl() const;
1143 unsigned getHashImpl() const override;
11441144 };
11451145
11461146 /// CompleteMatchMatcher - Complete a match by replacing the results of the
11641164 }
11651165
11661166 private:
1167 virtual void printImpl(raw_ostream &OS, unsigned indent) const;
1168 virtual bool isEqualImpl(const Matcher *M) const {
1167 void printImpl(raw_ostream &OS, unsigned indent) const override;
1168 bool isEqualImpl(const Matcher *M) const override {
11691169 return cast(M)->Results == Results &&
11701170 &cast(M)->Pattern == &Pattern;
11711171 }
1172 virtual unsigned getHashImpl() const;
1172 unsigned getHashImpl() const override;
11731173 };
11741174
11751175 } // end namespace llvm
2626
2727 // (add a, b, ...) Evaluate and union all arguments.
2828 struct AddOp : public SetTheory::Operator {
29 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
30 ArrayRef Loc) {
29 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
30 ArrayRef Loc) override {
3131 ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc);
3232 }
3333 };
3434
3535 // (sub Add, Sub, ...) Set difference.
3636 struct SubOp : public SetTheory::Operator {
37 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
38 ArrayRef Loc) {
37 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
38 ArrayRef Loc) override {
3939 if (Expr->arg_size() < 2)
4040 PrintFatalError(Loc, "Set difference needs at least two arguments: " +
4141 Expr->getAsString());
5050
5151 // (and S1, S2) Set intersection.
5252 struct AndOp : public SetTheory::Operator {
53 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
54 ArrayRef Loc) {
53 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
54 ArrayRef Loc) override {
5555 if (Expr->arg_size() != 2)
5656 PrintFatalError(Loc, "Set intersection requires two arguments: " +
5757 Expr->getAsString());
6666
6767 // SetIntBinOp - Abstract base class for (Op S, N) operators.
6868 struct SetIntBinOp : public SetTheory::Operator {
69 virtual void apply2(SetTheory &ST, DagInit *Expr,
70 RecSet &Set, int64_t N,
71 RecSet &Elts, ArrayRef Loc) =0;
72
73 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
74 ArrayRef Loc) {
69 virtual void apply2(SetTheory &ST, DagInit *Expr, RecSet &Set, int64_t N,
70 RecSet &Elts, ArrayRef Loc) = 0;
71
72 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
73 ArrayRef Loc) override {
7574 if (Expr->arg_size() != 2)
7675 PrintFatalError(Loc, "Operator requires (Op Set, Int) arguments: " +
7776 Expr->getAsString());
8786
8887 // (shl S, N) Shift left, remove the first N elements.
8988 struct ShlOp : public SetIntBinOp {
90 virtual void apply2(SetTheory &ST, DagInit *Expr,
91 RecSet &Set, int64_t N,
92 RecSet &Elts, ArrayRef Loc) {
89 void apply2(SetTheory &ST, DagInit *Expr, RecSet &Set, int64_t N,
90 RecSet &Elts, ArrayRef Loc) override {
9391 if (N < 0)
9492 PrintFatalError(Loc, "Positive shift required: " +
9593 Expr->getAsString());
10098
10199 // (trunc S, N) Truncate after the first N elements.
102100 struct TruncOp : public SetIntBinOp {
103 virtual void apply2(SetTheory &ST, DagInit *Expr,
104 RecSet &Set, int64_t N,
105 RecSet &Elts, ArrayRef Loc) {
101 void apply2(SetTheory &ST, DagInit *Expr, RecSet &Set, int64_t N,
102 RecSet &Elts, ArrayRef Loc) override {
106103 if (N < 0)
107104 PrintFatalError(Loc, "Positive length required: " +
108105 Expr->getAsString());
118115
119116 RotOp(bool Rev) : Reverse(Rev) {}
120117
121 virtual void apply2(SetTheory &ST, DagInit *Expr,
122 RecSet &Set, int64_t N,
123 RecSet &Elts, ArrayRef Loc) {
118 void apply2(SetTheory &ST, DagInit *Expr, RecSet &Set, int64_t N,
119 RecSet &Elts, ArrayRef Loc) override {
124120 if (Reverse)
125121 N = -N;
126122 // N > 0 -> rotate left, N < 0 -> rotate right.
137133
138134 // (decimate S, N) Pick every N'th element of S.
139135 struct DecimateOp : public SetIntBinOp {
140 virtual void apply2(SetTheory &ST, DagInit *Expr,
141 RecSet &Set, int64_t N,
142 RecSet &Elts, ArrayRef Loc) {
136 void apply2(SetTheory &ST, DagInit *Expr, RecSet &Set, int64_t N,
137 RecSet &Elts, ArrayRef Loc) override {
143138 if (N <= 0)
144139 PrintFatalError(Loc, "Positive stride required: " +
145140 Expr->getAsString());
150145
151146 // (interleave S1, S2, ...) Interleave elements of the arguments.
152147 struct InterleaveOp : public SetTheory::Operator {
153 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
154 ArrayRef Loc) {
148 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
149 ArrayRef Loc) override {
155150 // Evaluate the arguments individually.
156151 SmallVector Args(Expr->getNumArgs());
157152 unsigned MaxSize = 0;
169164
170165 // (sequence "Format", From, To) Generate a sequence of records by name.
171166 struct SequenceOp : public SetTheory::Operator {
172 virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
173 ArrayRef Loc) {
167 void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts,
168 ArrayRef Loc) override {
174169 int Step = 1;
175170 if (Expr->arg_size() > 4)
176171 PrintFatalError(Loc, "Bad args to (sequence \"Format\", From, To): " +
237232
238233 FieldExpander(StringRef fn) : FieldName(fn) {}
239234
240 virtual void expand(SetTheory &ST, Record *Def, RecSet &Elts) {
235 void expand(SetTheory &ST, Record *Def, RecSet &Elts) override {
241236 ST.evaluate(Def->getValueInit(FieldName), Elts, Def->getLoc());
242237 }
243238 };
4949 /// require a ModR/M byte or instructions where the entire ModR/M byte is used
5050 /// for operands.
5151 class DumbFilter : public ModRMFilter {
52 virtual void anchor();
52 void anchor() override;
5353 public:
54 bool isDumb() const {
54 bool isDumb() const override {
5555 return true;
5656 }
57
58 bool accepts(uint8_t modRM) const {
57
58 bool accepts(uint8_t modRM) const override {
5959 return true;
6060 }
6161 };
6464 /// Some instructions are classified based on whether they are 11 or anything
6565 /// else. This filter performs that classification.
6666 class ModFilter : public ModRMFilter {
67 virtual void anchor();
67 void anchor() override;
6868 bool R;
6969 public:
7070 /// Constructor
7878 R(r) {
7979 }
8080
81 bool accepts(uint8_t modRM) const {
81 bool accepts(uint8_t modRM) const override {
8282 return (R == ((modRM & 0xc0) == 0xc0));
8383 }
8484 };
8686 /// ExtendedFilter - Extended opcodes are classified based on the value of the
8787 /// mod field [bits 7-6] and the value of the nnn field [bits 5-3].
8888 class ExtendedFilter : public ModRMFilter {
89 virtual void anchor();
89 void anchor() override;
9090 bool R;
9191 uint8_t NNN;
9292 public:
101101 NNN(nnn) {
102102 }
103103
104 bool accepts(uint8_t modRM) const {
104 bool accepts(uint8_t modRM) const override {
105105 return (((R && ((modRM & 0xc0) == 0xc0)) ||
106106 (!R && ((modRM & 0xc0) != 0xc0))) &&
107107 (((modRM & 0x38) >> 3) == NNN));
111111 /// ExactFilter - The occasional extended opcode (such as VMCALL or MONITOR)
112112 /// requires the ModR/M byte to have a specific value.
113113 class ExactFilter : public ModRMFilter {
114 virtual void anchor();
114 void anchor() override;
115115 uint8_t ModRM;
116116 public:
117117 /// Constructor
122122 ModRM(modRM) {
123123 }
124124
125 bool accepts(uint8_t modRM) const {
125 bool accepts(uint8_t modRM) const override {
126126 return (ModRM == modRM);
127127 }
128128 };