diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2025-02-27 15:45:55 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-27 15:45:55 -0800 |
commit | 0ebf7b473a98a7433568d0a225d8b38767bdae50 (patch) | |
tree | 88a6cb186a7b5a3aa936d788bf797e87cf8dd395 /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | 11e65b98b3c0088a84ca5d1d74a0fd4bab462b40 (diff) | |
download | llvm-0ebf7b473a98a7433568d0a225d8b38767bdae50.zip llvm-0ebf7b473a98a7433568d0a225d8b38767bdae50.tar.gz llvm-0ebf7b473a98a7433568d0a225d8b38767bdae50.tar.bz2 |
IR, CodeGen: Add command line flags for dumping instruction addresses and debug locations.
As previously discussed [1], it is sometimes useful to be able to see
instruction addresses and debug locations as part of IR dumps. The
same applies to MachineInstrs which already dump debug locations but
not addresses. Therefore add some flags that can be used to enable
dumping of this information.
[1] https://discourse.llvm.org/t/small-improvement-to-llvm-debugging-experience/79914
Reviewers: rnk
Reviewed By: rnk
Pull Request: https://github.com/llvm/llvm-project/pull/127944
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 5860a76..4716665 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -63,6 +63,10 @@ using namespace llvm; +static cl::opt<bool> + PrintMIAddrs("print-mi-addrs", cl::Hidden, + cl::desc("Print addresses of MachineInstrs when dumping")); + static const MachineFunction *getMFIfAvailable(const MachineInstr &MI) { if (const MachineBasicBlock *MBB = MI.getParent()) if (const MachineFunction *MF = MBB->getParent()) @@ -2076,6 +2080,9 @@ void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST, } // TODO: DBG_LABEL + if (PrintMIAddrs) + OS << " ; " << this; + if (AddNewLine) OS << '\n'; } |