llvm-project
27dc57ac - [TableGen][AMDGPU][RFC] Compute super-registers of block registers

Commit
70 days ago
[TableGen][AMDGPU][RFC] Compute super-registers of block registers Every register carries a list of its super-registers in the SuperRegs field of its MCRegisterDesc. The registers of a sequence block do not need such lists: the block can describe the super-registers of all its registers at once. The registers of a block cover the same number of sequence members each and begin an equal number of members apart. So do the super-registers of any one width. Moving from one register of the block to the next therefore moves a fixed number of registers along the super-registers of that width, and two numbers describe them all: where the first one that covers a register of the block begins, and how far apart they follow one another. We call that a series. A block stores one series per width above its own. To list the super-registers of one of its registers, we walk the series and work out, for each, which of its registers covers that particular register. The lists this produces differ in length. Registers near the start and the end of the sequence have fewer super-registers than those in the middle, there being nothing beyond the ends for a wider register to reach into. This needs no special handling: a series yields nothing when the answer would fall outside it, and the register moves on to the next series. One list of series serves the whole block, and the registers at the ends simply get fewer answers out of it. A super-register may belong to no block, and then it is a series on its own. It does not move as we go along the block, so its spacing is zero and it answers for a run of the block's registers. AMDGPU has eight such registers, the VCCTuple defs in SIRegisterInfo.td: SGPR76_1024, SGPR92_512 and the rest, which cover the last SGPRs together with VCC_LO and VCC_HI. The regular generator cannot produce them, because the next register of each width would run past the end of the sequence. They are super-registers of 81 of the 347 registers in the SGPR blocks. We check the result against the super-registers each register of the block really has, and cut the block short at the first register where the two disagree. This is what already happens when a register's sub-registers depart from the pattern. Such a register keeps a description of its own, as every register outside a block does. The check runs after the blocks are formed rather than while they are being formed, because a super-register of a block register may itself belong to a block that does not exist yet. Cutting a block short can leave a register outside every block, so we repeat the pass until nothing changes. This patch changes the order of super-registers. A block can hold registers that begin at differently aligned members, and their super-registers interleave differently for each of them, so no single order over the series reproduces the old order for every register of the block. The order has only ever guaranteed that a register comes before its super-registers, and listing the series narrowest first keeps to that, because a super-register holds more register units than the register it covers. Dropping the super-register lists of block registers takes AMDGPURegDiffLists from 94304 to 93224 entries, about 2 KB. The series come to 282 entries. The MCRegisterDesc descriptors stay for now, as they did when the sub-registers moved out: a descriptor with one computed field still takes up a descriptor. Removing them waits until the remaining fields are computed the same way. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Author
Committer
Parents
Loading