summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineOperand.cpp
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-12-13 10:30:45 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2017-12-13 10:30:45 +0000
commit26ae8a6582c8c420b222e5b672c6845e182340f5 (patch)
treea2c146ace61de186baec22106525bfffb3732769 /llvm/lib/CodeGen/MachineOperand.cpp
parentfead6ae660ac5f4548250f972ccbd905a038132a (diff)
downloadbcm5719-llvm-26ae8a6582c8c420b222e5b672c6845e182340f5.tar.gz
bcm5719-llvm-26ae8a6582c8c420b222e5b672c6845e182340f5.zip
[CodeGen] Print constant pool index operands as %const.0 + 8 in both MIR and debug output
Work towards the unification of MIR and debug output by printing `%const.0 + 8` instead of `<cp#0+8>` and `%const.0 - 8` instead of `<cp#0-8>`. Only debug syntax is affected. Differential Revision: https://reviews.llvm.org/D41116 llvm-svn: 320564
Diffstat (limited to 'llvm/lib/CodeGen/MachineOperand.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOperand.cpp16
1 files changed, 12 insertions, 4 deletions
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();
OpenPOWER on IntegriCloud