Skip to content

Commit cdfecdb

Browse files
committed
[ARM] Add debug dump for StackAdjustingInsts (NFC)
1 parent 8eac8cc commit cdfecdb

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
@@ -689,6 +689,14 @@ struct StackAdjustingInsts {
689689
MachineBasicBlock::iterator I;
690690
unsigned SPAdjust;
691691
bool BeforeFPSet;
692+
693+
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
694+
void dump() {
695+
dbgs() << " " << (BeforeFPSet ? "before-fp " : " ")
696+
<< "sp-adjust=" << SPAdjust;
697+
I->dump();
698+
}
699+
#endif
692700
};
693701

694702
SmallVector<InstInfo, 4> Insts;
@@ -723,6 +731,14 @@ struct StackAdjustingInsts {
723731
.setMIFlags(MachineInstr::FrameSetup);
724732
}
725733
}
734+
735+
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
736+
void dump() {
737+
dbgs() << "StackAdjustingInsts:\n";
738+
for (auto &Info : Insts)
739+
Info.dump();
740+
}
741+
#endif
726742
};
727743

728744
} // end anonymous namespace
@@ -842,6 +858,8 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
842858
ARMSubtarget::PushPopSplitVariation PushPopSplit =
843859
STI.getPushPopSplitVariation(MF);
844860

861+
LLVM_DEBUG(dbgs() << "Emitting prologue for " << MF.getName() << "\n");
862+
845863
// Debug location must be unknown since the first debug location is used
846864
// to determine the end of the prologue.
847865
DebugLoc dl;
@@ -1213,8 +1231,10 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
12131231
// throughout the process. If we have a frame pointer, it takes over the job
12141232
// half-way through, so only the first few .cfi_def_cfa_offset instructions
12151233
// actually get emitted.
1216-
if (!NeedsWinCFI)
1234+
if (!NeedsWinCFI) {
1235+
LLVM_DEBUG(DefCFAOffsetCandidates.dump());
12171236
DefCFAOffsetCandidates.emitDefCFAOffsets(MBB, dl, TII, HasFP);
1237+
}
12181238

12191239
if (STI.isTargetELF() && hasFP(MF))
12201240
MFI.setOffsetAdjustment(MFI.getOffsetAdjustment() -
@@ -1294,6 +1314,8 @@ void ARMFrameLowering::emitEpilogue(MachineFunction &MF,
12941314
ARMSubtarget::PushPopSplitVariation PushPopSplit =
12951315
STI.getPushPopSplitVariation(MF);
12961316

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

0 commit comments

Comments
 (0)