mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 09:10:12 +01:00
ir3: Remove regs array
Now that everything is converted over, switch to separate src/dst arrays. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
This commit is contained in:
parent
57aeef5c13
commit
def96adaee
3 changed files with 14 additions and 31 deletions
|
|
@ -394,16 +394,16 @@ static struct ir3_instruction *instr_create(struct ir3_block *block,
|
|||
if (1 <= opc_cat(opc))
|
||||
nsrc += 2;
|
||||
struct ir3_instruction *instr;
|
||||
unsigned sz = sizeof(*instr) + ((ndst + nsrc) * sizeof(instr->regs[0]));
|
||||
unsigned sz = sizeof(*instr) + (ndst * sizeof(instr->dsts[0])) +
|
||||
(nsrc * sizeof(instr->srcs[0]));
|
||||
char *ptr = ir3_alloc(block->shader, sz);
|
||||
|
||||
instr = (struct ir3_instruction *)ptr;
|
||||
ptr += sizeof(*instr);
|
||||
instr->regs = (struct ir3_register **)ptr;
|
||||
instr->dsts = (struct ir3_register **)ptr;
|
||||
instr->srcs = instr->dsts + ndst;
|
||||
|
||||
#ifdef DEBUG
|
||||
instr->regs_max = ndst + nsrc;
|
||||
instr->dsts_max = ndst;
|
||||
instr->srcs_max = nsrc;
|
||||
#endif
|
||||
|
|
@ -425,21 +425,18 @@ struct ir3_instruction * ir3_instr_clone(struct ir3_instruction *instr)
|
|||
{
|
||||
struct ir3_instruction *new_instr = instr_create(instr->block, instr->opc,
|
||||
instr->dsts_count, instr->srcs_count);
|
||||
struct ir3_register **regs, **dsts, **srcs;
|
||||
struct ir3_register **dsts, **srcs;
|
||||
unsigned i;
|
||||
|
||||
regs = new_instr->regs;
|
||||
dsts = new_instr->dsts;
|
||||
srcs = new_instr->srcs;
|
||||
*new_instr = *instr;
|
||||
new_instr->regs = regs;
|
||||
new_instr->dsts = dsts;
|
||||
new_instr->srcs = srcs;
|
||||
|
||||
insert_instr(instr->block, new_instr);
|
||||
|
||||
/* clone registers: */
|
||||
new_instr->regs_count = 0;
|
||||
new_instr->dsts_count = 0;
|
||||
new_instr->srcs_count = 0;
|
||||
for (i = 0; i < instr->dsts_count; i++) {
|
||||
|
|
@ -469,40 +466,29 @@ void ir3_instr_add_dep(struct ir3_instruction *instr, struct ir3_instruction *de
|
|||
array_insert(instr, instr->deps, dep);
|
||||
}
|
||||
|
||||
static struct ir3_register * ir3_reg_create(struct ir3_instruction *instr,
|
||||
int num, int flags)
|
||||
{
|
||||
struct ir3 *shader = instr->block->shader;
|
||||
struct ir3_register *reg = reg_create(shader, num, flags);
|
||||
#ifdef DEBUG
|
||||
debug_assert(instr->regs_count < instr->regs_max);
|
||||
#endif
|
||||
instr->regs[instr->regs_count++] = reg;
|
||||
return reg;
|
||||
}
|
||||
|
||||
struct ir3_register * ir3_src_create(struct ir3_instruction *instr,
|
||||
int num, int flags)
|
||||
{
|
||||
assert(!(flags & IR3_REG_DEST));
|
||||
struct ir3 *shader = instr->block->shader;
|
||||
#ifdef DEBUG
|
||||
debug_assert(instr->srcs_count < instr->srcs_max);
|
||||
#endif
|
||||
if (instr->srcs_count == 0)
|
||||
instr->srcs = instr->regs + instr->dsts_count;
|
||||
instr->srcs_count++;
|
||||
return ir3_reg_create(instr, num, flags);
|
||||
struct ir3_register *reg = reg_create(shader, num, flags);
|
||||
instr->srcs[instr->srcs_count++] = reg;
|
||||
return reg;
|
||||
}
|
||||
|
||||
struct ir3_register * ir3_dst_create(struct ir3_instruction *instr,
|
||||
int num, int flags)
|
||||
{
|
||||
assert(instr->srcs_count == 0);
|
||||
struct ir3 *shader = instr->block->shader;
|
||||
#ifdef DEBUG
|
||||
debug_assert(instr->dsts_count < instr->dsts_max);
|
||||
#endif
|
||||
instr->dsts_count++;
|
||||
return ir3_reg_create(instr, num, flags | IR3_REG_DEST);
|
||||
struct ir3_register *reg = reg_create(shader, num, flags | IR3_REG_DEST);
|
||||
instr->dsts[instr->dsts_count++] = reg;
|
||||
return reg;
|
||||
}
|
||||
|
||||
struct ir3_register * ir3_reg_clone(struct ir3 *shader,
|
||||
|
|
|
|||
|
|
@ -279,10 +279,9 @@ struct ir3_instruction {
|
|||
uint8_t repeat;
|
||||
uint8_t nop;
|
||||
#ifdef DEBUG
|
||||
unsigned regs_max, srcs_max, dsts_max;
|
||||
unsigned srcs_max, dsts_max;
|
||||
#endif
|
||||
unsigned regs_count, srcs_count, dsts_count;
|
||||
struct ir3_register **regs;
|
||||
unsigned srcs_count, dsts_count;
|
||||
struct ir3_register **dsts;
|
||||
struct ir3_register **srcs;
|
||||
union {
|
||||
|
|
|
|||
|
|
@ -1619,8 +1619,6 @@ insert_liveout_copy(struct ir3_block *block, physreg_t dst, physreg_t src,
|
|||
dst_reg->size = reg->size;
|
||||
assign_reg(pcopy, dst_reg, ra_physreg_to_num(dst, reg->flags));
|
||||
|
||||
pcopy->srcs = pcopy->regs + pcopy->dsts_count;
|
||||
|
||||
for (unsigned i = 0; i < old_pcopy_srcs; i++) {
|
||||
pcopy->srcs[pcopy->srcs_count++] = old_pcopy->srcs[i];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue