summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2018-01-31 12:58:05 -0500
committerRob Clark <[email protected]>2018-02-10 14:54:58 -0500
commit015afb6a3840af279e12e47833d7acb66fe71143 (patch)
treec387e0fa6f82ed72b1414dd3bd81d18c35ad9bc5 /src/gallium/drivers/freedreno
parent76440fcca9150645c5d7a5396f902f42fd565937 (diff)
freedreno/ir3: track block predecessors
Useful in the following patches. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3.h5
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c27
2 files changed, 25 insertions, 7 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3.h b/src/gallium/drivers/freedreno/ir3/ir3.h
index 776239707c7..dd13e323800 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3.h
+++ b/src/gallium/drivers/freedreno/ir3/ir3.h
@@ -476,7 +476,7 @@ struct ir3_block {
struct list_head node;
struct ir3 *shader;
- nir_block *nblock;
+ const nir_block *nblock;
struct list_head instr_list; /* list of ir3_instruction */
@@ -487,6 +487,9 @@ struct ir3_block {
struct ir3_instruction *condition;
struct ir3_block *successors[2];
+ unsigned predecessors_count;
+ struct ir3_block **predecessors;
+
uint16_t start_ip, end_ip;
/* Track instructions which do not write a register but other-
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index 9cbf9ce47f1..1036d2f967c 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -138,7 +138,7 @@ static unsigned pointer_size(struct ir3_context *ctx)
}
static struct ir3_instruction * create_immed(struct ir3_block *block, uint32_t val);
-static struct ir3_block * get_block(struct ir3_context *ctx, nir_block *nblock);
+static struct ir3_block * get_block(struct ir3_context *ctx, const nir_block *nblock);
static struct ir3_context *
@@ -2658,18 +2658,29 @@ emit_instr(struct ir3_context *ctx, nir_instr *instr)
}
static struct ir3_block *
-get_block(struct ir3_context *ctx, nir_block *nblock)
+get_block(struct ir3_context *ctx, const nir_block *nblock)
{
struct ir3_block *block;
- struct hash_entry *entry;
- entry = _mesa_hash_table_search(ctx->block_ht, nblock);
- if (entry)
- return entry->data;
+ struct hash_entry *hentry;
+ struct set_entry *sentry;
+ unsigned i;
+
+ hentry = _mesa_hash_table_search(ctx->block_ht, nblock);
+ if (hentry)
+ return hentry->data;
block = ir3_block_create(ctx->ir);
block->nblock = nblock;
_mesa_hash_table_insert(ctx->block_ht, nblock, block);
+ block->predecessors_count = nblock->predecessors->entries;
+ block->predecessors = ralloc_array_size(block,
+ sizeof(block->predecessors[0]), block->predecessors_count);
+ i = 0;
+ set_foreach(nblock->predecessors, sentry) {
+ block->predecessors[i++] = get_block(ctx, sentry->key);
+ }
+
return block;
}
@@ -2786,6 +2797,10 @@ emit_stream_out(struct ir3_context *ctx)
*/
orig_end_block = ctx->block;
+// TODO these blocks need to update predecessors..
+// maybe w/ store_global intrinsic, we could do this
+// stuff in nir->nir pass
+
stream_out_block = ir3_block_create(ir);
list_addtail(&stream_out_block->node, &ir->block_list);