summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-10-27 18:57:34 +0200
committerNicolai Hähnle <[email protected]>2016-11-03 10:06:54 +0100
commit0b9bba7f6c0fe5b456e7464005063dff8e217847 (patch)
treecf15ffacc0b40e17af63586b9c3797d2f4a99122 /src/gallium/drivers
parent96d60dd9ee6a394671debe60b96db703d9ecd674 (diff)
radeonsi: pass the function name to si_llvm_create_func
We will use multiple functions in one module, so they should have different names. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c15
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_internal.h1
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c3
3 files changed, 11 insertions, 8 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index dcbcfbca059..81c361e7ea7 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5365,13 +5365,14 @@ static const struct lp_build_tgsi_action interp_action = {
};
static void si_create_function(struct si_shader_context *ctx,
+ const char *name,
LLVMTypeRef *returns, unsigned num_returns,
LLVMTypeRef *params, unsigned num_params,
int last_sgpr)
{
int i;
- si_llvm_create_func(ctx, returns, num_returns,
+ si_llvm_create_func(ctx, name, returns, num_returns,
params, num_params);
si_llvm_shader_type(ctx->main_fn, ctx->type);
ctx->return_value = LLVMGetUndef(ctx->return_type);
@@ -5694,7 +5695,7 @@ static void create_function(struct si_shader_context *ctx)
assert(num_params <= ARRAY_SIZE(params));
- si_create_function(ctx, returns, num_returns, params,
+ si_create_function(ctx, "main", returns, num_returns, params,
num_params, last_sgpr);
/* Reserve register locations for VGPR inputs the PS prolog may need. */
@@ -7030,7 +7031,7 @@ static bool si_compile_vs_prolog(struct si_screen *sscreen,
returns[num_returns++] = ctx.f32;
/* Create the function. */
- si_create_function(&ctx, returns, num_returns, params,
+ si_create_function(&ctx, "vs_prolog", returns, num_returns, params,
num_params, last_sgpr);
func = ctx.main_fn;
@@ -7118,7 +7119,7 @@ static bool si_compile_vs_epilog(struct si_screen *sscreen,
params[i] = ctx.f32;
/* Create the function. */
- si_create_function(&ctx, NULL, 0, params, num_params, -1);
+ si_create_function(&ctx, "vs_epilog", NULL, 0, params, num_params, -1);
/* Emit exports. */
if (key->vs_epilog.states.export_prim_id) {
@@ -7288,7 +7289,7 @@ static bool si_compile_tcs_epilog(struct si_screen *sscreen,
params[num_params++] = ctx.i32; /* LDS offset where tess factors should be loaded from */
/* Create the function. */
- si_create_function(&ctx, NULL, 0, params, num_params, last_sgpr);
+ si_create_function(&ctx, "tcs_epilog", NULL, 0, params, num_params, last_sgpr);
declare_tess_lds(&ctx);
func = ctx.main_fn;
@@ -7380,7 +7381,7 @@ static bool si_compile_ps_prolog(struct si_screen *sscreen,
params[num_returns++] = ctx.f32;
/* Create the function. */
- si_create_function(&ctx, params, num_returns, params,
+ si_create_function(&ctx, "ps_prolog", params, num_returns, params,
num_params, last_sgpr);
func = ctx.main_fn;
@@ -7645,7 +7646,7 @@ static bool si_compile_ps_epilog(struct si_screen *sscreen,
params[i] = ctx.f32;
/* Create the function. */
- si_create_function(&ctx, NULL, 0, params, num_params, last_sgpr);
+ si_create_function(&ctx, "ps_epilog", NULL, 0, params, num_params, last_sgpr);
/* Disable elimination of unused inputs. */
si_llvm_add_attribute(ctx.main_fn,
"InitialPSInputAddr", 0xffffff);
diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h
index 758637311b8..2f5d3460ccb 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -194,6 +194,7 @@ void si_llvm_context_init(struct si_shader_context *ctx,
const struct tgsi_token *tokens);
void si_llvm_create_func(struct si_shader_context *ctx,
+ const char *name,
LLVMTypeRef *return_types, unsigned num_return_elems,
LLVMTypeRef *ParamTypes, unsigned ParamCount);
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index 2d82574690c..b37f7e6401d 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -1304,6 +1304,7 @@ void si_llvm_context_init(struct si_shader_context *ctx, const char *triple,
}
void si_llvm_create_func(struct si_shader_context *ctx,
+ const char *name,
LLVMTypeRef *return_types, unsigned num_return_elems,
LLVMTypeRef *ParamTypes, unsigned ParamCount)
{
@@ -1320,7 +1321,7 @@ void si_llvm_create_func(struct si_shader_context *ctx,
/* Setup the function */
ctx->return_type = ret_type;
main_fn_type = LLVMFunctionType(ret_type, ParamTypes, ParamCount, 0);
- ctx->main_fn = LLVMAddFunction(ctx->gallivm.module, "main", main_fn_type);
+ ctx->main_fn = LLVMAddFunction(ctx->gallivm.module, name, main_fn_type);
main_fn_body = LLVMAppendBasicBlockInContext(ctx->gallivm.context,
ctx->main_fn, "main_body");
LLVMPositionBuilderAtEnd(ctx->gallivm.builder, main_fn_body);