[backend]解决了标签打印问题
This commit is contained in:
@@ -87,10 +87,17 @@ void RISCv64AsmPrinter::printInstruction(MachineInstr* instr) {
|
||||
if (opcode == RVOpcodes::RET) {
|
||||
printEpilogue();
|
||||
}
|
||||
if (opcode != RVOpcodes::LABEL) {
|
||||
*OS << " ";
|
||||
|
||||
if (opcode == RVOpcodes::LABEL) {
|
||||
// 标签直接打印,不加缩进
|
||||
printOperand(instr->getOperands()[0].get());
|
||||
*OS << ":\n";
|
||||
return; // 处理完毕,直接返回
|
||||
}
|
||||
|
||||
// 对于所有非标签指令,先打印缩进
|
||||
*OS << " ";
|
||||
|
||||
switch (opcode) {
|
||||
case RVOpcodes::ADD: *OS << "add "; break; case RVOpcodes::ADDI: *OS << "addi "; break;
|
||||
case RVOpcodes::ADDW: *OS << "addw "; break; case RVOpcodes::ADDIW: *OS << "addiw "; break;
|
||||
@@ -126,8 +133,8 @@ void RISCv64AsmPrinter::printInstruction(MachineInstr* instr) {
|
||||
case RVOpcodes::SNEZ: *OS << "snez "; break;
|
||||
case RVOpcodes::CALL: *OS << "call "; break;
|
||||
case RVOpcodes::LABEL:
|
||||
printOperand(instr->getOperands()[0].get());
|
||||
*OS << ":";
|
||||
// printOperand(instr->getOperands()[0].get());
|
||||
// *OS << ":";
|
||||
break;
|
||||
case RVOpcodes::FRAME_LOAD:
|
||||
case RVOpcodes::FRAME_STORE:
|
||||
|
||||
Reference in New Issue
Block a user