From: Craig Topper Date: Wed, 27 Jan 2021 03:41:52 +0000 (-0800) Subject: [TableGen] Add isContradictoryImpl implementation to CheckCondCodeMatcher and CheckCh... X-Git-Tag: llvmorg-14-init~16847 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=494ac2a607f62f2725fd6fd51549e1b4a33ab0ff;p=platform%2Fupstream%2Fllvm.git [TableGen] Add isContradictoryImpl implementation to CheckCondCodeMatcher and CheckChild2CondCodeMatcher. This enables better pattern factoring in the RISCV ISel table. --- diff --git a/llvm/utils/TableGen/DAGISelMatcher.cpp b/llvm/utils/TableGen/DAGISelMatcher.cpp index bebd205..e436a93 100644 --- a/llvm/utils/TableGen/DAGISelMatcher.cpp +++ b/llvm/utils/TableGen/DAGISelMatcher.cpp @@ -421,3 +421,15 @@ bool CheckImmAllZerosVMatcher::isContradictoryImpl(const Matcher *M) const { // AllOnes is contradictory. return isa(M); } + +bool CheckCondCodeMatcher::isContradictoryImpl(const Matcher *M) const { + if (const auto *CCCM = dyn_cast(M)) + return CCCM->getCondCodeName() != getCondCodeName(); + return false; +} + +bool CheckChild2CondCodeMatcher::isContradictoryImpl(const Matcher *M) const { + if (const auto *CCCCM = dyn_cast(M)) + return CCCCM->getCondCodeName() != getCondCodeName(); + return false; +} diff --git a/llvm/utils/TableGen/DAGISelMatcher.h b/llvm/utils/TableGen/DAGISelMatcher.h index ff9a0cb..77280ac 100644 --- a/llvm/utils/TableGen/DAGISelMatcher.h +++ b/llvm/utils/TableGen/DAGISelMatcher.h @@ -635,6 +635,7 @@ private: bool isEqualImpl(const Matcher *M) const override { return cast(M)->CondCodeName == CondCodeName; } + bool isContradictoryImpl(const Matcher *M) const override; }; /// CheckChild2CondCodeMatcher - This checks to see if child 2 node is a @@ -656,6 +657,7 @@ private: bool isEqualImpl(const Matcher *M) const override { return cast(M)->CondCodeName == CondCodeName; } + bool isContradictoryImpl(const Matcher *M) const override; }; /// CheckValueTypeMatcher - This checks to see if the current node is a