X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2FTableGen%2FCodeGenDAGPatterns.h;h=d44bfc93375e8cb27cb3336c42ced9c4db4a0479;hb=ceb4d1aecb9deffe59b3dcdc9a783ffde8477be9;hp=50c39bcf1695a01037108fc04c014c1a98dcd57d;hpb=6bd9567a6a1ba62118cdd258ddc52ea8f82ff511;p=oota-llvm.git diff --git a/utils/TableGen/CodeGenDAGPatterns.h b/utils/TableGen/CodeGenDAGPatterns.h index 50c39bcf169..d44bfc93375 100644 --- a/utils/TableGen/CodeGenDAGPatterns.h +++ b/utils/TableGen/CodeGenDAGPatterns.h @@ -16,6 +16,8 @@ #define CODEGEN_DAGPATTERNS_H #include +#include +#include #include "CodeGenTarget.h" #include "CodeGenIntrinsics.h" @@ -158,9 +160,9 @@ class TreePatternNode { /// std::string Name; - /// PredicateFn - The predicate function to execute on this node to check - /// for a match. If this string is empty, no predicate is involved. - std::string PredicateFn; + /// PredicateFns - The predicate functions to execute on this node to check + /// for a match. If this list is empty, no predicate is involved. + std::vector PredicateFns; /// TransformFn - The transformation function to execute on this node before /// it can be substituted into the resulting instruction on a pattern match. @@ -182,13 +184,14 @@ public: bool isLeaf() const { return Val != 0; } bool hasTypeSet() const { - return (Types[0] < MVT::LAST_VALUETYPE) || (Types[0] == MVT::iPTR); + return (Types[0] < MVT::LAST_VALUETYPE) || (Types[0] == MVT::iPTR) || + (Types[0] == MVT::iPTRAny); } bool isTypeCompletelyUnknown() const { return Types[0] == EMVT::isUnknown; } bool isTypeDynamicallyResolved() const { - return Types[0] == MVT::iPTR; + return (Types[0] == MVT::iPTR) || (Types[0] == MVT::iPTRAny); } MVT::SimpleValueType getTypeNum(unsigned Num) const { assert(hasTypeSet() && "Doesn't have a type yet!"); @@ -212,8 +215,18 @@ public: Children[i] = N; } - const std::string &getPredicateFn() const { return PredicateFn; } - void setPredicateFn(const std::string &Fn) { PredicateFn = Fn; } + const std::vector &getPredicateFns() const { return PredicateFns; } + void clearPredicateFns() { PredicateFns.clear(); } + void setPredicateFns(const std::vector &Fns) { + assert(PredicateFns.empty() && "Overwriting non-empty predicate list!"); + PredicateFns = Fns; + } + void addPredicateFn(const std::string &Fn) { + assert(!Fn.empty() && "Empty predicate string!"); + if (std::find(PredicateFns.begin(), PredicateFns.end(), Fn) == + PredicateFns.end()) + PredicateFns.push_back(Fn); + } Record *getTransformFn() const { return TransformFn; } void setTransformFn(Record *Fn) { TransformFn = Fn; } @@ -252,7 +265,7 @@ public: // Higher level manipulation routines. /// PatFrag references. TreePatternNode *InlinePatternFragments(TreePattern &TP); - /// ApplyTypeConstraints - Apply all of the type constraints relevent to + /// ApplyTypeConstraints - Apply all of the type constraints relevant to /// this node and its children in the tree. This returns true if it makes a /// change, false otherwise. If a type contradiction is found, throw an /// exception. @@ -443,6 +456,8 @@ struct PatternToMatch { TreePatternNode *getDstPattern() const { return DstPattern; } const std::vector &getDstRegs() const { return Dstregs; } unsigned getAddedComplexity() const { return AddedComplexity; } + + std::string getPredicateCheck() const; };