ir3: Add srcs/dsts arrays to ir3_instruction
authorConnor Abbott <cwabbott0@gmail.com>
Fri, 18 Jun 2021 12:01:58 +0000 (14:01 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 23 Jun 2021 17:20:29 +0000 (17:20 +0000)
Initially these will shadow regs, so that we can transition things
before getting rid of regs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>

src/freedreno/ir3/ir3.c
src/freedreno/ir3/ir3.h

index 59e2777..11d7054 100644 (file)
@@ -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);
 }
index 141906d..ca58233 100644 (file)
@@ -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;