From 0bfd526b6b5b3173bfabf6fd5a5b02369fb8b132 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 5 Mar 2014 05:17:42 +0000 Subject: [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 --- utils/TableGen/CodeGenRegisters.cpp | 2 +- utils/TableGen/CodeGenSchedule.cpp | 6 +- utils/TableGen/DAGISelMatcher.h | 260 ++++++++++++++++++------------------ utils/TableGen/SetTheory.cpp | 51 ++++--- utils/TableGen/X86ModRMFilters.h | 20 +-- 5 files changed, 167 insertions(+), 172 deletions(-) (limited to 'utils') diff --git a/utils/TableGen/CodeGenRegisters.cpp b/utils/TableGen/CodeGenRegisters.cpp index 00bdb4263d..b0d398d365 100644 --- a/utils/TableGen/CodeGenRegisters.cpp +++ b/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/utils/TableGen/CodeGenSchedule.cpp b/utils/TableGen/CodeGenSchedule.cpp index 39af61f756..c84fe6d82d 100644 --- a/utils/TableGen/CodeGenSchedule.cpp +++ b/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/utils/TableGen/DAGISelMatcher.h b/utils/TableGen/DAGISelMatcher.h index 97b81e54be..bf760d5034 100644 --- a/utils/TableGen/DAGISelMatcher.h +++ b/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/utils/TableGen/SetTheory.cpp b/utils/TableGen/SetTheory.cpp index ad3d7c7e18..d952e6811d 100644 --- a/utils/TableGen/SetTheory.cpp +++ b/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/utils/TableGen/X86ModRMFilters.h b/utils/TableGen/X86ModRMFilters.h index 049cfc1d3b..fac38389ea 100644 --- a/utils/TableGen/X86ModRMFilters.h +++ b/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); } }; -- cgit v1.2.3