X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2FTableGen%2FDAGISelMatcher.h;h=f978188aae596922b4e4908348bf8fd958ccaa2f;hb=fc699872e35ec794d7373680be6f1946fe8e9ca6;hp=8e6e44647ea1f8d97cd28585831cd1daeeee8e0a;hpb=036609bd7d42ed1f57865969e059eb7d1eb6c392;p=oota-llvm.git diff --git a/utils/TableGen/DAGISelMatcher.h b/utils/TableGen/DAGISelMatcher.h index 8e6e44647ea..f978188aae5 100644 --- a/utils/TableGen/DAGISelMatcher.h +++ b/utils/TableGen/DAGISelMatcher.h @@ -10,13 +10,14 @@ #ifndef TBLGEN_DAGISELMATCHER_H #define TBLGEN_DAGISELMATCHER_H -#include "llvm/CodeGen/ValueTypes.h" #include "llvm/ADT/OwningPtr.h" -#include "llvm/ADT/StringRef.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/CodeGen/ValueTypes.h" #include "llvm/Support/Casting.h" namespace llvm { + struct CodeGenRegister; class CodeGenDAGPatterns; class Matcher; class PatternToMatch; @@ -24,6 +25,8 @@ namespace llvm { class ComplexPattern; class Record; class SDNodeInfo; + class TreePredicateFn; + class TreePattern; Matcher *ConvertPatternToMatcher(const PatternToMatch &Pattern,unsigned Variant, const CodeGenDAGPatterns &CGP); @@ -32,12 +35,13 @@ void EmitMatcherTable(const Matcher *Matcher, const CodeGenDAGPatterns &CGP, raw_ostream &OS); -/// Matcher - Base class for all the the DAG ISel Matcher representation +/// Matcher - Base class for all the DAG ISel Matcher representation /// nodes. class Matcher { // The next matcher node that is executed after this one. Null if this is the // last stage of a match. OwningPtr Next; + virtual void anchor(); public: enum KindTy { // Matcher state manipulation. @@ -95,8 +99,6 @@ public: OwningPtr &getNextPtr() { return Next; } - static inline bool classof(const Matcher *) { return true; } - bool isEqual(const Matcher *M) const { if (getKind() != M->getKind()) return false; return isEqualImpl(M); @@ -418,12 +420,11 @@ private: /// CheckPredicateMatcher - This checks the target-specific predicate to /// see if the node is acceptable. class CheckPredicateMatcher : public Matcher { - StringRef PredName; + TreePattern *Pred; public: - CheckPredicateMatcher(StringRef predname) - : Matcher(CheckPredicate), PredName(predname) {} + CheckPredicateMatcher(const TreePredicateFn &pred); - StringRef getPredicateName() const { return PredName; } + TreePredicateFn getPredicate() const; static inline bool classof(const Matcher *N) { return N->getKind() == CheckPredicate; @@ -435,7 +436,7 @@ public: private: virtual void printImpl(raw_ostream &OS, unsigned indent) const; virtual bool isEqualImpl(const Matcher *M) const { - return cast(M)->PredName == PredName; + return cast(M)->Pred == Pred; } virtual unsigned getHashImpl() const; }; @@ -816,13 +817,13 @@ private: class EmitRegisterMatcher : public Matcher { /// Reg - The def for the register that we're emitting. If this is null, then /// this is a reference to zero_reg. - Record *Reg; + const CodeGenRegister *Reg; MVT::SimpleValueType VT; public: - EmitRegisterMatcher(Record *reg, MVT::SimpleValueType vt) + EmitRegisterMatcher(const CodeGenRegister *reg, MVT::SimpleValueType vt) : Matcher(EmitRegister), Reg(reg), VT(vt) {} - Record *getReg() const { return Reg; } + const CodeGenRegister *getReg() const { return Reg; } MVT::SimpleValueType getVT() const { return VT; } static inline bool classof(const Matcher *N) { @@ -1009,6 +1010,7 @@ private: /// EmitNodeMatcher - This signals a successful match and generates a node. class EmitNodeMatcher : public EmitNodeMatcherCommon { + virtual void anchor(); unsigned FirstResultSlot; public: EmitNodeMatcher(const std::string &opcodeName, @@ -1031,6 +1033,7 @@ public: }; class MorphNodeToMatcher : public EmitNodeMatcherCommon { + virtual void anchor(); const PatternToMatch &Pattern; public: MorphNodeToMatcher(const std::string &opcodeName,