[llvm-commits] [llvm] r81395 - /llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
Chris Lattner
sabre at nondot.org
Wed Sep 9 16:09:30 PDT 2009
Author: lattner
Date: Wed Sep 9 18:09:29 2009
New Revision: 81395
URL: http://llvm.org/viewvc/llvm-project?rev=81395&view=rev
Log:
Fix a subtle bug in "return;" generation which caused us to miss
a return in one case. Instead of sprinking return handling code
throughout the asmprinter generator, just treat it like any other
normal statement.
Modified:
llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=81395&r1=81394&r2=81395&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Wed Sep 9 18:09:29 2009
@@ -322,11 +322,13 @@
LastEmitted = VarEnd;
}
}
-
+
Operands.push_back(
AsmWriterOperand("EmitComments(*MI);\n",
AsmWriterOperand::isLiteralStatementOperand));
AddLiteralString("\\n");
+ Operands.push_back(AsmWriterOperand("return;",
+ AsmWriterOperand::isLiteralStatementOperand));
}
/// MatchesAllButOneOp - If this instruction is exactly identical to the
@@ -449,10 +451,6 @@
Command = " " + Inst->Operands[0].getCode() + "\n";
- // If this is the last operand, emit a return.
- if (Inst->Operands.size() == 1)
- Command += " return;\n";
-
// Check to see if we already have 'Command' in UniqueOperandCommands.
// If not, add it.
bool FoundIt = false;
@@ -524,14 +522,6 @@
// to UniqueOperandCommands and remember that it was consumed.
std::string Command = " " + FirstInst->Operands[Op].getCode() + "\n";
- // If this is the last operand, emit a return after the code.
- if (FirstInst->Operands.size() == Op+1 &&
- // Don't early-out too soon. Other instructions in this
- // group may have more operands.
- FirstInst->Operands.size() == MaxSize) {
- Command += " return;\n";
- }
-
UniqueOperandCommands[CommandIdx] += Command;
InstOpsUsed[CommandIdx]++;
}
@@ -633,17 +623,8 @@
std::vector<std::vector<std::string> > TableDrivenOperandPrinters;
- bool isFirst = true;
while (1) {
std::vector<std::string> UniqueOperandCommands;
-
- // For the first operand check, add a default value for instructions with
- // just opcode strings to use.
- if (isFirst) {
- UniqueOperandCommands.push_back(" return;\n");
- isFirst = false;
- }
-
std::vector<unsigned> InstIdxs;
std::vector<unsigned> NumInstOpsHandled;
FindUniqueOperandCommands(UniqueOperandCommands, InstIdxs,
More information about the llvm-commits
mailing list