[llvm-commits] CVS: llvm/utils/TableGen/AsmWriterEmitter.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Jul 18 10:50:35 PDT 2006



Changes in directory llvm/utils/TableGen:

AsmWriterEmitter.cpp updated: 1.34 -> 1.35
---
Log message:

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.


---
Diffs of the changes:  (+7 -5)

 AsmWriterEmitter.cpp |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)


Index: llvm/utils/TableGen/AsmWriterEmitter.cpp
diff -u llvm/utils/TableGen/AsmWriterEmitter.cpp:1.34 llvm/utils/TableGen/AsmWriterEmitter.cpp:1.35
--- llvm/utils/TableGen/AsmWriterEmitter.cpp:1.34	Tue Jul 18 12:43:54 2006
+++ llvm/utils/TableGen/AsmWriterEmitter.cpp	Tue Jul 18 12:50:22 2006
@@ -345,12 +345,14 @@
     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.






More information about the llvm-commits mailing list