diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c index 59e2777767f..11d7054e173 100644 --- a/src/freedreno/ir3/ir3.c +++ b/src/freedreno/ir3/ir3.c @@ -400,6 +400,7 @@ static struct ir3_instruction *instr_create(struct ir3_block *block, instr = (struct ir3_instruction *)ptr; ptr += sizeof(*instr); instr->regs = (struct ir3_register **)ptr; + instr->dsts = (struct ir3_register **)ptr; #ifdef DEBUG instr->regs_max = ndst + nsrc; @@ -424,12 +425,16 @@ 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; + struct ir3_register **regs, **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); @@ -482,6 +487,8 @@ struct ir3_register * ir3_src_create(struct ir3_instruction *instr, #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); } diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 141906d50d3..ca58233df89 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -283,6 +283,8 @@ struct ir3_instruction { #endif unsigned regs_count, srcs_count, dsts_count; struct ir3_register **regs; + struct ir3_register **dsts; + struct ir3_register **srcs; union { struct { char inv1, inv2;