summaryrefslogtreecommitdiff
path: root/utils/TableGen/AsmWriterEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-09 23:09:29 +0000
committerChris Lattner <sabre@nondot.org>2009-09-09 23:09:29 +0000
commit28179db68b8cb71c82132d37935b8511c067d220 (patch)
treee3d0f3b3476f74423771a4e1fc6319adf99383b1 /utils/TableGen/AsmWriterEmitter.cpp
parented6878842bcfb0a923834ad95fb33a2c2507fbe7 (diff)
downloadllvm-28179db68b8cb71c82132d37935b8511c067d220.tar.gz
llvm-28179db68b8cb71c82132d37935b8511c067d220.tar.bz2
llvm-28179db68b8cb71c82132d37935b8511c067d220.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/AsmWriterEmitter.cpp')
-rw-r--r--utils/TableGen/AsmWriterEmitter.cpp25
1 files changed, 3 insertions, 22 deletions
diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp
index 34dc30f604..d6aa8bf046 100644
--- a/utils/TableGen/AsmWriterEmitter.cpp
+++ b/utils/TableGen/AsmWriterEmitter.cpp
@@ -322,11 +322,13 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, Record *AsmWriter) {
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 @@ FindUniqueOperandCommands(std::vector<std::string> &UniqueOperandCommands,
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 @@ FindUniqueOperandCommands(std::vector<std::string> &UniqueOperandCommands,
// 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 @@ void AsmWriterEmitter::run(raw_ostream &O) {
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,