This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Make s34 the FP register
ClosedPublic

Authored by arsenm on Jun 26 2019, 3:53 PM.

Details

Summary

Make the FP register callee saved.

This is tricky because now the FP needs to be spilled in the prolog
relative to the incoming SP register, rather than the frame register
used throughout the rest of the function. I don't like how this
bypassess the standard mechanism for CSR spills just to get the
correct insert point. I may look for a better solution, since all CSR
VGPRs may also need to have all lanes activated. Another option might
be to make getFrameIndexReference change the base register if the
frame index is a CSR, and then try to figure out the right insertion
point in emitProlog.

If there is a free VGPR lane available for SGPR spilling, try to use
it for the FP. If that would require intrtoducing a new VGPR spill,
try to use a free call clobbered SGPR. Only fallback to introducing a
new VGPR spill as a last resort.

This also doesn't attempt to handle SGPR spilling with scalar stores.

Diff Detail

Event Timeline

arsenm created this revision.Jun 26 2019, 3:53 PM
rampitec added inline comments.Jun 26 2019, 4:07 PM
lib/Target/AMDGPU/SIFrameLowering.cpp
63

As far as I understand that can break limits set on the number of registers by an user.

lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
74

wwwwwwwww

arsenm marked an inline comment as done.Jun 26 2019, 4:15 PM
arsenm added inline comments.
lib/Target/AMDGPU/SIFrameLowering.cpp
63

LiveRegs.available checks if the register is reserved, so that should work

rampitec accepted this revision.Jun 26 2019, 4:29 PM

LGTM, but please fix "wwwwwwww" in the comment before submitting.

This revision is now accepted and ready to land.Jun 26 2019, 4:29 PM
arsenm closed this revision.Jul 8 2019, 12:05 PM

r365372