ir3: Split regs into srcs and dsts array
While working on support for swz
, it became clear that the quick solution I went with of IR3_REG_DEST
for supporting multiple destinations was going to get a lot uglier once we started supporting instructions with multiple destinations in the post-RA scheduler. And I think that for handling shared registers, we'll need to handle this anyway as we cannot just emit a bunch of xor's on the spot (they need to be wrapped in a getone
block to work properly) so we'll also need to emit an instruction with multiple destinations as part of parallelcopy lowering. So unfortunately I can't put off the big refactor we talked about, so here it is. There are actually three refactors:
- Splitting out array-write sources into their own register (needed for separate src/dst arrays and sane
ir3_delayslots
indexing) - Making
ir3_instruction::address
a normal register rather than special casing it inforeach_ssa_src
and a bunch of other places (also needed for saneir3_delayslots
indexing) - Splitting
ir3_instruction::regs
intoir3_instruction::srcs
andir3_instruction::dsts
The last refactor is a little tricky, because it touches so many things, so it's split up: first we convert instruction producers to give separate src/dst sizes and use different functions to create sources and destinations, then we introduce ir3_instruction::srcs
and ir3_instruction::dsts
which for compatibility purposes alias ir3_instruction::regs
, then we convert code manipulating regs
to srcs
and dsts
piece by piece, after which we can finally remove the scaffolding and delete ir3_instruction::regs
.
The end-result, beyond deleting a bunch of fiddly + 1
's and even fiddlier code for parallel copies, is that the index passed into ir3_delayslots
corresponds 1-to-1 with consumer->srcs
, with no more adding/subtracting 1 in various places to paper over various differences in the indices. foreach_src_n
will also no longer return something surprising in instructions with multiple destinations. I stopped short of splitting up ir3_register
into ir3_source
and ir3_dest
though, since that would be a lot more refactoring and I don't need that yet.
Closes: #4731 (closed), #4732 (closed), #4733 (closed)