From 6c95572ef00986ed15d98774a32eb8e9f84a4deb Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 23 Sep 2022 16:40:39 -0400 Subject: [PATCH] agx: Print instructions as "dest = src" This makes the dataflow easier to read, especially with splits and collects (which take variable numbers of sources/destinations). Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_print.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/asahi/compiler/agx_print.c b/src/asahi/compiler/agx_print.c index 2e48c5c1713..852d7b7a65c 100644 --- a/src/asahi/compiler/agx_print.c +++ b/src/asahi/compiler/agx_print.c @@ -108,19 +108,10 @@ agx_print_instr(agx_instr *I, FILE *fp) { assert(I->op < AGX_NUM_OPCODES); struct agx_opcode_info info = agx_opcodes_info[I->op]; - - fprintf(fp, " %s", info.name); - - if (I->saturate) - fprintf(fp, ".sat"); - - if (I->last) - fprintf(fp, ".last"); - - fprintf(fp, " "); - bool print_comma = false; + fprintf(fp, " "); + agx_foreach_dest(I, d) { if (print_comma) fprintf(fp, ", "); @@ -130,6 +121,21 @@ agx_print_instr(agx_instr *I, FILE *fp) agx_print_index(I->dest[d], false, fp); } + if (I->nr_dests) { + fprintf(fp, " = "); + print_comma = false; + } + + fprintf(fp, "%s", info.name); + + if (I->saturate) + fprintf(fp, ".sat"); + + if (I->last) + fprintf(fp, ".last"); + + fprintf(fp, " "); + agx_foreach_src(I, s) { if (print_comma) fprintf(fp, ", ");