mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-31 10:34:17 +00:00
Fix a bug handling instructions, like blr, which just consist of a text
string. The return value of printInstruction should be true for these. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29196 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
08e682ecf4
commit
a6dc9fb745
@ -478,7 +478,7 @@ void AsmWriterEmitter::run(std::ostream &O) {
|
|||||||
// Build an aggregate string, and build a table of offsets into it.
|
// Build an aggregate string, and build a table of offsets into it.
|
||||||
std::map<std::string, unsigned> StringOffset;
|
std::map<std::string, unsigned> StringOffset;
|
||||||
std::string AggregateString;
|
std::string AggregateString;
|
||||||
AggregateString += '\0';
|
AggregateString += "\0\0";
|
||||||
|
|
||||||
/// OpcodeInfo - Theis encodes the index of the string to use for the first
|
/// 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.
|
/// chunk of the output as well as indices used for operand printing.
|
||||||
@ -488,9 +488,14 @@ void AsmWriterEmitter::run(std::ostream &O) {
|
|||||||
for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
|
for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
|
||||||
AsmWriterInst *AWI = CGIAWIMap[NumberedInstructions[i]];
|
AsmWriterInst *AWI = CGIAWIMap[NumberedInstructions[i]];
|
||||||
unsigned Idx;
|
unsigned Idx;
|
||||||
if (AWI == 0 || AWI->Operands[0].Str.empty()) {
|
if (AWI == 0) {
|
||||||
// Something not handled by the asmwriter printer.
|
// Something not handled by the asmwriter printer.
|
||||||
Idx = 0;
|
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 {
|
} else {
|
||||||
unsigned &Entry = StringOffset[AWI->Operands[0].Str];
|
unsigned &Entry = StringOffset[AWI->Operands[0].Str];
|
||||||
if (Entry == 0) {
|
if (Entry == 0) {
|
||||||
@ -522,10 +527,10 @@ void AsmWriterEmitter::run(std::ostream &O) {
|
|||||||
while (1) {
|
while (1) {
|
||||||
std::vector<std::string> UniqueOperandCommands;
|
std::vector<std::string> UniqueOperandCommands;
|
||||||
|
|
||||||
// For the first operand check, add a default value that unhandled
|
// For the first operand check, add a default value for instructions with
|
||||||
// instructions will use.
|
// just opcode strings to use.
|
||||||
if (isFirst) {
|
if (isFirst) {
|
||||||
UniqueOperandCommands.push_back(" return false;\n");
|
UniqueOperandCommands.push_back(" return true;\n");
|
||||||
isFirst = false;
|
isFirst = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,6 +623,7 @@ void AsmWriterEmitter::run(std::ostream &O) {
|
|||||||
|
|
||||||
O << " // Emit the opcode for the instruction.\n"
|
O << " // Emit the opcode for the instruction.\n"
|
||||||
<< " unsigned Bits = OpInfo[MI->getOpcode()];\n"
|
<< " unsigned Bits = OpInfo[MI->getOpcode()];\n"
|
||||||
|
<< " if (Bits == 0) return false;\n"
|
||||||
<< " O << AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << ");\n\n";
|
<< " O << AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << ");\n\n";
|
||||||
|
|
||||||
// Output the table driven operand information.
|
// Output the table driven operand information.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user