From 716b0730c1a287e19c474243e2ae57ecdd136be2 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 5 Mar 2014 05:17:42 +0000 Subject: [PATCH] [C++11] Add 'override' keywords to tablegen code. llvm-svn: 202937 --- llvm/include/llvm/TableGen/Record.h | 464 +++++++++++------------ llvm/utils/TableGen/CodeGenRegisters.cpp | 2 +- llvm/utils/TableGen/CodeGenSchedule.cpp | 6 +- llvm/utils/TableGen/DAGISelMatcher.h | 260 ++++++------- llvm/utils/TableGen/SetTheory.cpp | 51 ++- llvm/utils/TableGen/X86ModRMFilters.h | 20 +- 6 files changed, 398 insertions(+), 405 deletions(-) diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h index 222eff5496fd..2bed00609654 100644 --- a/llvm/include/llvm/TableGen/Record.h +++ b/llvm/include/llvm/TableGen/Record.h @@ -150,28 +150,28 @@ public: static BitRecTy *get() { return &Shared; } - virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; } - virtual Init *convertValue( BitInit *BI) { return (Init*)BI; } - virtual Init *convertValue( BitsInit *BI); - virtual Init *convertValue( IntInit *II); - virtual Init *convertValue(StringInit *SI) { return 0; } - virtual Init *convertValue( ListInit *LI) { return 0; } - virtual Init *convertValue(VarBitInit *VB) { return (Init*)VB; } - virtual Init *convertValue( DefInit *DI) { return 0; } - virtual Init *convertValue( DagInit *DI) { return 0; } - virtual Init *convertValue( UnOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( BinOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( TernOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( TypedInit *TI); - virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);} - virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);} + Init *convertValue( UnsetInit *UI) override { return (Init*)UI; } + Init *convertValue( BitInit *BI) override { return (Init*)BI; } + Init *convertValue( BitsInit *BI) override; + Init *convertValue( IntInit *II) override; + Init *convertValue(StringInit *SI) override { return 0; } + Init *convertValue( ListInit *LI) override { return 0; } + Init *convertValue(VarBitInit *VB) override { return (Init*)VB; } + Init *convertValue( DefInit *DI) override { return 0; } + Init *convertValue( DagInit *DI) override { return 0; } + Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);} + Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);} + Init *convertValue( TernOpInit *UI) override {return RecTy::convertValue(UI);} + Init *convertValue( TypedInit *TI) override; + Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);} + Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);} - virtual std::string getAsString() const { return "bit"; } + std::string getAsString() const override { return "bit"; } - virtual bool typeIsConvertibleTo(const RecTy *RHS) const { + bool typeIsConvertibleTo(const RecTy *RHS) const override { return RHS->baseClassOf(this); } - virtual bool baseClassOf(const RecTy*) const; + bool baseClassOf(const RecTy*) const override; }; @@ -189,28 +189,28 @@ public: unsigned getNumBits() const { return Size; } - virtual Init *convertValue( UnsetInit *UI); - virtual Init *convertValue( BitInit *UI); - virtual Init *convertValue( BitsInit *BI); - virtual Init *convertValue( IntInit *II); - virtual Init *convertValue(StringInit *SI) { return 0; } - virtual Init *convertValue( ListInit *LI) { return 0; } - virtual Init *convertValue(VarBitInit *VB) { return 0; } - virtual Init *convertValue( DefInit *DI) { return 0; } - virtual Init *convertValue( DagInit *DI) { return 0; } - virtual Init *convertValue( UnOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( BinOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( TernOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( TypedInit *TI); - virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);} - virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);} + Init *convertValue( UnsetInit *UI) override; + Init *convertValue( BitInit *UI) override; + Init *convertValue( BitsInit *BI) override; + Init *convertValue( IntInit *II) override; + Init *convertValue(StringInit *SI) override { return 0; } + Init *convertValue( ListInit *LI) override { return 0; } + Init *convertValue(VarBitInit *VB) override { return 0; } + Init *convertValue( DefInit *DI) override { return 0; } + Init *convertValue( DagInit *DI) override { return 0; } + Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);} + Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);} + Init *convertValue( TernOpInit *UI) override {return RecTy::convertValue(UI);} + Init *convertValue( TypedInit *TI) override; + Init *convertValue( VarInit *VI) override{ return RecTy::convertValue(VI);} + Init *convertValue( FieldInit *FI) override{ return RecTy::convertValue(FI);} - virtual std::string getAsString() const; + std::string getAsString() const override; - virtual bool typeIsConvertibleTo(const RecTy *RHS) const { + bool typeIsConvertibleTo(const RecTy *RHS) const override{ return RHS->baseClassOf(this); } - virtual bool baseClassOf(const RecTy*) const; + bool baseClassOf(const RecTy*) const override; }; @@ -226,29 +226,29 @@ public: static IntRecTy *get() { return &Shared; } - virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; } - virtual Init *convertValue( BitInit *BI); - virtual Init *convertValue( BitsInit *BI); - virtual Init *convertValue( IntInit *II) { return (Init*)II; } - virtual Init *convertValue(StringInit *SI) { return 0; } - virtual Init *convertValue( ListInit *LI) { return 0; } - virtual Init *convertValue(VarBitInit *VB) { return 0; } - virtual Init *convertValue( DefInit *DI) { return 0; } - virtual Init *convertValue( DagInit *DI) { return 0; } - virtual Init *convertValue( UnOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( BinOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( TernOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( TypedInit *TI); - virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);} - virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);} + Init *convertValue( UnsetInit *UI) override { return (Init*)UI; } + Init *convertValue( BitInit *BI) override; + Init *convertValue( BitsInit *BI) override; + Init *convertValue( IntInit *II) override { return (Init*)II; } + Init *convertValue(StringInit *SI) override { return 0; } + Init *convertValue( ListInit *LI) override { return 0; } + Init *convertValue(VarBitInit *VB) override { return 0; } + Init *convertValue( DefInit *DI) override { return 0; } + Init *convertValue( DagInit *DI) override { return 0; } + Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);} + Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);} + Init *convertValue( TernOpInit *UI) override {return RecTy::convertValue(UI);} + Init *convertValue( TypedInit *TI) override; + Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);} + Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);} - virtual std::string getAsString() const { return "int"; } + std::string getAsString() const override { return "int"; } - virtual bool typeIsConvertibleTo(const RecTy *RHS) const { + bool typeIsConvertibleTo(const RecTy *RHS) const override { return RHS->baseClassOf(this); } - virtual bool baseClassOf(const RecTy*) const; + bool baseClassOf(const RecTy*) const override; }; /// StringRecTy - 'string' - Represent an string value @@ -263,26 +263,26 @@ public: static StringRecTy *get() { return &Shared; } - virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; } - virtual Init *convertValue( BitInit *BI) { return 0; } - virtual Init *convertValue( BitsInit *BI) { return 0; } - virtual Init *convertValue( IntInit *II) { return 0; } - virtual Init *convertValue(StringInit *SI) { return (Init*)SI; } - virtual Init *convertValue( ListInit *LI) { return 0; } - virtual Init *convertValue( UnOpInit *BO); - virtual Init *convertValue( BinOpInit *BO); - virtual Init *convertValue( TernOpInit *BO) { return RecTy::convertValue(BO);} + Init *convertValue( UnsetInit *UI) override { return (Init*)UI; } + Init *convertValue( BitInit *BI) override { return 0; } + Init *convertValue( BitsInit *BI) override { return 0; } + Init *convertValue( IntInit *II) override { return 0; } + Init *convertValue(StringInit *SI) override { return (Init*)SI; } + Init *convertValue( ListInit *LI) override { return 0; } + Init *convertValue( UnOpInit *BO) override; + Init *convertValue( BinOpInit *BO) override; + Init *convertValue( TernOpInit *BO) override {return RecTy::convertValue(BO);} - virtual Init *convertValue(VarBitInit *VB) { return 0; } - virtual Init *convertValue( DefInit *DI) { return 0; } - virtual Init *convertValue( DagInit *DI) { return 0; } - virtual Init *convertValue( TypedInit *TI); - virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);} - virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);} + Init *convertValue(VarBitInit *VB) override { return 0; } + Init *convertValue( DefInit *DI) override { return 0; } + Init *convertValue( DagInit *DI) override { return 0; } + Init *convertValue( TypedInit *TI) override; + Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);} + Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);} - virtual std::string getAsString() const { return "string"; } + std::string getAsString() const override { return "string"; } - virtual bool typeIsConvertibleTo(const RecTy *RHS) const { + bool typeIsConvertibleTo(const RecTy *RHS) const override { return RHS->baseClassOf(this); } }; @@ -302,29 +302,29 @@ public: static ListRecTy *get(RecTy *T) { return T->getListTy(); } RecTy *getElementType() const { return Ty; } - virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; } - virtual Init *convertValue( BitInit *BI) { return 0; } - virtual Init *convertValue( BitsInit *BI) { return 0; } - virtual Init *convertValue( IntInit *II) { return 0; } - virtual Init *convertValue(StringInit *SI) { return 0; } - virtual Init *convertValue( ListInit *LI); - virtual Init *convertValue(VarBitInit *VB) { return 0; } - virtual Init *convertValue( DefInit *DI) { return 0; } - virtual Init *convertValue( DagInit *DI) { return 0; } - virtual Init *convertValue( UnOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( BinOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( TernOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( TypedInit *TI); - virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);} - virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);} + Init *convertValue( UnsetInit *UI) override { return (Init*)UI; } + Init *convertValue( BitInit *BI) override { return 0; } + Init *convertValue( BitsInit *BI) override { return 0; } + Init *convertValue( IntInit *II) override { return 0; } + Init *convertValue(StringInit *SI) override { return 0; } + Init *convertValue( ListInit *LI) override; + Init *convertValue(VarBitInit *VB) override { return 0; } + Init *convertValue( DefInit *DI) override { return 0; } + Init *convertValue( DagInit *DI) override { return 0; } + Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);} + Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);} + Init *convertValue( TernOpInit *UI) override{ return RecTy::convertValue(UI);} + Init *convertValue( TypedInit *TI) override; + Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);} + Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);} - virtual std::string getAsString() const; + std::string getAsString() const override; - virtual bool typeIsConvertibleTo(const RecTy *RHS) const { + bool typeIsConvertibleTo(const RecTy *RHS) const override{ return RHS->baseClassOf(this); } - virtual bool baseClassOf(const RecTy*) const; + bool baseClassOf(const RecTy*) const override; }; /// DagRecTy - 'dag' - Represent a dag fragment @@ -339,25 +339,25 @@ public: static DagRecTy *get() { return &Shared; } - virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; } - virtual Init *convertValue( BitInit *BI) { return 0; } - virtual Init *convertValue( BitsInit *BI) { return 0; } - virtual Init *convertValue( IntInit *II) { return 0; } - virtual Init *convertValue(StringInit *SI) { return 0; } - virtual Init *convertValue( ListInit *LI) { return 0; } - virtual Init *convertValue(VarBitInit *VB) { return 0; } - virtual Init *convertValue( DefInit *DI) { return 0; } - virtual Init *convertValue( UnOpInit *BO); - virtual Init *convertValue( BinOpInit *BO); - virtual Init *convertValue( TernOpInit *BO) { return RecTy::convertValue(BO);} - virtual Init *convertValue( DagInit *CI) { return (Init*)CI; } - virtual Init *convertValue( TypedInit *TI); - virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);} - virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);} + Init *convertValue( UnsetInit *UI) override { return (Init*)UI; } + Init *convertValue( BitInit *BI) override { return 0; } + Init *convertValue( BitsInit *BI) override { return 0; } + Init *convertValue( IntInit *II) override { return 0; } + Init *convertValue(StringInit *SI) override { return 0; } + Init *convertValue( ListInit *LI) override { return 0; } + Init *convertValue(VarBitInit *VB) override { return 0; } + Init *convertValue( DefInit *DI) override { return 0; } + Init *convertValue( UnOpInit *BO) override; + Init *convertValue( BinOpInit *BO) override; + Init *convertValue( TernOpInit *BO) override {return RecTy::convertValue(BO);} + Init *convertValue( DagInit *CI) override { return (Init*)CI; } + Init *convertValue( TypedInit *TI) override; + Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);} + Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);} - virtual std::string getAsString() const { return "dag"; } + std::string getAsString() const override { return "dag"; } - virtual bool typeIsConvertibleTo(const RecTy *RHS) const { + bool typeIsConvertibleTo(const RecTy *RHS) const override{ return RHS->baseClassOf(this); } }; @@ -379,28 +379,28 @@ public: Record *getRecord() const { return Rec; } - virtual Init *convertValue( UnsetInit *UI) { return (Init*)UI; } - virtual Init *convertValue( BitInit *BI) { return 0; } - virtual Init *convertValue( BitsInit *BI) { return 0; } - virtual Init *convertValue( IntInit *II) { return 0; } - virtual Init *convertValue(StringInit *SI) { return 0; } - virtual Init *convertValue( ListInit *LI) { return 0; } - virtual Init *convertValue(VarBitInit *VB) { return 0; } - virtual Init *convertValue( UnOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( BinOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( TernOpInit *UI) { return RecTy::convertValue(UI);} - virtual Init *convertValue( DefInit *DI); - virtual Init *convertValue( DagInit *DI) { return 0; } - virtual Init *convertValue( TypedInit *VI); - virtual Init *convertValue( VarInit *VI) { return RecTy::convertValue(VI);} - virtual Init *convertValue( FieldInit *FI) { return RecTy::convertValue(FI);} + Init *convertValue( UnsetInit *UI) override { return (Init*)UI; } + Init *convertValue( BitInit *BI) override { return 0; } + Init *convertValue( BitsInit *BI) override { return 0; } + Init *convertValue( IntInit *II) override { return 0; } + Init *convertValue(StringInit *SI) override { return 0; } + Init *convertValue( ListInit *LI) override { return 0; } + Init *convertValue(VarBitInit *VB) override { return 0; } + Init *convertValue( UnOpInit *UI) override { return RecTy::convertValue(UI);} + Init *convertValue( BinOpInit *UI) override { return RecTy::convertValue(UI);} + Init *convertValue( TernOpInit *UI) override {return RecTy::convertValue(UI);} + Init *convertValue( DefInit *DI) override; + Init *convertValue( DagInit *DI) override { return 0; } + Init *convertValue( TypedInit *VI) override; + Init *convertValue( VarInit *VI) override { return RecTy::convertValue(VI);} + Init *convertValue( FieldInit *FI) override { return RecTy::convertValue(FI);} - virtual std::string getAsString() const; + std::string getAsString() const override; - virtual bool typeIsConvertibleTo(const RecTy *RHS) const { + bool typeIsConvertibleTo(const RecTy *RHS) const override { return RHS->baseClassOf(this); } - virtual bool baseClassOf(const RecTy*) const; + bool baseClassOf(const RecTy*) const override; }; /// resolveTypes - Find a common type that T1 and T2 convert to. @@ -569,16 +569,16 @@ public: } RecTy *getType() const { return Ty; } - virtual Init * - convertInitializerBitRange(const std::vector &Bits) const; - virtual Init * - convertInitListSlice(const std::vector &Elements) const; + Init * + convertInitializerBitRange(const std::vector &Bits) const override; + Init * + convertInitListSlice(const std::vector &Elements) const override; /// getFieldType - This method is used to implement the FieldInit class. /// Implementors of this method should return the type of the named field if /// they are of record type. /// - virtual RecTy *getFieldType(const std::string &FieldName) const; + RecTy *getFieldType(const std::string &FieldName) const override; /// resolveListElementReference - This method is used to implement /// VarListElementInit::resolveReferences. If the list element is resolvable @@ -594,7 +594,7 @@ class UnsetInit : public Init { UnsetInit() : Init(IK_UnsetInit) {} UnsetInit(const UnsetInit &) LLVM_DELETED_FUNCTION; UnsetInit &operator=(const UnsetInit &Other) LLVM_DELETED_FUNCTION; - virtual void anchor(); + void anchor() override; public: static bool classof(const Init *I) { @@ -602,16 +602,16 @@ public: } static UnsetInit *get(); - virtual Init *convertInitializerTo(RecTy *Ty) const { + Init *convertInitializerTo(RecTy *Ty) const override { return Ty->convertValue(const_cast(this)); } - virtual Init *getBit(unsigned Bit) const { + Init *getBit(unsigned Bit) const override { return const_cast(this); } - virtual bool isComplete() const { return false; } - virtual std::string getAsString() const { return "?"; } + bool isComplete() const override { return false; } + std::string getAsString() const override { return "?"; } }; @@ -623,7 +623,7 @@ class BitInit : public Init { explicit BitInit(bool V) : Init(IK_BitInit), Value(V) {} BitInit(const BitInit &Other) LLVM_DELETED_FUNCTION; BitInit &operator=(BitInit &Other) LLVM_DELETED_FUNCTION; - virtual void anchor(); + void anchor() override; public: static bool classof(const Init *I) { @@ -633,16 +633,16 @@ public: bool getValue() const { return Value; } - virtual Init *convertInitializerTo(RecTy *Ty) const { + Init *convertInitializerTo(RecTy *Ty) const override { return Ty->convertValue(const_cast(this)); } - virtual Init *getBit(unsigned Bit) const { + Init *getBit(unsigned Bit) const override { assert(Bit < 1 && "Bit index out of range!"); return const_cast(this); } - virtual std::string getAsString() const { return Value ? "1" : "0"; } + std::string getAsString() const override { return Value ? "1" : "0"; } }; /// BitsInit - { a, b, c } - Represents an initializer for a BitsRecTy value. @@ -667,13 +667,13 @@ public: unsigned getNumBits() const { return Bits.size(); } - virtual Init *convertInitializerTo(RecTy *Ty) const { + Init *convertInitializerTo(RecTy *Ty) const override { return Ty->convertValue(const_cast(this)); } - virtual Init * - convertInitializerBitRange(const std::vector &Bits) const; + Init * + convertInitializerBitRange(const std::vector &Bits) const override; - virtual bool isComplete() const { + bool isComplete() const override { for (unsigned i = 0; i != getNumBits(); ++i) if (!getBit(i)->isComplete()) return false; return true; @@ -683,11 +683,11 @@ public: if (getBit(i)->isComplete()) return false; return true; } - virtual std::string getAsString() const; + std::string getAsString() const override; - virtual Init *resolveReferences(Record &R, const RecordVal *RV) const; + Init *resolveReferences(Record &R, const RecordVal *RV) const override; - virtual Init *getBit(unsigned Bit) const { + Init *getBit(unsigned Bit) const override { assert(Bit < Bits.size() && "Bit index out of range!"); return Bits[Bit]; } @@ -713,23 +713,23 @@ public: int64_t getValue() const { return Value; } - virtual Init *convertInitializerTo(RecTy *Ty) const { + Init *convertInitializerTo(RecTy *Ty) const override { return Ty->convertValue(const_cast(this)); } - virtual Init * - convertInitializerBitRange(const std::vector &Bits) const; + Init * + convertInitializerBitRange(const std::vector &Bits) const override; - virtual std::string getAsString() const; + std::string getAsString() const override; /// resolveListElementReference - This method is used to implement /// VarListElementInit::resolveReferences. If the list element is resolvable /// now, we return the resolved value, otherwise we return null. - virtual Init *resolveListElementReference(Record &R, const RecordVal *RV, - unsigned Elt) const { + Init *resolveListElementReference(Record &R, const RecordVal *RV, + unsigned Elt) const override { llvm_unreachable("Illegal element reference off int"); } - virtual Init *getBit(unsigned Bit) const { + Init *getBit(unsigned Bit) const override { return BitInit::get((Value & (1ULL << Bit)) != 0); } }; @@ -745,7 +745,7 @@ class StringInit : public TypedInit { StringInit(const StringInit &Other) LLVM_DELETED_FUNCTION; StringInit &operator=(const StringInit &Other) LLVM_DELETED_FUNCTION; - virtual void anchor(); + void anchor() override; public: static bool classof(const Init *I) { @@ -755,22 +755,22 @@ public: const std::string &getValue() const { return Value; } - virtual Init *convertInitializerTo(RecTy *Ty) const { + Init *convertInitializerTo(RecTy *Ty) const override { return Ty->convertValue(const_cast(this)); } - virtual std::string getAsString() const { return "\"" + Value + "\""; } - virtual std::string getAsUnquotedString() const { return Value; } + std::string getAsString() const override { return "\"" + Value + "\""; } + std::string getAsUnquotedString() const override { return Value; } /// resolveListElementReference - This method is used to implement /// VarListElementInit::resolveReferences. If the list element is resolvable /// now, we return the resolved value, otherwise we return null. - virtual Init *resolveListElementReference(Record &R, const RecordVal *RV, - unsigned Elt) const { + Init *resolveListElementReference(Record &R, const RecordVal *RV, + unsigned Elt) const override { llvm_unreachable("Illegal element reference off string"); } - virtual Init *getBit(unsigned Bit) const { + Init *getBit(unsigned Bit) const override { llvm_unreachable("Illegal bit reference off string"); } }; @@ -806,10 +806,10 @@ public: Record *getElementAsRecord(unsigned i) const; - virtual Init * - convertInitListSlice(const std::vector &Elements) const; + Init * + convertInitListSlice(const std::vector &Elements) const override; - virtual Init *convertInitializerTo(RecTy *Ty) const { + Init *convertInitializerTo(RecTy *Ty) const override { return Ty->convertValue(const_cast(this)); } @@ -818,9 +818,9 @@ public: /// If a value is set for the variable later, this method will be called on /// users of the value to allow the value to propagate out. /// - virtual Init *resolveReferences(Record &R, const RecordVal *RV) const; + Init *resolveReferences(Record &R, const RecordVal *RV) const override; - virtual std::string getAsString() const; + std::string getAsString() const override; ArrayRef getValues() const { return Values; } @@ -833,10 +833,10 @@ public: /// resolveListElementReference - This method is used to implement /// VarListElementInit::resolveReferences. If the list element is resolvable /// now, we return the resolved value, otherwise we return null. - virtual Init *resolveListElementReference(Record &R, const RecordVal *RV, - unsigned Elt) const; + Init *resolveListElementReference(Record &R, const RecordVal *RV, + unsigned Elt) const override; - virtual Init *getBit(unsigned Bit) const { + Init *getBit(unsigned Bit) const override { llvm_unreachable("Illegal bit reference off list"); } }; @@ -866,14 +866,14 @@ public: // possible to fold. virtual Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const = 0; - virtual Init *convertInitializerTo(RecTy *Ty) const { + Init *convertInitializerTo(RecTy *Ty) const override { return Ty->convertValue(const_cast(this)); } - virtual Init *resolveListElementReference(Record &R, const RecordVal *RV, - unsigned Elt) const; + Init *resolveListElementReference(Record &R, const RecordVal *RV, + unsigned Elt) const override; - virtual Init *getBit(unsigned Bit) const; + Init *getBit(unsigned Bit) const override; }; @@ -899,14 +899,14 @@ public: static UnOpInit *get(UnaryOp opc, Init *lhs, RecTy *Type); // Clone - Clone this operator, replacing arguments with the new list - virtual OpInit *clone(std::vector &Operands) const { + OpInit *clone(std::vector &Operands) const override { assert(Operands.size() == 1 && "Wrong number of operands for unary operation"); return UnOpInit::get(getOpcode(), *Operands.begin(), getType()); } - virtual int getNumOperands() const { return 1; } - virtual Init *getOperand(int i) const { + int getNumOperands() const override { return 1; } + Init *getOperand(int i) const override { assert(i == 0 && "Invalid operand id for unary operator"); return getOperand(); } @@ -916,11 +916,11 @@ public: // Fold - If possible, fold this to a simpler init. Return this if not // possible to fold. - virtual Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const; + Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const override; - virtual Init *resolveReferences(Record &R, const RecordVal *RV) const; + Init *resolveReferences(Record &R, const RecordVal *RV) const override; - virtual std::string getAsString() const; + std::string getAsString() const override; }; /// BinOpInit - !op (X, Y) - Combine two inits. @@ -946,14 +946,14 @@ public: RecTy *Type); // Clone - Clone this operator, replacing arguments with the new list - virtual OpInit *clone(std::vector &Operands) const { + OpInit *clone(std::vector &Operands) const override { assert(Operands.size() == 2 && "Wrong number of operands for binary operation"); return BinOpInit::get(getOpcode(), Operands[0], Operands[1], getType()); } - virtual int getNumOperands() const { return 2; } - virtual Init *getOperand(int i) const { + int getNumOperands() const override { return 2; } + Init *getOperand(int i) const override { assert((i == 0 || i == 1) && "Invalid operand id for binary operator"); if (i == 0) { return getLHS(); @@ -968,11 +968,11 @@ public: // Fold - If possible, fold this to a simpler init. Return this if not // possible to fold. - virtual Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const; + Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const override; - virtual Init *resolveReferences(Record &R, const RecordVal *RV) const; + Init *resolveReferences(Record &R, const RecordVal *RV) const override; - virtual std::string getAsString() const; + std::string getAsString() const override; }; /// TernOpInit - !op (X, Y, Z) - Combine two inits. @@ -1000,15 +1000,15 @@ public: RecTy *Type); // Clone - Clone this operator, replacing arguments with the new list - virtual OpInit *clone(std::vector &Operands) const { + OpInit *clone(std::vector &Operands) const override { assert(Operands.size() == 3 && "Wrong number of operands for ternary operation"); return TernOpInit::get(getOpcode(), Operands[0], Operands[1], Operands[2], getType()); } - virtual int getNumOperands() const { return 3; } - virtual Init *getOperand(int i) const { + int getNumOperands() const override { return 3; } + Init *getOperand(int i) const override { assert((i == 0 || i == 1 || i == 2) && "Invalid operand id for ternary operator"); if (i == 0) { @@ -1027,13 +1027,13 @@ public: // Fold - If possible, fold this to a simpler init. Return this if not // possible to fold. - virtual Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const; + Init *Fold(Record *CurRec, MultiClass *CurMultiClass) const override; - virtual bool isComplete() const { return false; } + bool isComplete() const override { return false; } - virtual Init *resolveReferences(Record &R, const RecordVal *RV) const; + Init *resolveReferences(Record &R, const RecordVal *RV) const override; - virtual std::string getAsString() const; + std::string getAsString() const override; }; @@ -1057,7 +1057,7 @@ public: static VarInit *get(const std::string &VN, RecTy *T); static VarInit *get(Init *VN, RecTy *T); - virtual Init *convertInitializerTo(RecTy *Ty) const { + Init *convertInitializerTo(RecTy *Ty) const override { return Ty->convertValue(const_cast(this)); } @@ -1067,23 +1067,23 @@ public: return getNameInit()->getAsUnquotedString(); } - virtual Init *resolveListElementReference(Record &R, const RecordVal *RV, - unsigned Elt) const; + Init *resolveListElementReference(Record &R, const RecordVal *RV, + unsigned Elt) const override; - virtual RecTy *getFieldType(const std::string &FieldName) const; - virtual Init *getFieldInit(Record &R, const RecordVal *RV, - const std::string &FieldName) const; + RecTy *getFieldType(const std::string &FieldName) const override; + Init *getFieldInit(Record &R, const RecordVal *RV, + const std::string &FieldName) const override; /// resolveReferences - This method is used by classes that refer to other /// variables which may not be defined at the time they expression is formed. /// If a value is set for the variable later, this method will be called on /// users of the value to allow the value to propagate out. /// - virtual Init *resolveReferences(Record &R, const RecordVal *RV) const; + Init *resolveReferences(Record &R, const RecordVal *RV) const override; - virtual Init *getBit(unsigned Bit) const; + Init *getBit(unsigned Bit) const override; - virtual std::string getAsString() const { return getName(); } + std::string getAsString() const override { return getName(); } }; @@ -1110,17 +1110,17 @@ public: } static VarBitInit *get(TypedInit *T, unsigned B); - virtual Init *convertInitializerTo(RecTy *Ty) const { + Init *convertInitializerTo(RecTy *Ty) const override { return Ty->convertValue(const_cast(this)); } - virtual Init *getBitVar() const { return TI; } - virtual unsigned getBitNum() const { return Bit; } + Init *getBitVar() const override { return TI; } + unsigned getBitNum() const override { return Bit; } - virtual std::string getAsString() const; - virtual Init *resolveReferences(Record &R, const RecordVal *RV) const; + std::string getAsString() const override; + Init *resolveReferences(Record &R, const RecordVal *RV) const override; - virtual Init *getBit(unsigned B) const { + Init *getBit(unsigned B) const override { assert(B < 1 && "Bit index out of range!"); return const_cast(this); } @@ -1149,7 +1149,7 @@ public: } static VarListElementInit *get(TypedInit *T, unsigned E); - virtual Init *convertInitializerTo(RecTy *Ty) const { + Init *convertInitializerTo(RecTy *Ty) const override { return Ty->convertValue(const_cast(this)); } @@ -1159,14 +1159,13 @@ public: /// resolveListElementReference - This method is used to implement /// VarListElementInit::resolveReferences. If the list element is resolvable /// now, we return the resolved value, otherwise we return null. - virtual Init *resolveListElementReference(Record &R, - const RecordVal *RV, - unsigned Elt) const; + Init *resolveListElementReference(Record &R, const RecordVal *RV, + unsigned Elt) const override; - virtual std::string getAsString() const; - virtual Init *resolveReferences(Record &R, const RecordVal *RV) const; + std::string getAsString() const override; + Init *resolveReferences(Record &R, const RecordVal *RV) const override; - virtual Init *getBit(unsigned Bit) const; + Init *getBit(unsigned Bit) const override; }; /// DefInit - AL - Represent a reference to a 'def' in the description @@ -1186,7 +1185,7 @@ public: } static DefInit *get(Record*); - virtual Init *convertInitializerTo(RecTy *Ty) const { + Init *convertInitializerTo(RecTy *Ty) const override { return Ty->convertValue(const_cast(this)); } @@ -1194,21 +1193,21 @@ public: //virtual Init *convertInitializerBitRange(const std::vector &Bits); - virtual RecTy *getFieldType(const std::string &FieldName) const; - virtual Init *getFieldInit(Record &R, const RecordVal *RV, - const std::string &FieldName) const; + RecTy *getFieldType(const std::string &FieldName) const override; + Init *getFieldInit(Record &R, const RecordVal *RV, + const std::string &FieldName) const override; - virtual std::string getAsString() const; + std::string getAsString() const override; - virtual Init *getBit(unsigned Bit) const { + Init *getBit(unsigned Bit) const override { llvm_unreachable("Illegal bit reference off def"); } /// resolveListElementReference - This method is used to implement /// VarListElementInit::resolveReferences. If the list element is resolvable /// now, we return the resolved value, otherwise we return null. - virtual Init *resolveListElementReference(Record &R, const RecordVal *RV, - unsigned Elt) const { + Init *resolveListElementReference(Record &R, const RecordVal *RV, + unsigned Elt) const override { llvm_unreachable("Illegal element reference off def"); } }; @@ -1235,19 +1234,18 @@ public: static FieldInit *get(Init *R, const std::string &FN); static FieldInit *get(Init *R, const Init *FN); - virtual Init *convertInitializerTo(RecTy *Ty) const { + Init *convertInitializerTo(RecTy *Ty) const override { return Ty->convertValue(const_cast(this)); } - virtual Init *getBit(unsigned Bit) const; + Init *getBit(unsigned Bit) const override; - virtual Init *resolveListElementReference(Record &R, - const RecordVal *RV, - unsigned Elt) const; + Init *resolveListElementReference(Record &R, const RecordVal *RV, + unsigned Elt) const override; - virtual Init *resolveReferences(Record &R, const RecordVal *RV) const; + Init *resolveReferences(Record &R, const RecordVal *RV) const override; - virtual std::string getAsString() const { + std::string getAsString() const override { return Rec->getAsString() + "." + FieldName; } }; @@ -1285,7 +1283,7 @@ public: void Profile(FoldingSetNodeID &ID) const; - virtual Init *convertInitializerTo(RecTy *Ty) const { + Init *convertInitializerTo(RecTy *Ty) const override { return Ty->convertValue(const_cast(this)); } @@ -1303,9 +1301,9 @@ public: return ArgNames[Num]; } - virtual Init *resolveReferences(Record &R, const RecordVal *RV) const; + Init *resolveReferences(Record &R, const RecordVal *RV) const override; - virtual std::string getAsString() const; + std::string getAsString() const override; typedef std::vector::const_iterator const_arg_iterator; typedef std::vector::const_iterator const_name_iterator; @@ -1322,12 +1320,12 @@ public: inline size_t name_size () const { return ArgNames.size(); } inline bool name_empty() const { return ArgNames.empty(); } - virtual Init *getBit(unsigned Bit) const { + Init *getBit(unsigned Bit) const override { llvm_unreachable("Illegal bit reference off dag"); } - virtual Init *resolveListElementReference(Record &R, const RecordVal *RV, - unsigned Elt) const { + Init *resolveListElementReference(Record &R, const RecordVal *RV, + unsigned Elt) const override { llvm_unreachable("Illegal element reference off dag"); } }; diff --git a/llvm/utils/TableGen/CodeGenRegisters.cpp b/llvm/utils/TableGen/CodeGenRegisters.cpp index 00bdb4263d6c..b0d398d36535 100644 --- a/llvm/utils/TableGen/CodeGenRegisters.cpp +++ b/llvm/utils/TableGen/CodeGenRegisters.cpp @@ -550,7 +550,7 @@ unsigned CodeGenRegister::getWeight(const CodeGenRegBank &RegBank) const { // registers. namespace { struct TupleExpander : SetTheory::Expander { - void expand(SetTheory &ST, Record *Def, SetTheory::RecSet &Elts) { + void expand(SetTheory &ST, Record *Def, SetTheory::RecSet &Elts) override { std::vector Indices = Def->getValueAsListOfDefs("SubRegIndices"); unsigned Dim = Indices.size(); ListInit *SubRegs = Def->getValueAsListInit("SubRegs"); diff --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp index 39af61f75644..c84fe6d82d7a 100644 --- a/llvm/utils/TableGen/CodeGenSchedule.cpp +++ b/llvm/utils/TableGen/CodeGenSchedule.cpp @@ -39,8 +39,8 @@ static void dumpIdxVec(const SmallVectorImpl &V) { namespace { // (instrs a, b, ...) Evaluate and union all arguments. Identical to AddOp. struct InstrsOp : public SetTheory::Operator { - virtual void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef Loc) { + void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, + ArrayRef Loc) override { ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc); } }; @@ -58,7 +58,7 @@ struct InstRegexOp : public SetTheory::Operator { InstRegexOp(const CodeGenTarget &t): Target(t) {} void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, - ArrayRef Loc) { + ArrayRef Loc) override { SmallVector RegexList; for (DagInit::const_arg_iterator AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) { diff --git a/llvm/utils/TableGen/DAGISelMatcher.h b/llvm/utils/TableGen/DAGISelMatcher.h index 97b81e54bef1..bf760d5034d7 100644 --- a/llvm/utils/TableGen/DAGISelMatcher.h +++ b/llvm/utils/TableGen/DAGISelMatcher.h @@ -226,9 +226,9 @@ public: } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { return false; } - virtual unsigned getHashImpl() const { return 12312; } + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return false; } + unsigned getHashImpl() const override { return 12312; } }; /// RecordMatcher - Save the current node in the operand list. @@ -251,11 +251,11 @@ public: return N->getKind() == RecordNode; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { return true; } - virtual unsigned getHashImpl() const { return 0; } + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return true; } + unsigned getHashImpl() const override { return 0; } }; /// RecordChildMatcher - Save a numbered child of the current node, or fail @@ -285,14 +285,14 @@ public: return N->getKind() == RecordChild; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->getChildNo() == getChildNo(); } - virtual unsigned getHashImpl() const { return getChildNo(); } + unsigned getHashImpl() const override { return getChildNo(); } }; /// RecordMemRefMatcher - Save the current node's memref. @@ -304,12 +304,12 @@ public: return N->getKind() == RecordMemRef; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { return true; } - virtual unsigned getHashImpl() const { return 0; } + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return true; } + unsigned getHashImpl() const override { return 0; } }; @@ -323,12 +323,12 @@ public: return N->getKind() == CaptureGlueInput; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { return true; } - virtual unsigned getHashImpl() const { return 0; } + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return true; } + unsigned getHashImpl() const override { return 0; } }; /// MoveChildMatcher - This tells the interpreter to move into the @@ -344,14 +344,14 @@ public: return N->getKind() == MoveChild; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->getChildNo() == getChildNo(); } - virtual unsigned getHashImpl() const { return getChildNo(); } + unsigned getHashImpl() const override { return getChildNo(); } }; /// MoveParentMatcher - This tells the interpreter to move to the parent @@ -364,12 +364,12 @@ public: return N->getKind() == MoveParent; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { return true; } - virtual unsigned getHashImpl() const { return 0; } + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return true; } + unsigned getHashImpl() const override { return 0; } }; /// CheckSameMatcher - This checks to see if this node is exactly the same @@ -387,14 +387,14 @@ public: return N->getKind() == CheckSame; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->getMatchNumber() == getMatchNumber(); } - virtual unsigned getHashImpl() const { return getMatchNumber(); } + unsigned getHashImpl() const override { return getMatchNumber(); } }; /// CheckChildSameMatcher - This checks to see if child node is exactly the same @@ -414,15 +414,15 @@ public: return N->getKind() == CheckChildSame; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->ChildNo == ChildNo && cast(M)->MatchNumber == MatchNumber; } - virtual unsigned getHashImpl() const { return (MatchNumber << 2) | ChildNo; } + unsigned getHashImpl() const override { return (MatchNumber << 2) | ChildNo; } }; /// CheckPatternPredicateMatcher - This checks the target-specific predicate @@ -440,14 +440,14 @@ public: return N->getKind() == CheckPatternPredicate; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->getPredicate() == Predicate; } - virtual unsigned getHashImpl() const; + unsigned getHashImpl() const override; }; /// CheckPredicateMatcher - This checks the target-specific predicate to @@ -467,11 +467,11 @@ public: //virtual bool isSafeToReorderWithPatternPredicate() const { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->Pred == Pred; } - virtual unsigned getHashImpl() const; + unsigned getHashImpl() const override; }; @@ -489,13 +489,13 @@ public: return N->getKind() == CheckOpcode; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const; - virtual unsigned getHashImpl() const; - virtual bool isContradictoryImpl(const Matcher *M) const; + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override; + unsigned getHashImpl() const override; + bool isContradictoryImpl(const Matcher *M) const override; }; /// SwitchOpcodeMatcher - Switch based on the current node's opcode, dispatching @@ -520,9 +520,9 @@ public: const Matcher *getCaseMatcher(unsigned i) const { return Cases[i].second; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { return false; } - virtual unsigned getHashImpl() const { return 4123; } + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return false; } + unsigned getHashImpl() const override { return 4123; } }; /// CheckTypeMatcher - This checks to see if the current node has the @@ -541,15 +541,15 @@ public: return N->getKind() == CheckType; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->Type == Type; } - virtual unsigned getHashImpl() const { return Type; } - virtual bool isContradictoryImpl(const Matcher *M) const; + unsigned getHashImpl() const override { return Type; } + bool isContradictoryImpl(const Matcher *M) const override; }; /// SwitchTypeMatcher - Switch based on the current node's type, dispatching @@ -574,9 +574,9 @@ public: const Matcher *getCaseMatcher(unsigned i) const { return Cases[i].second; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { return false; } - virtual unsigned getHashImpl() const { return 4123; } + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return false; } + unsigned getHashImpl() const override { return 4123; } }; @@ -596,16 +596,16 @@ public: return N->getKind() == CheckChildType; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->ChildNo == ChildNo && cast(M)->Type == Type; } - virtual unsigned getHashImpl() const { return (Type << 3) | ChildNo; } - virtual bool isContradictoryImpl(const Matcher *M) const; + unsigned getHashImpl() const override { return (Type << 3) | ChildNo; } + bool isContradictoryImpl(const Matcher *M) const override; }; @@ -623,15 +623,15 @@ public: return N->getKind() == CheckInteger; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->Value == Value; } - virtual unsigned getHashImpl() const { return Value; } - virtual bool isContradictoryImpl(const Matcher *M) const; + unsigned getHashImpl() const override { return Value; } + bool isContradictoryImpl(const Matcher *M) const override; }; /// CheckChildIntegerMatcher - This checks to see if the child node is a @@ -650,16 +650,16 @@ public: return N->getKind() == CheckChildInteger; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->ChildNo == ChildNo && cast(M)->Value == Value; } - virtual unsigned getHashImpl() const { return (Value << 3) | ChildNo; } - virtual bool isContradictoryImpl(const Matcher *M) const; + unsigned getHashImpl() const override { return (Value << 3) | ChildNo; } + bool isContradictoryImpl(const Matcher *M) const override; }; /// CheckCondCodeMatcher - This checks to see if the current node is a @@ -676,14 +676,14 @@ public: return N->getKind() == CheckCondCode; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->CondCodeName == CondCodeName; } - virtual unsigned getHashImpl() const; + unsigned getHashImpl() const override; }; /// CheckValueTypeMatcher - This checks to see if the current node is a @@ -700,15 +700,15 @@ public: return N->getKind() == CheckValueType; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->TypeName == TypeName; } - virtual unsigned getHashImpl() const; - bool isContradictoryImpl(const Matcher *M) const; + unsigned getHashImpl() const override; + bool isContradictoryImpl(const Matcher *M) const override; }; @@ -745,15 +745,15 @@ public: } // Not safe to move a pattern predicate past a complex pattern. - virtual bool isSafeToReorderWithPatternPredicate() const { return false; } + bool isSafeToReorderWithPatternPredicate() const override { return false; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return &cast(M)->Pattern == &Pattern && cast(M)->MatchNumber == MatchNumber; } - virtual unsigned getHashImpl() const { + unsigned getHashImpl() const override { return (unsigned)(intptr_t)&Pattern ^ MatchNumber; } }; @@ -772,14 +772,14 @@ public: return N->getKind() == CheckAndImm; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->Value == Value; } - virtual unsigned getHashImpl() const { return Value; } + unsigned getHashImpl() const override { return Value; } }; /// CheckOrImmMatcher - This checks to see if the current node is an 'and' @@ -796,14 +796,14 @@ public: return N->getKind() == CheckOrImm; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->Value == Value; } - virtual unsigned getHashImpl() const { return Value; } + unsigned getHashImpl() const override { return Value; } }; /// CheckFoldableChainNodeMatcher - This checks to see if the current node @@ -817,12 +817,12 @@ public: return N->getKind() == CheckFoldableChainNode; } - virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + bool isSafeToReorderWithPatternPredicate() const override { return true; } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { return true; } - virtual unsigned getHashImpl() const { return 0; } + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return true; } + unsigned getHashImpl() const override { return 0; } }; /// EmitIntegerMatcher - This creates a new TargetConstant. @@ -841,12 +841,12 @@ public: } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->Val == Val && cast(M)->VT == VT; } - virtual unsigned getHashImpl() const { return (Val << 4) | VT; } + unsigned getHashImpl() const override { return (Val << 4) | VT; } }; /// EmitStringIntegerMatcher - A target constant whose value is represented @@ -866,12 +866,12 @@ public: } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->Val == Val && cast(M)->VT == VT; } - virtual unsigned getHashImpl() const; + unsigned getHashImpl() const override; }; /// EmitRegisterMatcher - This creates a new TargetConstant. @@ -892,12 +892,12 @@ public: } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->Reg == Reg && cast(M)->VT == VT; } - virtual unsigned getHashImpl() const { + unsigned getHashImpl() const override { return ((unsigned)(intptr_t)Reg) << 4 | VT; } }; @@ -918,11 +918,11 @@ public: } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->Slot == Slot; } - virtual unsigned getHashImpl() const { return Slot; } + unsigned getHashImpl() const override { return Slot; } }; /// EmitMergeInputChainsMatcher - Emit a node that merges a list of input @@ -947,11 +947,11 @@ public: } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->ChainNodes == ChainNodes; } - virtual unsigned getHashImpl() const; + unsigned getHashImpl() const override; }; /// EmitCopyToRegMatcher - Emit a CopyToReg node from a value to a physreg, @@ -972,12 +972,12 @@ public: } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->SrcSlot == SrcSlot && cast(M)->DestPhysReg == DestPhysReg; } - virtual unsigned getHashImpl() const { + unsigned getHashImpl() const override { return SrcSlot ^ ((unsigned)(intptr_t)DestPhysReg << 4); } }; @@ -1001,12 +1001,12 @@ public: } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->Slot == Slot && cast(M)->NodeXForm == NodeXForm; } - virtual unsigned getHashImpl() const { + unsigned getHashImpl() const override { return Slot ^ ((unsigned)(intptr_t)NodeXForm << 4); } }; @@ -1064,14 +1064,14 @@ public: } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const; - virtual unsigned getHashImpl() const; + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override; + unsigned getHashImpl() const override; }; /// EmitNodeMatcher - This signals a successful match and generates a node. class EmitNodeMatcher : public EmitNodeMatcherCommon { - virtual void anchor(); + void anchor() override; unsigned FirstResultSlot; public: EmitNodeMatcher(const std::string &opcodeName, @@ -1094,7 +1094,7 @@ public: }; class MorphNodeToMatcher : public EmitNodeMatcherCommon { - virtual void anchor(); + void anchor() override; const PatternToMatch &Pattern; public: MorphNodeToMatcher(const std::string &opcodeName, @@ -1137,11 +1137,11 @@ public: } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->GlueResultNodes == GlueResultNodes; } - virtual unsigned getHashImpl() const; + unsigned getHashImpl() const override; }; /// CompleteMatchMatcher - Complete a match by replacing the results of the @@ -1165,12 +1165,12 @@ public: } private: - virtual void printImpl(raw_ostream &OS, unsigned indent) const; - virtual bool isEqualImpl(const Matcher *M) const { + void printImpl(raw_ostream &OS, unsigned indent) const override; + bool isEqualImpl(const Matcher *M) const override { return cast(M)->Results == Results && &cast(M)->Pattern == &Pattern; } - virtual unsigned getHashImpl() const; + unsigned getHashImpl() const override; }; } // end namespace llvm diff --git a/llvm/utils/TableGen/SetTheory.cpp b/llvm/utils/TableGen/SetTheory.cpp index ad3d7c7e1893..d952e6811d27 100644 --- a/llvm/utils/TableGen/SetTheory.cpp +++ b/llvm/utils/TableGen/SetTheory.cpp @@ -27,16 +27,16 @@ typedef SetTheory::RecVec RecVec; // (add a, b, ...) Evaluate and union all arguments. struct AddOp : public SetTheory::Operator { - virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, - ArrayRef Loc) { + void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, + ArrayRef Loc) override { ST.evaluate(Expr->arg_begin(), Expr->arg_end(), Elts, Loc); } }; // (sub Add, Sub, ...) Set difference. struct SubOp : public SetTheory::Operator { - virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, - ArrayRef Loc) { + void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, + ArrayRef Loc) override { if (Expr->arg_size() < 2) PrintFatalError(Loc, "Set difference needs at least two arguments: " + Expr->getAsString()); @@ -51,8 +51,8 @@ struct SubOp : public SetTheory::Operator { // (and S1, S2) Set intersection. struct AndOp : public SetTheory::Operator { - virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, - ArrayRef Loc) { + void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, + ArrayRef Loc) override { if (Expr->arg_size() != 2) PrintFatalError(Loc, "Set intersection requires two arguments: " + Expr->getAsString()); @@ -67,12 +67,11 @@ struct AndOp : public SetTheory::Operator { // SetIntBinOp - Abstract base class for (Op S, N) operators. struct SetIntBinOp : public SetTheory::Operator { - virtual void apply2(SetTheory &ST, DagInit *Expr, - RecSet &Set, int64_t N, - RecSet &Elts, ArrayRef Loc) =0; + virtual void apply2(SetTheory &ST, DagInit *Expr, RecSet &Set, int64_t N, + RecSet &Elts, ArrayRef Loc) = 0; - virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, - ArrayRef Loc) { + void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, + ArrayRef Loc) override { if (Expr->arg_size() != 2) PrintFatalError(Loc, "Operator requires (Op Set, Int) arguments: " + Expr->getAsString()); @@ -88,9 +87,8 @@ struct SetIntBinOp : public SetTheory::Operator { // (shl S, N) Shift left, remove the first N elements. struct ShlOp : public SetIntBinOp { - virtual void apply2(SetTheory &ST, DagInit *Expr, - RecSet &Set, int64_t N, - RecSet &Elts, ArrayRef Loc) { + void apply2(SetTheory &ST, DagInit *Expr, RecSet &Set, int64_t N, + RecSet &Elts, ArrayRef Loc) override { if (N < 0) PrintFatalError(Loc, "Positive shift required: " + Expr->getAsString()); @@ -101,9 +99,8 @@ struct ShlOp : public SetIntBinOp { // (trunc S, N) Truncate after the first N elements. struct TruncOp : public SetIntBinOp { - virtual void apply2(SetTheory &ST, DagInit *Expr, - RecSet &Set, int64_t N, - RecSet &Elts, ArrayRef Loc) { + void apply2(SetTheory &ST, DagInit *Expr, RecSet &Set, int64_t N, + RecSet &Elts, ArrayRef Loc) override { if (N < 0) PrintFatalError(Loc, "Positive length required: " + Expr->getAsString()); @@ -119,9 +116,8 @@ struct RotOp : public SetIntBinOp { RotOp(bool Rev) : Reverse(Rev) {} - virtual void apply2(SetTheory &ST, DagInit *Expr, - RecSet &Set, int64_t N, - RecSet &Elts, ArrayRef Loc) { + void apply2(SetTheory &ST, DagInit *Expr, RecSet &Set, int64_t N, + RecSet &Elts, ArrayRef Loc) override { if (Reverse) N = -N; // N > 0 -> rotate left, N < 0 -> rotate right. @@ -138,9 +134,8 @@ struct RotOp : public SetIntBinOp { // (decimate S, N) Pick every N'th element of S. struct DecimateOp : public SetIntBinOp { - virtual void apply2(SetTheory &ST, DagInit *Expr, - RecSet &Set, int64_t N, - RecSet &Elts, ArrayRef Loc) { + void apply2(SetTheory &ST, DagInit *Expr, RecSet &Set, int64_t N, + RecSet &Elts, ArrayRef Loc) override { if (N <= 0) PrintFatalError(Loc, "Positive stride required: " + Expr->getAsString()); @@ -151,8 +146,8 @@ struct DecimateOp : public SetIntBinOp { // (interleave S1, S2, ...) Interleave elements of the arguments. struct InterleaveOp : public SetTheory::Operator { - virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, - ArrayRef Loc) { + void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, + ArrayRef Loc) override { // Evaluate the arguments individually. SmallVector Args(Expr->getNumArgs()); unsigned MaxSize = 0; @@ -170,8 +165,8 @@ struct InterleaveOp : public SetTheory::Operator { // (sequence "Format", From, To) Generate a sequence of records by name. struct SequenceOp : public SetTheory::Operator { - virtual void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, - ArrayRef Loc) { + void apply(SetTheory &ST, DagInit *Expr, RecSet &Elts, + ArrayRef Loc) override { int Step = 1; if (Expr->arg_size() > 4) PrintFatalError(Loc, "Bad args to (sequence \"Format\", From, To): " + @@ -238,7 +233,7 @@ struct FieldExpander : public SetTheory::Expander { FieldExpander(StringRef fn) : FieldName(fn) {} - virtual void expand(SetTheory &ST, Record *Def, RecSet &Elts) { + void expand(SetTheory &ST, Record *Def, RecSet &Elts) override { ST.evaluate(Def->getValueInit(FieldName), Elts, Def->getLoc()); } }; diff --git a/llvm/utils/TableGen/X86ModRMFilters.h b/llvm/utils/TableGen/X86ModRMFilters.h index 049cfc1d3b54..fac38389eadd 100644 --- a/llvm/utils/TableGen/X86ModRMFilters.h +++ b/llvm/utils/TableGen/X86ModRMFilters.h @@ -50,13 +50,13 @@ public: /// require a ModR/M byte or instructions where the entire ModR/M byte is used /// for operands. class DumbFilter : public ModRMFilter { - virtual void anchor(); + void anchor() override; public: - bool isDumb() const { + bool isDumb() const override { return true; } - - bool accepts(uint8_t modRM) const { + + bool accepts(uint8_t modRM) const override { return true; } }; @@ -65,7 +65,7 @@ public: /// Some instructions are classified based on whether they are 11 or anything /// else. This filter performs that classification. class ModFilter : public ModRMFilter { - virtual void anchor(); + void anchor() override; bool R; public: /// Constructor @@ -79,7 +79,7 @@ public: R(r) { } - bool accepts(uint8_t modRM) const { + bool accepts(uint8_t modRM) const override { return (R == ((modRM & 0xc0) == 0xc0)); } }; @@ -87,7 +87,7 @@ public: /// ExtendedFilter - Extended opcodes are classified based on the value of the /// mod field [bits 7-6] and the value of the nnn field [bits 5-3]. class ExtendedFilter : public ModRMFilter { - virtual void anchor(); + void anchor() override; bool R; uint8_t NNN; public: @@ -102,7 +102,7 @@ public: NNN(nnn) { } - bool accepts(uint8_t modRM) const { + bool accepts(uint8_t modRM) const override { return (((R && ((modRM & 0xc0) == 0xc0)) || (!R && ((modRM & 0xc0) != 0xc0))) && (((modRM & 0x38) >> 3) == NNN)); @@ -112,7 +112,7 @@ public: /// ExactFilter - The occasional extended opcode (such as VMCALL or MONITOR) /// requires the ModR/M byte to have a specific value. class ExactFilter : public ModRMFilter { - virtual void anchor(); + void anchor() override; uint8_t ModRM; public: /// Constructor @@ -123,7 +123,7 @@ public: ModRM(modRM) { } - bool accepts(uint8_t modRM) const { + bool accepts(uint8_t modRM) const override { return (ModRM == modRM); } };