aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen/DAGISelMatcher.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/TableGen/DAGISelMatcher.h')
-rw-r--r--utils/TableGen/DAGISelMatcher.h336
1 files changed, 183 insertions, 153 deletions
diff --git a/utils/TableGen/DAGISelMatcher.h b/utils/TableGen/DAGISelMatcher.h
index 70031fa..56a571f 100644
--- a/utils/TableGen/DAGISelMatcher.h
+++ b/utils/TableGen/DAGISelMatcher.h
@@ -10,10 +10,10 @@
#ifndef TBLGEN_DAGISELMATCHER_H
#define TBLGEN_DAGISELMATCHER_H
-#include "llvm/ADT/OwningPtr.h"
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/CodeGen/ValueTypes.h"
+#include "llvm/CodeGen/MachineValueType.h"
#include "llvm/Support/Casting.h"
namespace llvm {
@@ -40,7 +40,7 @@ void EmitMatcherTable(const Matcher *Matcher, const CodeGenDAGPatterns &CGP,
class Matcher {
// The next matcher node that is executed after this one. Null if this is the
// last stage of a match.
- OwningPtr<Matcher> Next;
+ std::unique_ptr<Matcher> Next;
virtual void anchor();
public:
enum KindTy {
@@ -64,6 +64,7 @@ public:
SwitchType, // Dispatch based on type.
CheckChildType, // Fail if child has wrong type.
CheckInteger, // Fail if wrong val.
+ CheckChildInteger, // Fail if child is wrong val.
CheckCondCode, // Fail if not condcode.
CheckValueType,
CheckComplexPat,
@@ -96,9 +97,9 @@ public:
Matcher *getNext() { return Next.get(); }
const Matcher *getNext() const { return Next.get(); }
void setNext(Matcher *C) { Next.reset(C); }
- Matcher *takeNext() { return Next.take(); }
+ Matcher *takeNext() { return Next.release(); }
- OwningPtr<Matcher> &getNextPtr() { return Next; }
+ std::unique_ptr<Matcher> &getNextPtr() { return Next; }
bool isEqual(const Matcher *M) const {
if (getKind() != M->getKind()) return false;
@@ -130,6 +131,7 @@ public:
case CheckType:
case CheckChildType:
case CheckInteger:
+ case CheckChildInteger:
case CheckCondCode:
case CheckValueType:
case CheckAndImm:
@@ -188,8 +190,8 @@ protected:
class ScopeMatcher : public Matcher {
SmallVector<Matcher*, 4> Children;
public:
- ScopeMatcher(Matcher *const *children, unsigned numchildren)
- : Matcher(Scope), Children(children, children+numchildren) {
+ ScopeMatcher(ArrayRef<Matcher *> children)
+ : Matcher(Scope), Children(children.begin(), children.end()) {
}
virtual ~ScopeMatcher();
@@ -223,9 +225,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.
@@ -248,11 +250,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
@@ -282,14 +284,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<RecordChildMatcher>(M)->getChildNo() == getChildNo();
}
- virtual unsigned getHashImpl() const { return getChildNo(); }
+ unsigned getHashImpl() const override { return getChildNo(); }
};
/// RecordMemRefMatcher - Save the current node's memref.
@@ -301,12 +303,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; }
};
@@ -320,12 +322,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
@@ -341,14 +343,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<MoveChildMatcher>(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
@@ -361,12 +363,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
@@ -384,14 +386,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<CheckSameMatcher>(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
@@ -411,15 +413,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<CheckChildSameMatcher>(M)->ChildNo == ChildNo &&
cast<CheckChildSameMatcher>(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
@@ -437,14 +439,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<CheckPatternPredicateMatcher>(M)->getPredicate() == Predicate;
}
- virtual unsigned getHashImpl() const;
+ unsigned getHashImpl() const override;
};
/// CheckPredicateMatcher - This checks the target-specific predicate to
@@ -464,11 +466,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<CheckPredicateMatcher>(M)->Pred == Pred;
}
- virtual unsigned getHashImpl() const;
+ unsigned getHashImpl() const override;
};
@@ -486,13 +488,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
@@ -502,9 +504,9 @@ private:
class SwitchOpcodeMatcher : public Matcher {
SmallVector<std::pair<const SDNodeInfo*, Matcher*>, 8> Cases;
public:
- SwitchOpcodeMatcher(const std::pair<const SDNodeInfo*, Matcher*> *cases,
- unsigned numcases)
- : Matcher(SwitchOpcode), Cases(cases, cases+numcases) {}
+ SwitchOpcodeMatcher(ArrayRef<std::pair<const SDNodeInfo*, Matcher*> > cases)
+ : Matcher(SwitchOpcode), Cases(cases.begin(), cases.end()) {}
+ virtual ~SwitchOpcodeMatcher();
static inline bool classof(const Matcher *N) {
return N->getKind() == SwitchOpcode;
@@ -517,9 +519,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
@@ -538,15 +540,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<CheckTypeMatcher>(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
@@ -556,9 +558,9 @@ private:
class SwitchTypeMatcher : public Matcher {
SmallVector<std::pair<MVT::SimpleValueType, Matcher*>, 8> Cases;
public:
- SwitchTypeMatcher(const std::pair<MVT::SimpleValueType, Matcher*> *cases,
- unsigned numcases)
- : Matcher(SwitchType), Cases(cases, cases+numcases) {}
+ SwitchTypeMatcher(ArrayRef<std::pair<MVT::SimpleValueType, Matcher*> > cases)
+ : Matcher(SwitchType), Cases(cases.begin(), cases.end()) {}
+ virtual ~SwitchTypeMatcher();
static inline bool classof(const Matcher *N) {
return N->getKind() == SwitchType;
@@ -571,9 +573,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; }
};
@@ -593,16 +595,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<CheckChildTypeMatcher>(M)->ChildNo == ChildNo &&
cast<CheckChildTypeMatcher>(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;
};
@@ -620,15 +622,43 @@ 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<CheckIntegerMatcher>(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
+/// ConstantSDNode with a specified integer value, if not it fails to match.
+class CheckChildIntegerMatcher : public Matcher {
+ unsigned ChildNo;
+ int64_t Value;
+public:
+ CheckChildIntegerMatcher(unsigned childno, int64_t value)
+ : Matcher(CheckChildInteger), ChildNo(childno), Value(value) {}
+
+ unsigned getChildNo() const { return ChildNo; }
+ int64_t getValue() const { return Value; }
+
+ static inline bool classof(const Matcher *N) {
+ return N->getKind() == CheckChildInteger;
+ }
+
+ bool isSafeToReorderWithPatternPredicate() const override { return true; }
+
+private:
+ void printImpl(raw_ostream &OS, unsigned indent) const override;
+ bool isEqualImpl(const Matcher *M) const override {
+ return cast<CheckChildIntegerMatcher>(M)->ChildNo == ChildNo &&
+ cast<CheckChildIntegerMatcher>(M)->Value == Value;
+ }
+ 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
@@ -645,14 +675,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<CheckCondCodeMatcher>(M)->CondCodeName == CondCodeName;
}
- virtual unsigned getHashImpl() const;
+ unsigned getHashImpl() const override;
};
/// CheckValueTypeMatcher - This checks to see if the current node is a
@@ -669,15 +699,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<CheckValueTypeMatcher>(M)->TypeName == TypeName;
}
- virtual unsigned getHashImpl() const;
- bool isContradictoryImpl(const Matcher *M) const;
+ unsigned getHashImpl() const override;
+ bool isContradictoryImpl(const Matcher *M) const override;
};
@@ -714,15 +744,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<CheckComplexPatMatcher>(M)->Pattern == &Pattern &&
cast<CheckComplexPatMatcher>(M)->MatchNumber == MatchNumber;
}
- virtual unsigned getHashImpl() const {
+ unsigned getHashImpl() const override {
return (unsigned)(intptr_t)&Pattern ^ MatchNumber;
}
};
@@ -741,14 +771,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<CheckAndImmMatcher>(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'
@@ -765,14 +795,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<CheckOrImmMatcher>(M)->Value == Value;
}
- virtual unsigned getHashImpl() const { return Value; }
+ unsigned getHashImpl() const override { return Value; }
};
/// CheckFoldableChainNodeMatcher - This checks to see if the current node
@@ -786,12 +816,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.
@@ -810,12 +840,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<EmitIntegerMatcher>(M)->Val == Val &&
cast<EmitIntegerMatcher>(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
@@ -835,12 +865,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<EmitStringIntegerMatcher>(M)->Val == Val &&
cast<EmitStringIntegerMatcher>(M)->VT == VT;
}
- virtual unsigned getHashImpl() const;
+ unsigned getHashImpl() const override;
};
/// EmitRegisterMatcher - This creates a new TargetConstant.
@@ -861,12 +891,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<EmitRegisterMatcher>(M)->Reg == Reg &&
cast<EmitRegisterMatcher>(M)->VT == VT;
}
- virtual unsigned getHashImpl() const {
+ unsigned getHashImpl() const override {
return ((unsigned)(intptr_t)Reg) << 4 | VT;
}
};
@@ -887,11 +917,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<EmitConvertToTargetMatcher>(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
@@ -901,8 +931,8 @@ private:
class EmitMergeInputChainsMatcher : public Matcher {
SmallVector<unsigned, 3> ChainNodes;
public:
- EmitMergeInputChainsMatcher(const unsigned *nodes, unsigned NumNodes)
- : Matcher(EmitMergeInputChains), ChainNodes(nodes, nodes+NumNodes) {}
+ EmitMergeInputChainsMatcher(ArrayRef<unsigned> nodes)
+ : Matcher(EmitMergeInputChains), ChainNodes(nodes.begin(), nodes.end()) {}
unsigned getNumNodes() const { return ChainNodes.size(); }
@@ -916,11 +946,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<EmitMergeInputChainsMatcher>(M)->ChainNodes == ChainNodes;
}
- virtual unsigned getHashImpl() const;
+ unsigned getHashImpl() const override;
};
/// EmitCopyToRegMatcher - Emit a CopyToReg node from a value to a physreg,
@@ -941,12 +971,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<EmitCopyToRegMatcher>(M)->SrcSlot == SrcSlot &&
cast<EmitCopyToRegMatcher>(M)->DestPhysReg == DestPhysReg;
}
- virtual unsigned getHashImpl() const {
+ unsigned getHashImpl() const override {
return SrcSlot ^ ((unsigned)(intptr_t)DestPhysReg << 4);
}
};
@@ -970,12 +1000,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<EmitNodeXFormMatcher>(M)->Slot == Slot &&
cast<EmitNodeXFormMatcher>(M)->NodeXForm == NodeXForm;
}
- virtual unsigned getHashImpl() const {
+ unsigned getHashImpl() const override {
return Slot ^ ((unsigned)(intptr_t)NodeXForm << 4);
}
};
@@ -994,13 +1024,13 @@ class EmitNodeMatcherCommon : public Matcher {
int NumFixedArityOperands;
public:
EmitNodeMatcherCommon(const std::string &opcodeName,
- const MVT::SimpleValueType *vts, unsigned numvts,
- const unsigned *operands, unsigned numops,
+ ArrayRef<MVT::SimpleValueType> vts,
+ ArrayRef<unsigned> operands,
bool hasChain, bool hasInGlue, bool hasOutGlue,
bool hasmemrefs,
int numfixedarityoperands, bool isMorphNodeTo)
: Matcher(isMorphNodeTo ? MorphNodeTo : EmitNode), OpcodeName(opcodeName),
- VTs(vts, vts+numvts), Operands(operands, operands+numops),
+ VTs(vts.begin(), vts.end()), Operands(operands.begin(), operands.end()),
HasChain(hasChain), HasInGlue(hasInGlue), HasOutGlue(hasOutGlue),
HasMemRefs(hasmemrefs), NumFixedArityOperands(numfixedarityoperands) {}
@@ -1033,23 +1063,23 @@ 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,
- const MVT::SimpleValueType *vts, unsigned numvts,
- const unsigned *operands, unsigned numops,
+ ArrayRef<MVT::SimpleValueType> vts,
+ ArrayRef<unsigned> operands,
bool hasChain, bool hasInFlag, bool hasOutFlag,
bool hasmemrefs,
int numfixedarityoperands, unsigned firstresultslot)
- : EmitNodeMatcherCommon(opcodeName, vts, numvts, operands, numops, hasChain,
+ : EmitNodeMatcherCommon(opcodeName, vts, operands, hasChain,
hasInFlag, hasOutFlag, hasmemrefs,
numfixedarityoperands, false),
FirstResultSlot(firstresultslot) {}
@@ -1063,16 +1093,16 @@ public:
};
class MorphNodeToMatcher : public EmitNodeMatcherCommon {
- virtual void anchor();
+ void anchor() override;
const PatternToMatch &Pattern;
public:
MorphNodeToMatcher(const std::string &opcodeName,
- const MVT::SimpleValueType *vts, unsigned numvts,
- const unsigned *operands, unsigned numops,
+ ArrayRef<MVT::SimpleValueType> vts,
+ ArrayRef<unsigned> operands,
bool hasChain, bool hasInFlag, bool hasOutFlag,
bool hasmemrefs,
int numfixedarityoperands, const PatternToMatch &pattern)
- : EmitNodeMatcherCommon(opcodeName, vts, numvts, operands, numops, hasChain,
+ : EmitNodeMatcherCommon(opcodeName, vts, operands, hasChain,
hasInFlag, hasOutFlag, hasmemrefs,
numfixedarityoperands, true),
Pattern(pattern) {
@@ -1091,8 +1121,8 @@ public:
class MarkGlueResultsMatcher : public Matcher {
SmallVector<unsigned, 3> GlueResultNodes;
public:
- MarkGlueResultsMatcher(const unsigned *nodes, unsigned NumNodes)
- : Matcher(MarkGlueResults), GlueResultNodes(nodes, nodes+NumNodes) {}
+ MarkGlueResultsMatcher(ArrayRef<unsigned> nodes)
+ : Matcher(MarkGlueResults), GlueResultNodes(nodes.begin(), nodes.end()) {}
unsigned getNumNodes() const { return GlueResultNodes.size(); }
@@ -1106,11 +1136,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<MarkGlueResultsMatcher>(M)->GlueResultNodes == GlueResultNodes;
}
- virtual unsigned getHashImpl() const;
+ unsigned getHashImpl() const override;
};
/// CompleteMatchMatcher - Complete a match by replacing the results of the
@@ -1120,9 +1150,9 @@ class CompleteMatchMatcher : public Matcher {
SmallVector<unsigned, 2> Results;
const PatternToMatch &Pattern;
public:
- CompleteMatchMatcher(const unsigned *results, unsigned numresults,
+ CompleteMatchMatcher(ArrayRef<unsigned> results,
const PatternToMatch &pattern)
- : Matcher(CompleteMatch), Results(results, results+numresults),
+ : Matcher(CompleteMatch), Results(results.begin(), results.end()),
Pattern(pattern) {}
unsigned getNumResults() const { return Results.size(); }
@@ -1134,12 +1164,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<CompleteMatchMatcher>(M)->Results == Results &&
&cast<CompleteMatchMatcher>(M)->Pattern == &Pattern;
}
- virtual unsigned getHashImpl() const;
+ unsigned getHashImpl() const override;
};
} // end namespace llvm