summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2017-04-04 20:29:53 -0400
committerRob Clark <[email protected]>2017-04-14 12:46:12 -0400
commit75afd2586f86231dbf929ec19d3bded88c9ea3a1 (patch)
tree00e8a335e376d2ac939ecb1ec31bf050f95c69b0
parent331bd3b5e10f189b1e8cd6fdf087a892efa9a6b8 (diff)
freedreno/ir3: move 'keeps' to block level
For things like SSBOs and atomics we'll want to track this at a block level. Signed-off-by: Rob Clark <[email protected]>
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3.h12
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c4
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_cp.c10
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_depth.c8
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_group.c8
5 files changed, 22 insertions, 20 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3.h b/src/gallium/drivers/freedreno/ir3/ir3.h
index c205c8fac48..480b27ce5da 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3.h
+++ b/src/gallium/drivers/freedreno/ir3/ir3.h
@@ -369,12 +369,6 @@ struct ir3 {
unsigned predicates_count, predicates_sz;
struct ir3_instruction **predicates;
- /* Track instructions which do not write a register but other-
- * wise must not be discarded (such as kill, stg, etc)
- */
- unsigned keeps_count, keeps_sz;
- struct ir3_instruction **keeps;
-
/* Track texture sample instructions which need texture state
* patched in (for astc-srgb workaround):
*/
@@ -435,6 +429,12 @@ struct ir3_block {
uint16_t start_ip, end_ip;
+ /* Track instructions which do not write a register but other-
+ * wise must not be discarded (such as kill, stg, etc)
+ */
+ unsigned keeps_count, keeps_sz;
+ struct ir3_instruction **keeps;
+
/* used for per-pass extra block data. Mainly used right
* now in RA step to track livein/liveout.
*/
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index 7932a6f18a3..22619e852c2 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -1308,7 +1308,7 @@ emit_intrinsic(struct ir3_compile *ctx, nir_intrinsic_instr *intr)
kill = ir3_KILL(b, cond, 0);
array_insert(ctx->ir, ctx->ir->predicates, kill);
- array_insert(ctx->ir, ctx->ir->keeps, kill);
+ array_insert(b, b->keeps, kill);
ctx->so->has_kill = true;
break;
@@ -1972,7 +1972,7 @@ emit_stream_out(struct ir3_compile *ctx)
stg->cat6.type = TYPE_U32;
stg->cat6.dst_offset = (strmout->output[i].dst_offset + j) * 4;
- array_insert(ctx->ir, ctx->ir->keeps, stg);
+ array_insert(ctx->block, ctx->block->keeps, stg);
}
}
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cp.c b/src/gallium/drivers/freedreno/ir3/ir3_cp.c
index 71e02615c75..a9023ce571c 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_cp.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_cp.c
@@ -576,15 +576,15 @@ ir3_cp(struct ir3 *ir, struct ir3_shader_variant *so)
}
}
- for (unsigned i = 0; i < ir->keeps_count; i++) {
- instr_cp(&ctx, ir->keeps[i]);
- ir->keeps[i] = eliminate_output_mov(ir->keeps[i]);
- }
-
list_for_each_entry (struct ir3_block, block, &ir->block_list, node) {
if (block->condition) {
instr_cp(&ctx, block->condition);
block->condition = eliminate_output_mov(block->condition);
}
+
+ for (unsigned i = 0; i < block->keeps_count; i++) {
+ instr_cp(&ctx, block->keeps[i]);
+ block->keeps[i] = eliminate_output_mov(block->keeps[i]);
+ }
}
}
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_depth.c b/src/gallium/drivers/freedreno/ir3/ir3_depth.c
index 1b8a446ca65..be39027b6a0 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_depth.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_depth.c
@@ -159,11 +159,11 @@ ir3_depth(struct ir3 *ir)
if (ir->outputs[i])
ir3_instr_depth(ir->outputs[i]);
- for (i = 0; i < ir->keeps_count; i++)
- ir3_instr_depth(ir->keeps[i]);
-
- /* We also need to account for if-condition: */
list_for_each_entry (struct ir3_block, block, &ir->block_list, node) {
+ for (i = 0; i < block->keeps_count; i++)
+ ir3_instr_depth(block->keeps[i]);
+
+ /* We also need to account for if-condition: */
if (block->condition)
ir3_instr_depth(block->condition);
}
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_group.c b/src/gallium/drivers/freedreno/ir3/ir3_group.c
index 633d66c58d4..2719b6459e3 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_group.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_group.c
@@ -254,9 +254,11 @@ find_neighbors(struct ir3 *ir)
}
}
- for (i = 0; i < ir->keeps_count; i++) {
- struct ir3_instruction *instr = ir->keeps[i];
- instr_find_neighbors(instr);
+ list_for_each_entry (struct ir3_block, block, &ir->block_list, node) {
+ for (i = 0; i < block->keeps_count; i++) {
+ struct ir3_instruction *instr = block->keeps[i];
+ instr_find_neighbors(instr);
+ }
}
}