[PATCH] D156967: [SelectionDAG] Encode CheckPatternPredicate num in VBR format to expand the range it can represents
Zixuan Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 3 01:54:20 PDT 2023
zixuan-wu updated this revision to Diff 546748.
zixuan-wu retitled this revision from "[PoC][SelectionDAG] Upgrade the MatcherTable type from unsigned char to unsigned short" to "[SelectionDAG] Encode CheckPatternPredicate num in VBR format to expand the range it can represents".
zixuan-wu edited the summary of this revision.
zixuan-wu added a comment.
Address comments.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156967/new/
https://reviews.llvm.org/D156967
Files:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
Index: llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
===================================================================
--- llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -473,11 +473,13 @@
case Matcher::CheckPatternPredicate: {
StringRef Pred =cast<CheckPatternPredicateMatcher>(N)->getPredicate();
- OS << "OPC_CheckPatternPredicate, " << getPatternPredicate(Pred) << ',';
+ OS << "OPC_CheckPatternPredicate, ";
+ unsigned Bytes =
+ 1 + EmitVBRValue(getPatternPredicate(Pred), OS);
if (!OmitComments)
OS << " // " << Pred;
OS << '\n';
- return 2;
+ return Bytes;
}
case Matcher::CheckPredicate: {
TreePredicateFn Pred = cast<CheckPredicateMatcher>(N)->getPredicate();
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -2640,7 +2640,11 @@
LLVM_ATTRIBUTE_ALWAYS_INLINE static bool
CheckPatternPredicate(const unsigned char *MatcherTable, unsigned &MatcherIndex,
const SelectionDAGISel &SDISel) {
- return SDISel.CheckPatternPredicate(MatcherTable[MatcherIndex++]);
+ int64_t Val = MatcherTable[MatcherIndex++];
+ if (Val & 128)
+ Val = GetVBR(Val, MatcherTable, MatcherIndex);
+
+ return SDISel.CheckPatternPredicate(Val);
}
/// CheckNodePredicate - Implements OP_CheckNodePredicate.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156967.546748.patch
Type: text/x-patch
Size: 1522 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230803/d1ae9095/attachment.bin>
More information about the llvm-commits
mailing list