[llvm] 754c1f2 - [ARM] Add debug dump for StackAdjustingInsts (NFC) (#110283)

Oliver Stannard via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 01:29:43 PDT 2024


Author: Oliver Stannard
Date: 2024-10-09T09:29:28+01:00
New Revision: 754c1f21700d7f6df3ee3bf86769c59cce1a6cfd

URL: https://github.com/llvm/llvm-project/commit/754c1f21700d7f6df3ee3bf86769c59cce1a6cfd
DIFF: https://github.com/llvm/llvm-project/commit/754c1f21700d7f6df3ee3bf86769c59cce1a6cfd.diff

LOG: [ARM] Add debug dump for StackAdjustingInsts (NFC) (#110283)

Added: 
    

Modified: 
    llvm/lib/Target/ARM/ARMFrameLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/ARMFrameLowering.cpp b/llvm/lib/Target/ARM/ARMFrameLowering.cpp
index ad4c9338ec5b62..60062a2422e484 100644
--- a/llvm/lib/Target/ARM/ARMFrameLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMFrameLowering.cpp
@@ -721,6 +721,14 @@ struct StackAdjustingInsts {
     MachineBasicBlock::iterator I;
     unsigned SPAdjust;
     bool BeforeFPSet;
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+    void dump() {
+      dbgs() << "  " << (BeforeFPSet ? "before-fp " : "          ")
+             << "sp-adjust=" << SPAdjust;
+      I->dump();
+    }
+#endif
   };
 
   SmallVector<InstInfo, 4> Insts;
@@ -755,6 +763,14 @@ struct StackAdjustingInsts {
               .setMIFlags(MachineInstr::FrameSetup);
     }
   }
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+  void dump() {
+    dbgs() << "StackAdjustingInsts:\n";
+    for (auto &Info : Insts)
+      Info.dump();
+  }
+#endif
 };
 
 } // end anonymous namespace
@@ -874,6 +890,8 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
   ARMSubtarget::PushPopSplitVariation PushPopSplit =
       STI.getPushPopSplitVariation(MF);
 
+  LLVM_DEBUG(dbgs() << "Emitting prologue for " << MF.getName() << "\n");
+
   // Debug location must be unknown since the first debug location is used
   // to determine the end of the prologue.
   DebugLoc dl;
@@ -1246,8 +1264,10 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
   // throughout the process. If we have a frame pointer, it takes over the job
   // half-way through, so only the first few .cfi_def_cfa_offset instructions
   // actually get emitted.
-  if (!NeedsWinCFI)
+  if (!NeedsWinCFI) {
+    LLVM_DEBUG(DefCFAOffsetCandidates.dump());
     DefCFAOffsetCandidates.emitDefCFAOffsets(MBB, dl, TII, HasFP);
+  }
 
   if (STI.isTargetELF() && hasFP(MF))
     MFI.setOffsetAdjustment(MFI.getOffsetAdjustment() -
@@ -1327,6 +1347,8 @@ void ARMFrameLowering::emitEpilogue(MachineFunction &MF,
   ARMSubtarget::PushPopSplitVariation PushPopSplit =
       STI.getPushPopSplitVariation(MF);
 
+  LLVM_DEBUG(dbgs() << "Emitting epilogue for " << MF.getName() << "\n");
+
   // Amount of stack space we reserved next to incoming args for either
   // varargs registers or stack arguments in tail calls made by this function.
   unsigned ReservedArgStack = AFI->getArgRegsSaveSize();


        


More information about the llvm-commits mailing list