diff options
author | Rob Clark <[email protected]> | 2019-06-28 07:30:35 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2019-08-28 15:25:19 -0700 |
commit | 06bc4875fff8ad144dbebebe53241da4655aecc6 (patch) | |
tree | 71f697c227f1d3e42d27d594d299bcf470d47e36 /src/freedreno | |
parent | cfbde3282d9b881a8cb09dc7a9c2b25b69872e32 (diff) |
freedreno/ir3: convert block->predecessors to set
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/freedreno')
-rw-r--r-- | src/freedreno/ir3/ir3.h | 4 | ||||
-rw-r--r-- | src/freedreno/ir3/ir3_compiler_nir.c | 8 | ||||
-rw-r--r-- | src/freedreno/ir3/ir3_legalize.c | 5 | ||||
-rw-r--r-- | src/freedreno/ir3/ir3_print.c | 10 | ||||
-rw-r--r-- | src/freedreno/ir3/ir3_sched.c | 10 |
5 files changed, 19 insertions, 18 deletions
diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 872a6fb0fc2..50c9b70ae14 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -31,6 +31,7 @@ #include "util/bitscan.h" #include "util/list.h" +#include "util/set.h" #include "util/u_debug.h" #include "instr-a3xx.h" @@ -498,8 +499,7 @@ struct ir3_block { struct ir3_instruction *condition; struct ir3_block *successors[2]; - unsigned predecessors_count; - struct ir3_block **predecessors; + struct set *predecessors; /* set of ir3_block */ uint16_t start_ip, end_ip; diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index 3c58496097a..0e5491151d3 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -2118,7 +2118,6 @@ get_block(struct ir3_context *ctx, const nir_block *nblock) { struct ir3_block *block; struct hash_entry *hentry; - unsigned i; hentry = _mesa_hash_table_search(ctx->block_ht, nblock); if (hentry) @@ -2128,12 +2127,9 @@ get_block(struct ir3_context *ctx, const nir_block *nblock) 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; + block->predecessors = _mesa_pointer_set_create(block); set_foreach(nblock->predecessors, sentry) { - block->predecessors[i++] = get_block(ctx, sentry->key); + _mesa_set_add(block->predecessors, get_block(ctx, sentry->key)); } return block; diff --git a/src/freedreno/ir3/ir3_legalize.c b/src/freedreno/ir3/ir3_legalize.c index ae5547b6a52..e46d1214d60 100644 --- a/src/freedreno/ir3/ir3_legalize.c +++ b/src/freedreno/ir3/ir3_legalize.c @@ -90,8 +90,9 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block) bool last_input_needs_ss = false; /* our input state is the OR of all predecessor blocks' state: */ - for (unsigned i = 0; i < block->predecessors_count; i++) { - struct ir3_legalize_block_data *pbd = block->predecessors[i]->data; + set_foreach(block->predecessors, entry) { + struct ir3_block *predecessor = (struct ir3_block *)entry->key; + struct ir3_legalize_block_data *pbd = predecessor->data; struct ir3_legalize_state *pstate = &pbd->state; /* Our input (ss)/(sy) state is based on OR'ing the output diff --git a/src/freedreno/ir3/ir3_print.c b/src/freedreno/ir3/ir3_print.c index b69941da29e..cc6572d9056 100644 --- a/src/freedreno/ir3/ir3_print.c +++ b/src/freedreno/ir3/ir3_print.c @@ -215,13 +215,15 @@ print_block(struct ir3_block *block, int lvl) { tab(lvl); printf("block%u {\n", block_id(block)); - if (block->predecessors_count > 0) { + if (block->predecessors->entries > 0) { + unsigned i = 0; tab(lvl+1); printf("pred: "); - for (unsigned i = 0; i < block->predecessors_count; i++) { - if (i) + set_foreach(block->predecessors, entry) { + struct ir3_block *pred = (struct ir3_block *)entry->key; + if (i++) printf(", "); - printf("block%u", block_id(block->predecessors[i])); + printf("block%u", block_id(pred)); } printf("\n"); } diff --git a/src/freedreno/ir3/ir3_sched.c b/src/freedreno/ir3/ir3_sched.c index f027d7b7a30..a311956e925 100644 --- a/src/freedreno/ir3/ir3_sched.c +++ b/src/freedreno/ir3/ir3_sched.c @@ -270,10 +270,11 @@ distance(struct ir3_block *block, struct ir3_instruction *instr, /* (ab)use block->data to prevent recursion: */ block->data = block; - for (unsigned i = 0; i < block->predecessors_count; i++) { + set_foreach(block->predecessors, entry) { + struct ir3_block *pred = (struct ir3_block *)entry->key; unsigned n; - n = distance(block->predecessors[i], instr, min, pred); + n = distance(pred, instr, min, pred); min = MIN2(min, n); } @@ -880,8 +881,9 @@ sched_intra_block(struct ir3_sched_ctx *ctx, struct ir3_block *block) list_for_each_entry_safe (struct ir3_instruction, instr, &block->instr_list, node) { unsigned delay = 0; - for (unsigned i = 0; i < block->predecessors_count; i++) { - unsigned d = delay_calc(block->predecessors[i], instr, false, true); + set_foreach(block->predecessors, entry) { + struct ir3_block *pred = (struct ir3_block *)entry->key; + unsigned d = delay_calc(pred, instr, false, true); delay = MAX2(d, delay); } |