diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-06-26 23:18:44 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-06-26 23:18:44 +0000 |
commit | c03745260e07707684ea8af21845883c3bbd0c20 (patch) | |
tree | 316561964cd049fbed10df3aab8be81a9e327fe2 /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | 5d6108e4ed5c80a52bb66d4cb870eb5d1477c572 (diff) | |
download | bcm5719-llvm-c03745260e07707684ea8af21845883c3bbd0c20.tar.gz bcm5719-llvm-c03745260e07707684ea8af21845883c3bbd0c20.zip |
CodeGen: Create a proper ModuleSlotTracker for MachineInstr
Another follow-up related to r240848: try a little harder to share slot
tracking calculations within a single `MachineInstr` dump. This is
unrelated to `MachineFunction::print()`, since that should be passing
through the function's `ModuleSlotTracker` by now, but could affect the
speed of dumping from a debugger if there is more than one IR-level
operand.
llvm-svn: 240852
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 39a395081db..fdc4226ad92 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1532,8 +1532,13 @@ void MachineInstr::dump() const { } void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const { - ModuleSlotTracker DummyMST(nullptr); - print(OS, DummyMST, SkipOpers); + const Module *M = nullptr; + if (const MachineBasicBlock *MBB = getParent()) + if (const MachineFunction *MF = MBB->getParent()) + M = MF->getFunction()->getParent(); + + ModuleSlotTracker MST(M); + print(OS, MST, SkipOpers); } void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST, |