aboutsummaryrefslogtreecommitdiff
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
commit191dd1f1860661f2e0bb99432d10da9b2aff1fc7 (patch)
tree1862ad1a0aea11f94833c85e29b24a352be2e5d5
parente7a589df09ed4d1f0853fb586609b00357a34ac2 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29182 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--utils/TableGen/AsmWriterEmitter.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp
index 9802c3aaf5..7162590cc1 100644
--- a/utils/TableGen/AsmWriterEmitter.cpp
+++ b/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.