diff options
author | Marek Olšák <marek.olsak@amd.com> | 2019-11-05 17:39:38 -0500 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2019-11-23 00:02:10 -0500 |
commit | ca201bfe7060638cfd39a8d263df93cb0c39c75b (patch) | |
tree | 67135d911034661a80ed66e58bb500894fccb819 /src/compiler/nir | |
parent | 2286340fde63d7dfbb4f70a6ffa254989c1477b1 (diff) | |
download | external_mesa3d-ca201bfe7060638cfd39a8d263df93cb0c39c75b.tar.gz external_mesa3d-ca201bfe7060638cfd39a8d263df93cb0c39c75b.tar.bz2 external_mesa3d-ca201bfe7060638cfd39a8d263df93cb0c39c75b.zip |
nir/serialize: don't serialize mode for deref non-cast instructions
It can be derived from src and var. This frees 10 bits in the header
that will be used later.
"mode" is moved in the structure, because those bits will be used for
something else later.
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r-- | src/compiler/nir/nir_serialize.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c index 469533f0179..53b9f05d5fb 100644 --- a/src/compiler/nir/nir_serialize.c +++ b/src/compiler/nir/nir_serialize.c @@ -624,8 +624,8 @@ union packed_instr { struct { unsigned instr_type:4; unsigned deref_type:3; - unsigned mode:10; unsigned cast_type_same_as_last:1; + unsigned mode:10; unsigned _pad:6; unsigned dest:8; } deref; @@ -851,10 +851,11 @@ write_deref(write_ctx *ctx, const nir_deref_instr *deref) header.deref.instr_type = deref->instr.type; header.deref.deref_type = deref->deref_type; - header.deref.mode = deref->mode; - if (deref->deref_type == nir_deref_type_cast) + if (deref->deref_type == nir_deref_type_cast) { + header.deref.mode = deref->mode; header.deref.cast_type_same_as_last = deref->type == ctx->last_type; + } write_dest(ctx, &deref->dest, header); @@ -900,11 +901,10 @@ read_deref(read_ctx *ctx, union packed_instr header) read_dest(ctx, &deref->dest, &deref->instr, header); - deref->mode = header.deref.mode; - if (deref_type == nir_deref_type_var) { deref->var = read_object(ctx); deref->type = deref->var->type; + deref->mode = deref->var->data.mode; return deref; } @@ -947,6 +947,13 @@ read_deref(read_ctx *ctx, union packed_instr header) unreachable("Invalid deref type"); } + if (deref->deref_type == nir_deref_type_cast) { + deref->mode = header.deref.mode; + } else { + assert(deref->parent.is_ssa); + deref->mode = nir_instr_as_deref(deref->parent.ssa->parent_instr)->mode; + } + return deref; } |