diff options
Diffstat (limited to 'llvm/utils/TableGen/DAGISelMatcher.h')
-rw-r--r-- | llvm/utils/TableGen/DAGISelMatcher.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/DAGISelMatcher.h b/llvm/utils/TableGen/DAGISelMatcher.h index 4a07df8f9d4..97b81e54bef 100644 --- a/llvm/utils/TableGen/DAGISelMatcher.h +++ b/llvm/utils/TableGen/DAGISelMatcher.h @@ -65,6 +65,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, @@ -131,6 +132,7 @@ public: case CheckType: case CheckChildType: case CheckInteger: + case CheckChildInteger: case CheckCondCode: case CheckValueType: case CheckAndImm: @@ -632,6 +634,34 @@ private: virtual bool isContradictoryImpl(const Matcher *M) const; }; +/// 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; + } + + virtual bool isSafeToReorderWithPatternPredicate() const { return true; } + +private: + virtual void printImpl(raw_ostream &OS, unsigned indent) const; + virtual bool isEqualImpl(const Matcher *M) const { + return cast<CheckChildIntegerMatcher>(M)->ChildNo == ChildNo && + cast<CheckChildIntegerMatcher>(M)->Value == Value; + } + virtual unsigned getHashImpl() const { return (Value << 3) | ChildNo; } + virtual bool isContradictoryImpl(const Matcher *M) const; +}; + /// CheckCondCodeMatcher - This checks to see if the current node is a /// CondCodeSDNode with the specified condition, if not it fails to match. class CheckCondCodeMatcher : public Matcher { |