summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/FastISelEmitter.cpp
diff options
context:
space:
mode:
authorNicolai Haehnle <nhaehnle@gmail.com>2018-11-30 14:15:13 +0000
committerNicolai Haehnle <nhaehnle@gmail.com>2018-11-30 14:15:13 +0000
commit445b0b6260238f3e59204e6af921447564962004 (patch)
tree1b6d43d2dc8333e31fe464aeda870853c219f798 /llvm/utils/TableGen/FastISelEmitter.cpp
parent4830fdd21afd9e4f15cd610422ccab760779ef98 (diff)
downloadbcm5719-llvm-445b0b6260238f3e59204e6af921447564962004.tar.gz
bcm5719-llvm-445b0b6260238f3e59204e6af921447564962004.zip
TableGen/ISel: Allow PatFrag predicate code to access captured operands
Summary: This simplifies writing predicates for pattern fragments that are automatically re-associated or commuted. For example, a followup patch adds patterns for fragments of the form (add (shl $x, $y), $z) to the AMDGPU backend. Such patterns are automatically commuted to (add $z, (shl $x, $y)), which makes it basically impossible to refer to $x, $y, and $z generically in the PredicateCode. With this change, the PredicateCode can refer to $x, $y, and $z simply as `Operands[i]`. Test confirmed that there are no changes to any of the generated files when building all (non-experimental) targets. Change-Id: I61c00ace7eed42c1d4edc4c5351174b56b77a79c Reviewers: arsenm, rampitec, RKSimon, craig.topper, hfinkel, uweigand Subscribers: wdng, tpr, llvm-commits Differential Revision: https://reviews.llvm.org/D51994 llvm-svn: 347992
Diffstat (limited to 'llvm/utils/TableGen/FastISelEmitter.cpp')
-rw-r--r--llvm/utils/TableGen/FastISelEmitter.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/utils/TableGen/FastISelEmitter.cpp b/llvm/utils/TableGen/FastISelEmitter.cpp
index 6e04d1711cc..5134b684c6f 100644
--- a/llvm/utils/TableGen/FastISelEmitter.cpp
+++ b/llvm/utils/TableGen/FastISelEmitter.cpp
@@ -210,13 +210,13 @@ struct OperandsSignature {
// Handle imm operands specially.
if (!Op->isLeaf() && Op->getOperator()->getName() == "imm") {
unsigned PredNo = 0;
- if (!Op->getPredicateFns().empty()) {
- TreePredicateFn PredFn = Op->getPredicateFns()[0];
+ if (!Op->getPredicateCalls().empty()) {
+ TreePredicateFn PredFn = Op->getPredicateCalls()[0].Fn;
// If there is more than one predicate weighing in on this operand
// then we don't handle it. This doesn't typically happen for
// immediates anyway.
- if (Op->getPredicateFns().size() > 1 ||
- !PredFn.isImmediatePattern())
+ if (Op->getPredicateCalls().size() > 1 ||
+ !PredFn.isImmediatePattern() || PredFn.usesOperands())
return false;
// Ignore any instruction with 'FastIselShouldIgnore', these are
// not needed and just bloat the fast instruction selector. For
@@ -236,7 +236,7 @@ struct OperandsSignature {
// For now, filter out any operand with a predicate.
// For now, filter out any operand with multiple values.
- if (!Op->getPredicateFns().empty() || Op->getNumTypes() != 1)
+ if (!Op->getPredicateCalls().empty() || Op->getNumTypes() != 1)
return false;
if (!Op->isLeaf()) {
@@ -529,7 +529,7 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) {
}
// For now, filter out any instructions with predicates.
- if (!InstPatNode->getPredicateFns().empty())
+ if (!InstPatNode->getPredicateCalls().empty())
continue;
// Check all the operands.
OpenPOWER on IntegriCloud