diff options
author | Sander de Smalen <sander.desmalen@arm.com> | 2020-11-04 08:56:54 +0000 |
---|---|---|
committer | Sander de Smalen <sander.desmalen@arm.com> | 2020-11-05 11:02:18 +0000 |
commit | d57bba7cf831aa603d1f060a7a2d4ac55bdacdc9 (patch) | |
tree | 5c93955e5db78e5b29ea492693ec022dcd79a531 /llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp | |
parent | b25765792be35393a9057774a0be2b53b1ff5bf2 (diff) | |
download | llvm-d57bba7cf831aa603d1f060a7a2d4ac55bdacdc9.zip llvm-d57bba7cf831aa603d1f060a7a2d4ac55bdacdc9.tar.gz llvm-d57bba7cf831aa603d1f060a7a2d4ac55bdacdc9.tar.bz2 |
[SVE] Return StackOffset for TargetFrameLowering::getFrameIndexReference.
To accommodate frame layouts that have both fixed and scalable objects
on the stack, describing a stack location or offset using a pointer + uint64_t
is not sufficient. For this reason, we've introduced the StackOffset class,
which models both the fixed- and scalable sized offsets.
The TargetFrameLowering::getFrameIndexReference is made to return a StackOffset,
so that this can be used in other interfaces, such as to eliminate frame indices
in PEI or to emit Debug locations for variables on the stack.
This patch is purely mechanical and doesn't change the behaviour of how
the result of this function is used for fixed-sized offsets. The patch adds
various checks to assert that the offset has no scalable component, as frame
offsets with a scalable component are not yet supported in various places.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D90018
Diffstat (limited to 'llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp b/llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp index f8b482c..b0594ec 100644 --- a/llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp +++ b/llvm/lib/CodeGen/TargetFrameLoweringImpl.cpp @@ -41,9 +41,9 @@ bool TargetFrameLowering::enableCalleeSaveSkip(const MachineFunction &MF) const /// frame of the specified index, along with the frame register used /// (in output arg FrameReg). This is the default implementation which /// is overridden for some targets. -int TargetFrameLowering::getFrameIndexReference(const MachineFunction &MF, - int FI, - Register &FrameReg) const { +StackOffset +TargetFrameLowering::getFrameIndexReference(const MachineFunction &MF, int FI, + Register &FrameReg) const { const MachineFrameInfo &MFI = MF.getFrameInfo(); const TargetRegisterInfo *RI = MF.getSubtarget().getRegisterInfo(); @@ -52,8 +52,9 @@ int TargetFrameLowering::getFrameIndexReference(const MachineFunction &MF, // something different. FrameReg = RI->getFrameRegister(MF); - return MFI.getObjectOffset(FI) + MFI.getStackSize() - - getOffsetOfLocalArea() + MFI.getOffsetAdjustment(); + return StackOffset::getFixed(MFI.getObjectOffset(FI) + MFI.getStackSize() - + getOffsetOfLocalArea() + + MFI.getOffsetAdjustment()); } bool TargetFrameLowering::needsFrameIndexResolution( |