ac/nir: add ac_nir_context::main_function
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 19 May 2017 17:22:09 +0000 (19:22 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 31 Jul 2017 12:55:35 +0000 (14:55 +0200)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_nir_to_llvm.c

index e2dd7cabc6fbab365d0a976b83d36fff055fe489..72c1cdc493779f1737b7d48c443bcb247a4b7912 100644 (file)
@@ -66,6 +66,7 @@ struct ac_nir_context {
        struct hash_table *phis;
        struct hash_table *vars;
 
+       LLVMValueRef main_function;
        LLVMBasicBlockRef continue_block;
        LLVMBasicBlockRef break_block;
 
@@ -6102,6 +6103,8 @@ void ac_nir_translate(struct ac_llvm_context *ac, struct ac_shader_abi *abi,
 
        ctx.stage = nir->stage;
 
+       ctx.main_function = LLVMGetBasicBlockParent(LLVMGetInsertBlock(ctx.ac.builder));
+
        nir_foreach_variable(variable, &nir->outputs)
                handle_shader_output_decl(&ctx, nir, variable);