diff options
author | Chris Lattner <sabre@nondot.org> | 2010-09-21 20:37:12 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-09-21 20:37:12 +0000 |
commit | dd83548fea98f25ea24a6966bc17d29d9926269f (patch) | |
tree | 8902d00f0d1d638d558583fe943553290234a800 /llvm/utils | |
parent | 0e023ea02ac8e9e6f7c05094d4a9d7b2b0d70396 (diff) | |
download | bcm5719-llvm-dd83548fea98f25ea24a6966bc17d29d9926269f.tar.gz bcm5719-llvm-dd83548fea98f25ea24a6966bc17d29d9926269f.zip |
just like they can opt into getting the root of the pattern being
matched, allow ComplexPatterns to opt into getting the parent node
of the operand being matched.
llvm-svn: 114472
Diffstat (limited to 'llvm/utils')
-rw-r--r-- | llvm/utils/TableGen/DAGISelMatcherEmitter.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp index 5117737c5f0..3c669dab489 100644 --- a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp @@ -633,7 +633,7 @@ void MatcherTableEmitter::EmitPredicateFunctions(formatted_raw_ostream &OS) { // Emit CompletePattern matchers. // FIXME: This should be const. if (!ComplexPatterns.empty()) { - OS << "bool CheckComplexPattern(SDNode *Root, SDValue N,\n"; + OS << "bool CheckComplexPattern(SDNode *Root, SDNode *Parent, SDValue N,\n"; OS << " unsigned PatternNo, SmallVectorImpl<SDValue> &Result) {\n"; OS << " unsigned NextRes = Result.size();\n"; OS << " switch (PatternNo) {\n"; @@ -655,6 +655,11 @@ void MatcherTableEmitter::EmitPredicateFunctions(formatted_raw_ostream &OS) { if (P.hasProperty(SDNPWantRoot)) OS << "Root, "; + // If the complex pattern wants the parent of the operand being matched, + // pass it in as the next argument. + if (P.hasProperty(SDNPWantParent)) + OS << "Parent, "; + OS << "N"; for (unsigned i = 0; i != NumOps; ++i) OS << ", Result[NextRes+" << i << ']'; |