diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/MIRPrinter.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/CodeGen/MachineOperand.cpp | 16 |
2 files changed, 14 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp index ccec5b4348d..f4f248e6053 100644 --- a/llvm/lib/CodeGen/MIRPrinter.cpp +++ b/llvm/lib/CodeGen/MIRPrinter.cpp @@ -862,7 +862,8 @@ void MIPrinter::print(const MachineInstr &MI, unsigned OpIdx, LLVM_FALLTHROUGH; case MachineOperand::MO_Register: case MachineOperand::MO_CImmediate: - case MachineOperand::MO_MachineBasicBlock: { + case MachineOperand::MO_MachineBasicBlock: + case MachineOperand::MO_ConstantPoolIndex: { unsigned TiedOperandIdx = 0; if (ShouldPrintRegisterTies && Op.isReg() && Op.isTied() && !Op.isDef()) TiedOperandIdx = Op.getParent()->findTiedOperandIdx(OpIdx); @@ -877,10 +878,6 @@ void MIPrinter::print(const MachineInstr &MI, unsigned OpIdx, case MachineOperand::MO_FrameIndex: printStackObjectReference(Op.getIndex()); break; - case MachineOperand::MO_ConstantPoolIndex: - OS << "%const." << Op.getIndex(); - printOffset(Op.getOffset()); - break; case MachineOperand::MO_TargetIndex: OS << "target-index("; if (const auto *Name = diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp index b618e605dca..2a2f8f29c48 100644 --- a/llvm/lib/CodeGen/MachineOperand.cpp +++ b/llvm/lib/CodeGen/MachineOperand.cpp @@ -376,6 +376,16 @@ static void tryToGetTargetInfo(const MachineOperand &MO, } } +static void printOffset(raw_ostream &OS, int64_t Offset) { + if (Offset == 0) + return; + if (Offset < 0) { + OS << " - " << -Offset; + return; + } + OS << " + " << Offset; +} + void MachineOperand::printSubregIdx(raw_ostream &OS, uint64_t Index, const TargetRegisterInfo *TRI) { OS << "%subreg."; @@ -486,10 +496,8 @@ void MachineOperand::print(raw_ostream &OS, ModuleSlotTracker &MST, OS << "<fi#" << getIndex() << '>'; break; case MachineOperand::MO_ConstantPoolIndex: - OS << "<cp#" << getIndex(); - if (getOffset()) - OS << "+" << getOffset(); - OS << '>'; + OS << "%const." << getIndex(); + printOffset(OS, getOffset()); break; case MachineOperand::MO_TargetIndex: OS << "<ti#" << getIndex(); |