llvm-project
0873fabe - [TableGen][AMDGPU][RFC] Declare the TTMP register sequence

Commit
70 days ago
[TableGen][AMDGPU][RFC] Declare the TTMP register sequence The last of the four register pools. Eleven of the twelve TTMP tuple widths form blocks. The twelfth does not: a 512-bit tuple spans sixteen TTMPs at a step of four, and with only sixteen TTMPs in the pool there is just one place such a tuple fits, so TTMP_512Regs produces a single register. One register is no run, so it forms no block and stays an ordinary register named TTMP0_512, like any register outside a block. Unlike the VGPRs and AGPRs, this needs code changes. We name TTMP tuples from hand-written C++, and a register of a block has no enumerator of its own. Its value is still available, because the block accessor is constexpr and works anywhere a constant does, including in a case label. So the call sites now name the register by its block and the member it starts at, TTMP_64(4) rather than TTMP4_TTMP5, in the same way as SGPR_64(104) in AMDGPUAsmParser.cpp. The awkward one is MAP_REG2REG in AMDGPUBaseInfo.cpp, which maps a register to its subtarget variant and back. It builds the variant names by pasting _vi and _gfx9plus onto the register name, and we cannot paste onto a block accessor. The variants belong to no block and keep their long names, so we have to give the case label and the pasted name separately. We add a macro that takes the block and the member for the case label, and the old name for the pasting. TTMP0_512 needs one more macro variant of its own. It is the only case where the register and its subtarget variants share no common stem: we name the register after its width, while the variants are still named after the registers they span. The reservation loop in SIRegisterInfo.cpp no longer spells out the number of TTMP pairs or the distance between them, and takes both from the block instead. The savings are small, there being only sixteen TTMPs: 25 descriptors and 1,844 bytes across the three tables. Taken with the whole series, the tables now come to 228,106 bytes where they came to 725,778 before any of this, a reduction of 69%, and AMDGPUGenRegisterInfoEnums.inc is 87% smaller. Only one test needed updating, against 777 for the VGPRs and 56 for the AGPRs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Author
Committer
Parents
Loading