[PATCH] D37430: [TableGen] Teach tablegen to allow SDNPCommutable nodes with more than 2 operands.
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 3 20:46:19 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL312464: [TableGen] Teach tablegen to allow SDNPCommutable nodes with more than 2… (authored by ctopper).
Repository:
rL LLVM
https://reviews.llvm.org/D37430
Files:
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
Index: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
===================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -3744,7 +3744,7 @@
// If this node is commutative, consider the commuted order.
bool isCommIntrinsic = N->isCommutativeIntrinsic(CDP);
if (NodeInfo.hasProperty(SDNPCommutative) || isCommIntrinsic) {
- assert((N->getNumChildren()==2 || isCommIntrinsic) &&
+ assert((N->getNumChildren()>=2 || isCommIntrinsic) &&
"Commutative but doesn't have 2 children!");
// Don't count children which are actually register references.
unsigned NC = 0;
@@ -3772,9 +3772,14 @@
for (unsigned i = 3; i != NC; ++i)
Variants.push_back(ChildVariants[i]);
CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
- } else if (NC == 2)
- CombineChildVariants(N, ChildVariants[1], ChildVariants[0],
- OutVariants, CDP, DepVars);
+ } else if (NC == N->getNumChildren()) {
+ std::vector<std::vector<TreePatternNode*> > Variants;
+ Variants.push_back(ChildVariants[1]);
+ Variants.push_back(ChildVariants[0]);
+ for (unsigned i = 2; i != NC; ++i)
+ Variants.push_back(ChildVariants[i]);
+ CombineChildVariants(N, Variants, OutVariants, CDP, DepVars);
+ }
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37430.113717.patch
Type: text/x-patch
Size: 1407 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170904/10be358c/attachment.bin>
More information about the llvm-commits
mailing list