Skip to content

Commit 754c1f2

Browse files
committed
[ARM] Add debug dump for StackAdjustingInsts (NFC) (#110283)
1 parent e817cfd commit 754c1f2

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

llvm/lib/Target/ARM/ARMFrameLowering.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,14 @@ struct StackAdjustingInsts {
721721
MachineBasicBlock::iterator I;
722722
unsigned SPAdjust;
723723
bool BeforeFPSet;
724+
725+
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
726+
void dump() {
727+
dbgs() << " " << (BeforeFPSet ? "before-fp " : " ")
728+
<< "sp-adjust=" << SPAdjust;
729+
I->dump();
730+
}
731+
#endif
724732
};
725733

726734
SmallVector<InstInfo, 4> Insts;
@@ -755,6 +763,14 @@ struct StackAdjustingInsts {
755763
.setMIFlags(MachineInstr::FrameSetup);
756764
}
757765
}
766+
767+
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
768+
void dump() {
769+
dbgs() << "StackAdjustingInsts:\n";
770+
for (auto &Info : Insts)
771+
Info.dump();
772+
}
773+
#endif
758774
};
759775

760776
} // end anonymous namespace
@@ -874,6 +890,8 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
874890
ARMSubtarget::PushPopSplitVariation PushPopSplit =
875891
STI.getPushPopSplitVariation(MF);
876892

893+
LLVM_DEBUG(dbgs() << "Emitting prologue for " << MF.getName() << "\n");
894+
877895
// Debug location must be unknown since the first debug location is used
878896
// to determine the end of the prologue.
879897
DebugLoc dl;
@@ -1246,8 +1264,10 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
12461264
// throughout the process. If we have a frame pointer, it takes over the job
12471265
// half-way through, so only the first few .cfi_def_cfa_offset instructions
12481266
// actually get emitted.
1249-
if (!NeedsWinCFI)
1267+
if (!NeedsWinCFI) {
1268+
LLVM_DEBUG(DefCFAOffsetCandidates.dump());
12501269
DefCFAOffsetCandidates.emitDefCFAOffsets(MBB, dl, TII, HasFP);
1270+
}
12511271

12521272
if (STI.isTargetELF() && hasFP(MF))
12531273
MFI.setOffsetAdjustment(MFI.getOffsetAdjustment() -
@@ -1327,6 +1347,8 @@ void ARMFrameLowering::emitEpilogue(MachineFunction &MF,
13271347
ARMSubtarget::PushPopSplitVariation PushPopSplit =
13281348
STI.getPushPopSplitVariation(MF);
13291349

1350+
LLVM_DEBUG(dbgs() << "Emitting epilogue for " << MF.getName() << "\n");
1351+
13301352
// Amount of stack space we reserved next to incoming args for either
13311353
// varargs registers or stack arguments in tail calls made by this function.
13321354
unsigned ReservedArgStack = AFI->getArgRegsSaveSize();

0 commit comments

Comments
 (0)