llvm-project
15fa127b - [TableGen][AMDGPU][RFC] Introduce register sequences

Commit
70 days ago
[TableGen][AMDGPU][RFC] Introduce register sequences The overwhelming majority of AMDGPU's registers are synthesized tuples, and all of them are sequences of adjacent registers of certain widths. We currently have no adequate representation of them in TableGen: every such tuple is emitted as a descriptor carrying its own name string and its own sub- and super-register lists, so the generated register tables run to well over a hundred megabytes for this one target. The names spell out every member, so a four-register tuple is SGPR0_SGPR1_SGPR2_SGPR3. The representation has no notion of register tuple widths, so we implement the mapping between widths and register classes by hand. Representing tuples as a first register and a width would address these issues. What stands in the way is that TableGen has no notion of one register following another in a sequence. This patch adds such a notion using RegisterSequence instances: def : RegisterSequence<[R0, R1, R2, R3]>; Note that it is a relationship between the registers themselves and not register classes. A register class may order or omit its members freely without affecting the sequence. This patch only uses sequences for naming. Where a tuple is made of registers that follow one another, we name it after the first of them and the total width, so SGPR0_128 instead of SGPR0_SGPR1_SGPR2_SGPR3. Other tuples keep their longer names. These names are code identifiers; the assembly names come from the AsmName field, which we do not touch. The patches that follow use the same relationship to describe whole blocks of such tuples at once, so that the registers of a block need no individual code names, no sub- or super-register lists, no register units and finally no descriptors of their own. The last commits declare the VGPRs, AGPRs and TTMPs as sequences as well; only the SGPRs are declared here. The bulk of the diff is the resulting test updates, a mechanical rename of the affected register names. Targets that declare no sequences are not affected. For AMDGPU, all the register numbers stay as they were, and the only thing that changes in the register descriptors is their names. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Author
Committer
Parents
Loading