Skip to content

Commit 3e66bec

Browse files
committed
[AMDGPU][NFC] Explain needsFrameMoves workaround
Common up the FIXME for hardcoding a value of NeedsFrameMoves in SIFrameLowering and expand it with a rationale.
1 parent 0b99ded commit 3e66bec

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

llvm/lib/Target/AMDGPU/SIFrameLowering.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ static MCRegister findUnusedRegister(MachineRegisterInfo &MRI,
4848
return MCRegister();
4949
}
5050

51+
static bool needsFrameMoves(const MachineFunction &MF) {
52+
// FIXME: There are some places in the compiler which are sensitive to the CFI
53+
// pseudos and so using MachineFunction::needsFrameMoves has the unintended
54+
// effect of making enabling debug info affect codegen. Once we have
55+
// identified and fixed those cases this should be replaced with
56+
// MF.needsFrameMoves()
57+
return true;
58+
}
59+
5160
static void encodeDwarfRegisterLocation(int DwarfReg, raw_ostream &OS) {
5261
assert(DwarfReg >= 0);
5362
if (DwarfReg < 32) {
@@ -485,8 +494,7 @@ class PrologEpilogSGPRSpillBuilder {
485494
SplitParts = TRI.getRegSplitParts(RC, EltSize);
486495
NumSubRegs = SplitParts.empty() ? 1 : SplitParts.size();
487496

488-
// FIXME: Switch to using MF.needsFrameMoves() later.
489-
NeedsFrameMoves = true;
497+
NeedsFrameMoves = needsFrameMoves(MF);
490498

491499
assert(SuperReg != AMDGPU::M0 && "m0 should never spill");
492500
}
@@ -769,8 +777,7 @@ void SIFrameLowering::emitEntryFunctionPrologue(MachineFunction &MF,
769777
DebugLoc DL;
770778
MachineBasicBlock::iterator I = MBB.begin();
771779

772-
// FIXME: Switch to using MF.needsFrameMoves() later
773-
const bool NeedsFrameMoves = true;
780+
const bool NeedsFrameMoves = needsFrameMoves(MF);
774781

775782
if (NeedsFrameMoves) {
776783
// On entry the SP/FP are not set up, so we need to define the CFA in terms
@@ -1390,8 +1397,7 @@ void SIFrameLowering::emitPrologue(MachineFunction &MF,
13901397
uint32_t NumBytes = MFI.getStackSize();
13911398
uint32_t RoundedSize = NumBytes;
13921399

1393-
// FIXME: Switch to using MF.needsFrameMoves() later
1394-
const bool NeedsFrameMoves = true;
1400+
const bool NeedsFrameMoves = needsFrameMoves(MF);
13951401

13961402
if (NeedsFrameMoves)
13971403
emitPrologueEntryCFI(MBB, MBBI, DL);
@@ -1581,8 +1587,7 @@ void SIFrameLowering::emitEpilogue(MachineFunction &MF,
15811587
FramePtrRegScratchCopy);
15821588
}
15831589

1584-
// FIXME: Switch to using MF.needsFrameMoves() later
1585-
const bool NeedsFrameMoves = true;
1590+
const bool NeedsFrameMoves = needsFrameMoves(MF);
15861591
if (hasFP(MF)) {
15871592
if (NeedsFrameMoves)
15881593
emitDefCFA(MBB, MBBI, DL, StackPtrReg, /*AspaceAlreadyDefined=*/false,

0 commit comments

Comments
 (0)