freedreno/ir3: track block predecessors
Useful in the following patches. Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
@@ -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-
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user