There is a lot of customization and eventually code duplication in the
frame lowering that handles special SGPR spills like the one needed for
the Frame Pointer. Incorporating any additional SGPR spill currently
makes it difficult during PEI. This patch introduces a new spill builder
to efficiently handle such spill requirements. Various spill methods are
special handled using a separate class.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Looks ok to me in general.
llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | ||
---|---|---|
31 | This function doesn’t do anything with CSRs, although the name says so? | |
99–100 | Comment should say <FI> for the renamed variable. | |
271 | Why does this code split the copies into SubRegs and copyFromScratchSGPR doesn’t? | |
llvm/lib/Target/AMDGPU/SIRegisterInfo.h | ||
37–38 ↗ | (On Diff #454702) | Why not make this an enum class RegSaveKind? |
llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | ||
---|---|---|
31 | You're right. Neither scratch nor CSR should be in the name. I will change it. | |
99–100 | Thanks. Will change it. | |
271 | For the purpose of emitting CFI directives for each copy. There is no CFI emitted in the epilogue. | |
llvm/lib/Target/AMDGPU/SIRegisterInfo.h | ||
37–38 ↗ | (On Diff #454702) | Will do. |
llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | ||
---|---|---|
271 | Hm, does that mean CFI cannot represent register pairs? |
llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | ||
---|---|---|
271 | Sure, we will get the benefit for 64-bit copies as we have the 'S_MOV_B64' instruction. But for the CFI emission, we need composite expressions for register pairs. @scott.linder to comment about its impact. |
llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | ||
---|---|---|
271 | I agree with using the most efficient representation of the copy (sounds like a 64-bit MOV is best) and generating whatever CFI we need to describe it. In the case of the 64-bit program address space PC and the wave64 EXEC this will be a pair of SGPRs, described via a composite expression in the CFI, like how CD mentions. For every other case we can generate independent CFI instructions to separately describe the SubRegs which correspond to DWARF registers. For example, we don't have a DWARF register number for the pair SGPR40_SGPR41, whereas we do for SGPR40 and SGPR41 separately, so we can still emit something along the lines of: $sgpr40_sgpr41 = S_MOV_B64 $sgpr50_sgpr51 |
Restricted the code to emit a single COPY in case of copy to scratch SGPR. The related CFIs still have split components per sub reg.
llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | ||
---|---|---|
53–54 | No else after return |
llvm/lib/Target/AMDGPU/SIRegisterInfo.h | ||
---|---|---|
30–37 ↗ | (On Diff #462456) | Don't see why this needs to pollute SIRegisterInfo. Belongs in MFI or maybe FrameLowering |
Used PrologEpilog instead of the prefix "Custom" to refer SGPR spills during PEI. Also, fixed the review title and summary.
llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | ||
---|---|---|
195 | Really we ought to be stepping back from the end of the entry block and always using reverse liveness (but I guess you're just moving this function, so that's a separate change) |
This function doesn’t do anything with CSRs, although the name says so?