Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions llvm/lib/Target/BPF/BPFFrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,18 @@ void BPFFrameLowering::determineCalleeSaves(MachineFunction &MF,
SavedRegs.reset(BPF::R8);
SavedRegs.reset(BPF::R9);
}

StackOffset BPFFrameLowering::getFrameIndexReference(const MachineFunction &MF,
int FI,
Register &FrameReg) const {
const MachineFrameInfo &MFI = MF.getFrameInfo();
const TargetRegisterInfo *RI = MF.getSubtarget().getRegisterInfo();

FrameReg = RI->getFrameRegister(MF);

// BPF uses a fixed frame pointer (R10), and offsets are already relative to
// it. No StackSize adjustment (as in the default implementation) is needed.
return StackOffset::getFixed(MFI.getObjectOffset(FI) -
getOffsetOfLocalArea() +
MFI.getOffsetAdjustment());
}
3 changes: 3 additions & 0 deletions llvm/lib/Target/BPF/BPFFrameLowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class BPFFrameLowering : public TargetFrameLowering {
return MBB.erase(MI);
}

StackOffset getFrameIndexReference(const MachineFunction &MF, int FI,
Register &FrameReg) const override;

protected:
bool hasFPImpl(const MachineFunction &MF) const override;
};
Expand Down