ir3: Improve printing of array parallelcopies/phis
authorConnor Abbott <cwabbott0@gmail.com>
Wed, 16 Jun 2021 13:50:56 +0000 (15:50 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 16 Jun 2021 22:45:13 +0000 (22:45 +0000)
Normally something with IR3_REG_ARRAY doesn't have a register assigned,
but we keep IR3_REG_ARRAY for parallel copies after RA because we need
to know the appropriate size. We want to see the register assigned for
these when printing the RA result before parallel copies are lowered.
The register is in ->array.base in this case, so initialize it to
INVALID_REG and print ->array.base if it's been assigned to something,
similar to ->num in the normal case.

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

src/freedreno/ir3/ir3_context.c
src/freedreno/ir3/ir3_print.c

index 89137b8..b9d215f 100644 (file)
@@ -592,6 +592,7 @@ ir3_create_array_load(struct ir3_context *ctx, struct ir3_array *arr, int n,
        src->size  = arr->length;
        src->array.id = arr->id;
        src->array.offset = n;
+       src->array.base = INVALID_REG;
 
        if (address)
                ir3_instr_set_address(mov, address);
@@ -626,6 +627,7 @@ ir3_create_array_store(struct ir3_context *ctx, struct ir3_array *arr, int n,
                dst->size = arr->length;
                dst->array.id = arr->id;
                dst->array.offset = n;
+               dst->array.base = INVALID_REG;
 
                arr->last_write = dst;
 
@@ -653,6 +655,7 @@ ir3_create_array_store(struct ir3_context *ctx, struct ir3_array *arr, int n,
        dst->size  = arr->length;
        dst->array.id = arr->id;
        dst->array.offset = n;
+       dst->array.base = INVALID_REG;
        ir3_reg_create(mov, 0, IR3_REG_SSA | flags)->def = src->regs[0];
 
        if (address)
index cc09965..041fdf0 100644 (file)
@@ -180,8 +180,8 @@ static void print_ssa_name(struct ir3_register *reg, bool dst)
                print_ssa_def_name(reg);
        }
 
-       if (reg->num != INVALID_REG)
-                       printf("("SYN_REG("r%u.%c")")", reg_num(reg), "xyzw"[reg_comp(reg)]);
+       if (reg->num != INVALID_REG && !(reg->flags & IR3_REG_ARRAY))
+               printf("("SYN_REG("r%u.%c")")", reg_num(reg), "xyzw"[reg_comp(reg)]);
 }
 
 static void print_reg_name(struct ir3_instruction *instr, struct ir3_register *reg)
@@ -221,6 +221,9 @@ static void print_reg_name(struct ir3_instruction *instr, struct ir3_register *r
                        print_ssa_name(reg, false);
                }
                printf(SYN_ARRAY("]"));
+               if (reg->array.base != INVALID_REG)
+                       printf("("SYN_REG("r%u.%c")")", reg->array.base >> 2,
+                                  "xyzw"[reg->array.base & 0x3]);
        } else if (reg->flags & IR3_REG_SSA) {
                print_ssa_name(reg, reg->flags & IR3_REG_DEST);
        } else if (reg->flags & IR3_REG_RELATIV) {