From: Craig Topper Date: Sun, 10 Mar 2019 06:44:09 +0000 (+0000) Subject: [TableGen] Make CheckImmAllOnesVMatcher and CheckImmAllZerosVMatcher contradictory... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e098bee9526aa5ae4785bbb666cff922810e484;p=llvm [TableGen] Make CheckImmAllOnesVMatcher and CheckImmAllZerosVMatcher contradictory matchers. This improves X86 factoring a little bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355785 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/TableGen/DAGISelMatcher.cpp b/utils/TableGen/DAGISelMatcher.cpp index 0c45ff1353c..b2d819cae9e 100644 --- a/utils/TableGen/DAGISelMatcher.cpp +++ b/utils/TableGen/DAGISelMatcher.cpp @@ -412,3 +412,16 @@ bool CheckValueTypeMatcher::isContradictoryImpl(const Matcher *M) const { return false; } +bool CheckImmAllOnesVMatcher::isContradictoryImpl(const Matcher *M) const { + // AllZeros is contradictory. + if (const auto *CIAZVM = dyn_cast(M)) + return true; + return false; +} + +bool CheckImmAllZerosVMatcher::isContradictoryImpl(const Matcher *M) const { + // AllOnes is contradictory. + if (const auto *CIAOVM = dyn_cast(M)) + return true; + return false; +} diff --git a/utils/TableGen/DAGISelMatcher.h b/utils/TableGen/DAGISelMatcher.h index 24932e64cb4..0a782e84a37 100644 --- a/utils/TableGen/DAGISelMatcher.h +++ b/utils/TableGen/DAGISelMatcher.h @@ -770,6 +770,7 @@ public: private: void printImpl(raw_ostream &OS, unsigned indent) const override; bool isEqualImpl(const Matcher *M) const override { return true; } + bool isContradictoryImpl(const Matcher *M) const override; }; /// CheckImmAllZerosVMatcher - This check if the current node is an build vector @@ -785,6 +786,7 @@ public: private: void printImpl(raw_ostream &OS, unsigned indent) const override; bool isEqualImpl(const Matcher *M) const override { return true; } + bool isContradictoryImpl(const Matcher *M) const override; }; /// CheckFoldableChainNodeMatcher - This checks to see if the current node