aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
diff options
context:
space:
mode:
authorJames Y Knight <jyknight@google.com>2022-11-22 13:35:43 -0500
committerJames Y Knight <jyknight@google.com>2022-11-22 18:25:22 -0500
commit4af73d7ebb5bf4bc2045d15ae0f4ebce56f2d86f (patch)
tree05495ff698cd9c4a0a3b2ebb2a217174eaa27f6e /llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
parentcacd3e73d7f87ef3593443271ab3f170d0360934 (diff)
downloadllvm-4af73d7ebb5bf4bc2045d15ae0f4ebce56f2d86f.zip
llvm-4af73d7ebb5bf4bc2045d15ae0f4ebce56f2d86f.tar.gz
llvm-4af73d7ebb5bf4bc2045d15ae0f4ebce56f2d86f.tar.bz2
Refactor AsmPrinterHandler callbacks. NFCI.
The existing behaviors and callbacks were overlapping and had very confusing semantics: beginBasicBlock/endBasicBlock were not always called, beginFragment/endFragment seemed like they were meant to mean the same thing, but were slightly different, etc. This resulted in confusing semantics, virtual method overloads, and control flow. Remove the above, and replace with new beginBasicBlockSection and endBasicBlockSection callbacks. And document them. These are always called before the first and after the last blocks in a function, even when basic-block-sections are disabled.
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
index 8ebbed9..f0b1f73 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
@@ -416,16 +416,11 @@ void DebugHandlerBase::endFunction(const MachineFunction *MF) {
InstOrdering.clear();
}
-void DebugHandlerBase::beginBasicBlock(const MachineBasicBlock &MBB) {
- if (!MBB.isBeginSection())
- return;
-
- PrevLabel = MBB.getSymbol();
+void DebugHandlerBase::beginBasicBlockSection(const MachineBasicBlock &MBB) {
+ if (!MBB.isEntryBlock())
+ PrevLabel = MBB.getSymbol();
}
-void DebugHandlerBase::endBasicBlock(const MachineBasicBlock &MBB) {
- if (!MBB.isEndSection())
- return;
-
+void DebugHandlerBase::endBasicBlockSection(const MachineBasicBlock &MBB) {
PrevLabel = nullptr;
}