[llvm-commits] CVS: llvm/utils/TableGen/AsmWriterEmitter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Jul 18 18:39:19 PDT 2006
Changes in directory llvm/utils/TableGen:
AsmWriterEmitter.cpp updated: 1.39 -> 1.40
---
Log message:
Fix a bug handling instructions, like blr, which just consist of a text
string. The return value of printInstruction should be true for these.
---
Diffs of the changes: (+11 -5)
AsmWriterEmitter.cpp | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
Index: llvm/utils/TableGen/AsmWriterEmitter.cpp
diff -u llvm/utils/TableGen/AsmWriterEmitter.cpp:1.39 llvm/utils/TableGen/AsmWriterEmitter.cpp:1.40
--- llvm/utils/TableGen/AsmWriterEmitter.cpp:1.39 Tue Jul 18 14:27:30 2006
+++ llvm/utils/TableGen/AsmWriterEmitter.cpp Tue Jul 18 20:39:06 2006
@@ -478,7 +478,7 @@
// Build an aggregate string, and build a table of offsets into it.
std::map<std::string, unsigned> StringOffset;
std::string AggregateString;
- AggregateString += '\0';
+ AggregateString += "\0\0";
/// OpcodeInfo - Theis encodes the index of the string to use for the first
/// chunk of the output as well as indices used for operand printing.
@@ -488,9 +488,14 @@
for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
AsmWriterInst *AWI = CGIAWIMap[NumberedInstructions[i]];
unsigned Idx;
- if (AWI == 0 || AWI->Operands[0].Str.empty()) {
+ if (AWI == 0) {
// Something not handled by the asmwriter printer.
Idx = 0;
+ } else if (AWI->Operands[0].OperandType !=
+ AsmWriterOperand::isLiteralTextOperand ||
+ AWI->Operands[0].Str.empty()) {
+ // Something handled by the asmwriter printer, but with no leading string.
+ Idx = 1;
} else {
unsigned &Entry = StringOffset[AWI->Operands[0].Str];
if (Entry == 0) {
@@ -522,10 +527,10 @@
while (1) {
std::vector<std::string> UniqueOperandCommands;
- // For the first operand check, add a default value that unhandled
- // instructions will use.
+ // For the first operand check, add a default value for instructions with
+ // just opcode strings to use.
if (isFirst) {
- UniqueOperandCommands.push_back(" return false;\n");
+ UniqueOperandCommands.push_back(" return true;\n");
isFirst = false;
}
@@ -618,6 +623,7 @@
O << " // Emit the opcode for the instruction.\n"
<< " unsigned Bits = OpInfo[MI->getOpcode()];\n"
+ << " if (Bits == 0) return false;\n"
<< " O << AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << ");\n\n";
// Output the table driven operand information.
More information about the llvm-commits
mailing list