This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] New helper functions to get a register class of a given width
ClosedPublic

Authored by foad on Apr 16 2020, 10:56 AM.

Details

Summary

Introduce new helper functions getVGPRClassForBitWidth,
getAGPRClassForBitWidth, getSGPRClassForBitWidth and use them to
refactor various other functions that all contained their own lists of
valid register class widths. NFC.

Diff Detail

Event Timeline

foad created this revision.Apr 16 2020, 10:56 AM
arsenm added inline comments.Apr 16 2020, 11:19 AM
llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
1304

This should probably include the full set of sizes to avoid weird legalization problems, but I guess some are already missing

1415–1416

This could really be a static method

1431–1432

Can be static method

rampitec added inline comments.Apr 16 2020, 11:24 AM
llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
1282

return VGPR_LO16 for 16?

1324

There is now SGPR_LO16.

foad updated this revision to Diff 258255.Apr 17 2020, 1:44 AM
foad marked 2 inline comments as done.

Add 16-bit cases.

foad marked 5 inline comments as done.Apr 17 2020, 1:49 AM
foad added inline comments.
llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
1304

I've done this as D78348.

1415–1416

It's not trivial because getRegSizeInBits is non-static.

1431–1432

Likewise.

arsenm accepted this revision.Apr 17 2020, 6:56 AM
This revision is now accepted and ready to land.Apr 17 2020, 6:56 AM
This revision was automatically updated to reflect the committed changes.
foad marked an inline comment as done.