summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/AsmWriterEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-07-18 17:50:22 +0000
committerChris Lattner <sabre@nondot.org>2006-07-18 17:50:22 +0000
commit9d250696b75617bc0c4ba0d1895faafce8d94b60 (patch)
treee566293d2d872e0e97e4fcdd991f6cf73d7e7f18 /llvm/utils/TableGen/AsmWriterEmitter.cpp
parent75dcf6cbd8e82f94a02ce9865520b17ed3e2ab3a (diff)
downloadbcm5719-llvm-9d250696b75617bc0c4ba0d1895faafce8d94b60.tar.gz
bcm5719-llvm-9d250696b75617bc0c4ba0d1895faafce8d94b60.zip
Handle the last operand more intelligently. When emitting the \n, also
return from the asmprinter to make the generated asmprinter both more efficient and smaller. llvm-svn: 29182
Diffstat (limited to 'llvm/utils/TableGen/AsmWriterEmitter.cpp')
-rw-r--r--llvm/utils/TableGen/AsmWriterEmitter.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp
index 9802c3aaf54..7162590cc1d 100644
--- a/llvm/utils/TableGen/AsmWriterEmitter.cpp
+++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp
@@ -345,12 +345,14 @@ FindUniqueOperandCommands(std::vector<std::string> &UniqueOperandCommands,
if (Inst == 0) continue; // PHI, INLINEASM, etc.
std::string Command;
- if (Op > Inst->Operands.size())
+ if (Op >= Inst->Operands.size())
continue; // Instruction already done.
- else if (Op == Inst->Operands.size())
- Command = " return true;\n";
- else
- Command = " " + Inst->Operands[Op].getCode() + "\n";
+
+ Command = " " + Inst->Operands[Op].getCode() + "\n";
+
+ // If this is the last operand, emit a return.
+ if (Op == Inst->Operands.size()-1)
+ Command += " return true;\n";
// Check to see if we already have 'Command' in UniqueOperandCommands.
// If not, add it.
OpenPOWER on IntegriCloud