X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2FTableGen%2FCodeGenDAGPatterns.h;h=977f75569fdd2e1eb9827d1d4985ba8cba8b5340;hb=b2a14325079f64debd7df6d5a8ed2037b3128154;hp=4434cf0c1c152c920b611661a92a192fd26153f0;hpb=e3b3a7241c01f26613694e53b26b01abf764ddfc;p=oota-llvm.git diff --git a/utils/TableGen/CodeGenDAGPatterns.h b/utils/TableGen/CodeGenDAGPatterns.h index 4434cf0c1c1..977f75569fd 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. @@ -213,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; } @@ -444,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; };