diff options
author | Chris Lattner <sabre@nondot.org> | 2010-06-14 22:33:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-06-14 22:33:34 +0000 |
commit | f6c4a309844c11fc7483cc5d1c71be22b43acb56 (patch) | |
tree | 5c9c959876edb1fe9298391ee104620a1adea738 /utils/TableGen | |
parent | d3c4284849ccfbc501483ec3c0810d1d9ef853b6 (diff) | |
download | external_llvm-f6c4a309844c11fc7483cc5d1c71be22b43acb56.zip external_llvm-f6c4a309844c11fc7483cc5d1c71be22b43acb56.tar.gz external_llvm-f6c4a309844c11fc7483cc5d1c71be22b43acb56.tar.bz2 |
generate better code in CheckComplexPattern
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105970 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r-- | utils/TableGen/DAGISelMatcherEmitter.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/utils/TableGen/DAGISelMatcherEmitter.cpp b/utils/TableGen/DAGISelMatcherEmitter.cpp index 4473f0d..3750bd8 100644 --- a/utils/TableGen/DAGISelMatcherEmitter.cpp +++ b/utils/TableGen/DAGISelMatcherEmitter.cpp @@ -635,6 +635,7 @@ void MatcherTableEmitter::EmitPredicateFunctions(formatted_raw_ostream &OS) { if (!ComplexPatterns.empty()) { OS << "bool CheckComplexPattern(SDNode *Root, SDValue N,\n"; OS << " unsigned PatternNo, SmallVectorImpl<SDValue> &Result) {\n"; + OS << " unsigned NextRes = Result.size();\n"; OS << " switch (PatternNo) {\n"; OS << " default: assert(0 && \"Invalid pattern # in table?\");\n"; for (unsigned i = 0, e = ComplexPatterns.size(); i != e; ++i) { @@ -645,12 +646,12 @@ void MatcherTableEmitter::EmitPredicateFunctions(formatted_raw_ostream &OS) { ++NumOps; // Get the chained node too. OS << " case " << i << ":\n"; - OS << " Result.resize(Result.size()+" << NumOps << ");\n"; + OS << " Result.resize(NextRes+" << NumOps << ");\n"; OS << " return " << P.getSelectFunc(); OS << "(Root, N"; for (unsigned i = 0; i != NumOps; ++i) - OS << ", Result[Result.size()-" << (NumOps-i) << ']'; + OS << ", Result[NextRes+" << i << ']'; OS << ");\n"; } OS << " }\n"; |