diff options
author | Rob Clark <[email protected]> | 2017-05-21 12:33:45 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2017-05-23 12:26:35 -0400 |
commit | 232fc995441cc0d69e72f21bba986da0abd8bf72 (patch) | |
tree | 6afcbea6f4ac5a479bf7e891cede69c36e6a8e23 /src/gallium/drivers | |
parent | 2bbd425adb051bb6579458d50a1275d56952081f (diff) |
freedreno/ir3: add put_dst()
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c index 9181d35b5f7..2bcedd509f8 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c @@ -101,6 +101,10 @@ struct ir3_compile { */ struct hash_table *addr_ht; + /* last dst array, for indirect we need to insert a var-store. + */ + struct ir3_instruction **last_dst; + /* maps nir_block to ir3_block, mostly for the purposes of * figuring out the blocks successors */ @@ -361,6 +365,8 @@ __get_dst(struct ir3_compile *ctx, void *key, unsigned n) struct ir3_instruction **value = ralloc_array(ctx->def_ht, struct ir3_instruction *, n); _mesa_hash_table_insert(ctx->def_ht, key, value); + compile_assert(ctx, !ctx->last_dst); + ctx->last_dst = value; return value; } @@ -375,6 +381,12 @@ get_dst(struct ir3_compile *ctx, nir_dest *dst, unsigned n) } } +static void +put_dst(struct ir3_compile *ctx, nir_dest *dst) +{ + ctx->last_dst = NULL; +} + static struct ir3_instruction ** get_dst_ssa(struct ir3_compile *ctx, nir_ssa_def *dst, unsigned n) { @@ -736,6 +748,7 @@ emit_alu(struct ir3_compile *ctx, nir_alu_instr *alu) dst[i] = ir3_MOV(b, src[i], TYPE_U32); } + put_dst(ctx, &alu->dest.dest); return; } @@ -1016,6 +1029,8 @@ emit_alu(struct ir3_compile *ctx, nir_alu_instr *alu) nir_op_infos[alu->op].name); break; } + + put_dst(ctx, &alu->dest.dest); } /* handles direct/indirect UBO reads: */ @@ -1562,6 +1577,9 @@ emit_intrinsic(struct ir3_compile *ctx, nir_intrinsic_instr *intr) nir_intrinsic_infos[intr->intrinsic].name); break; } + + if (info->has_dest) + put_dst(ctx, &intr->dest); } static void @@ -1846,6 +1864,8 @@ emit_tex(struct ir3_compile *ctx, nir_tex_instr *tex) factor, 0); } } + + put_dst(ctx, &tex->dest); } static void @@ -1869,6 +1889,8 @@ emit_tex_query_levels(struct ir3_compile *ctx, nir_tex_instr *tex) */ if (ctx->levels_add_one) dst[0] = ir3_ADD_U(b, dst[0], 0, create_immed(b, 1), 0); + + put_dst(ctx, &tex->dest); } static void @@ -1929,6 +1951,8 @@ emit_phi(struct ir3_compile *ctx, nir_phi_instr *nphi) phi->phi.nphi = nphi; dst[0] = phi; + + put_dst(ctx, &nphi->dest); } /* phi instructions are left partially constructed. We don't resolve |