Mesa (main): ir3: Improve printing of array parallelcopies/phis

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 16 23:01:33 UTC 2021


Module: Mesa
Branch: main
Commit: 2c21dab36e55eaa3f6b083bc5c3bc0573321fdb5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c21dab36e55eaa3f6b083bc5c3bc0573321fdb5

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Wed Jun 16 15:50:56 2021 +0200

ir3: Improve printing of array parallelcopies/phis

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 | 3 +++
 src/freedreno/ir3/ir3_print.c   | 7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/freedreno/ir3/ir3_context.c b/src/freedreno/ir3/ir3_context.c
index 89137b80b33..b9d215f4e6f 100644
--- a/src/freedreno/ir3/ir3_context.c
+++ b/src/freedreno/ir3/ir3_context.c
@@ -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)
diff --git a/src/freedreno/ir3/ir3_print.c b/src/freedreno/ir3/ir3_print.c
index cc099653afd..041fdf0f755 100644
--- a/src/freedreno/ir3/ir3_print.c
+++ b/src/freedreno/ir3/ir3_print.c
@@ -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) {



More information about the mesa-commit mailing list