freedreno/ir3: pass variant to ir3_create()

Prep to convert over to ralloc.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5508>
This commit is contained in:
Rob Clark 2020-06-15 11:14:46 -07:00 committed by Marge Bot
parent 65660622a1
commit 6039d083f7
4 changed files with 8 additions and 6 deletions

View File

@ -45,12 +45,13 @@ void * ir3_alloc(struct ir3 *shader, int sz)
return rzalloc_size(shader, sz); /* TODO: don't use rzalloc */ return rzalloc_size(shader, sz); /* TODO: don't use rzalloc */
} }
struct ir3 * ir3_create(struct ir3_compiler *compiler, gl_shader_stage type) struct ir3 * ir3_create(struct ir3_compiler *compiler,
struct ir3_shader_variant *v)
{ {
struct ir3 *shader = rzalloc(NULL, struct ir3); struct ir3 *shader = rzalloc(NULL, struct ir3);
shader->compiler = compiler; shader->compiler = compiler;
shader->type = type; shader->type = v->type;
list_inithead(&shader->block_list); list_inithead(&shader->block_list);
list_inithead(&shader->array_list); list_inithead(&shader->array_list);

View File

@ -554,10 +554,11 @@ block_id(struct ir3_block *block)
#endif #endif
} }
struct ir3 * ir3_create(struct ir3_compiler *compiler, gl_shader_stage type); struct ir3_shader_variant;
struct ir3 * ir3_create(struct ir3_compiler *compiler, struct ir3_shader_variant *v);
void ir3_destroy(struct ir3 *shader); void ir3_destroy(struct ir3 *shader);
struct ir3_shader_variant;
void * ir3_assemble(struct ir3_shader_variant *v); void * ir3_assemble(struct ir3_shader_variant *v);
void * ir3_alloc(struct ir3 *shader, int sz); void * ir3_alloc(struct ir3 *shader, int sz);

View File

@ -3248,7 +3248,7 @@ emit_instructions(struct ir3_context *ctx)
ctx->inputs = rzalloc_array(ctx, struct ir3_instruction *, ctx->ninputs); ctx->inputs = rzalloc_array(ctx, struct ir3_instruction *, ctx->ninputs);
ctx->outputs = rzalloc_array(ctx, struct ir3_instruction *, ctx->noutputs); ctx->outputs = rzalloc_array(ctx, struct ir3_instruction *, ctx->noutputs);
ctx->ir = ir3_create(ctx->compiler, ctx->so->type); ctx->ir = ir3_create(ctx->compiler, ctx->so);
/* Create inputs in first block: */ /* Create inputs in first block: */
ctx->block = get_block(ctx, nir_start_block(fxn)); ctx->block = get_block(ctx, nir_start_block(fxn));

View File

@ -89,7 +89,7 @@ static struct ir3_instruction * new_instr(opc_t opc)
static void new_shader(void) static void new_shader(void)
{ {
variant->ir = ir3_create(variant->shader->compiler, variant->shader->type); variant->ir = ir3_create(variant->shader->compiler, variant);
block = ir3_block_create(variant->ir); block = ir3_block_create(variant->ir);
list_addtail(&block->node, &variant->ir->block_list); list_addtail(&block->node, &variant->ir->block_list);
} }