mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
generate better code in CheckComplexPattern
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105970 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d3c4284849
commit
f6c4a30984
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user