summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2018-05-15 11:11:12 +1000
committerDave Airlie <[email protected]>2018-06-04 05:58:42 +1000
commit67eccd6aa2b3fcc79a232479a58a0f52b9980001 (patch)
treecd41a0003b34a046726fa2e20dd84517d5aeef0a /src/compiler
parentbad7332f7c6c2e5922ddca854a7b497b22c31682 (diff)
nir: use num_components wrappers in print/validate.
These wrappers were introduces, so start using them. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_print.c4
-rw-r--r--src/compiler/nir/nir_validate.c16
2 files changed, 5 insertions, 15 deletions
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index fad274e62f6..7c3e93eb82a 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -199,9 +199,7 @@ print_alu_src(nir_alu_instr *instr, unsigned src, print_state *state)
}
}
- unsigned live_channels = instr->src[src].src.is_ssa
- ? instr->src[src].src.ssa->num_components
- : instr->src[src].src.reg.reg->num_components;
+ unsigned live_channels = nir_src_num_components(instr->src[src].src);
if (print_swizzle || used_channels != live_channels) {
fprintf(fp, ".");
diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
index eee737e8069..abfd1712b39 100644
--- a/src/compiler/nir/nir_validate.c
+++ b/src/compiler/nir/nir_validate.c
@@ -228,15 +228,9 @@ validate_alu_src(nir_alu_instr *instr, unsigned index, validate_state *state)
{
nir_alu_src *src = &instr->src[index];
- unsigned num_components;
- if (src->src.is_ssa) {
- num_components = src->src.ssa->num_components;
- } else {
- if (src->src.reg.reg->is_packed)
- num_components = 4; /* can't check anything */
- else
- num_components = src->src.reg.reg->num_components;
- }
+ unsigned num_components = nir_src_num_components(src->src);
+ if (!src->src.is_ssa && src->src.reg.reg->is_packed)
+ num_components = 4; /* can't check anything */
for (unsigned i = 0; i < 4; i++) {
validate_assert(state, src->swizzle[i] < 4);
@@ -333,9 +327,7 @@ validate_alu_dest(nir_alu_instr *instr, validate_state *state)
{
nir_alu_dest *dest = &instr->dest;
- unsigned dest_size =
- dest->dest.is_ssa ? dest->dest.ssa.num_components
- : dest->dest.reg.reg->num_components;
+ unsigned dest_size = nir_dest_num_components(dest->dest);
bool is_packed = !dest->dest.is_ssa && dest->dest.reg.reg->is_packed;
/*
* validate that the instruction doesn't write to components not in the