freedreno/ir3: pass variant to ir3_create()
authorRob Clark <robdclark@chromium.org>
Mon, 15 Jun 2020 18:14:46 +0000 (11:14 -0700)
committerMarge Bot <eric+marge@anholt.net>
Fri, 19 Jun 2020 13:16:57 +0000 (13:16 +0000)
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>

src/freedreno/ir3/ir3.c
src/freedreno/ir3/ir3.h
src/freedreno/ir3/ir3_compiler_nir.c
src/freedreno/ir3/ir3_parser.y

index fd2b8ea..3d41a7b 100644 (file)
@@ -45,12 +45,13 @@ void * ir3_alloc(struct ir3 *shader, int sz)
        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);
 
        shader->compiler = compiler;
-       shader->type = type;
+       shader->type = v->type;
 
        list_inithead(&shader->block_list);
        list_inithead(&shader->array_list);
index 48e340d..51315a5 100644 (file)
@@ -554,10 +554,11 @@ block_id(struct ir3_block *block)
 #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);
 
-struct ir3_shader_variant;
 void * ir3_assemble(struct ir3_shader_variant *v);
 void * ir3_alloc(struct ir3 *shader, int sz);
 
index bb45ba2..3c8007f 100644 (file)
@@ -3248,7 +3248,7 @@ emit_instructions(struct ir3_context *ctx)
        ctx->inputs  = rzalloc_array(ctx, struct ir3_instruction *, ctx->ninputs);
        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: */
        ctx->block = get_block(ctx, nir_start_block(fxn));
index fe6cbe8..2e89d77 100644 (file)
@@ -89,7 +89,7 @@ static struct ir3_instruction * new_instr(opc_t opc)
 
 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);
        list_addtail(&block->node, &variant->ir->block_list);
 }