freedreno/ir3: use nir_shader_get_entrypoint() helper
authorRob Clark <robclark@freedesktop.org>
Thu, 2 Jun 2016 15:13:26 +0000 (11:13 -0400)
committerRob Clark <robclark@freedesktop.org>
Thu, 2 Jun 2016 19:44:07 +0000 (15:44 -0400)
Should also fix coverity warning: CID 1362454

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c

index aa2d6882a76b95b2e27c87c08172fa7cbc2785c1..04c99d1db021fe215841a9e7d45d3dfb45f96eb9 100644 (file)
@@ -2188,16 +2188,7 @@ static void
 emit_instructions(struct ir3_compile *ctx)
 {
        unsigned ninputs, noutputs;
-       nir_function_impl *fxn = NULL;
-
-       /* Find the main function: */
-       nir_foreach_function(function, ctx->s) {
-               compile_assert(ctx, strcmp(function->name, "main") == 0);
-               compile_assert(ctx, function->impl);
-               fxn = function->impl;
-               break;
-       }
-
+       nir_function_impl *fxn = nir_shader_get_entrypoint(ctx->s)->impl;
 
        ninputs  = (max_drvloc(&ctx->s->inputs) + 1) * 4;
        noutputs = (max_drvloc(&ctx->s->outputs) + 1) * 4;