};
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);
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. */
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;
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) {
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;
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;
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);
}
void si_llvm_create_func(struct si_shader_context *ctx,
+ const char *name,
LLVMTypeRef *return_types, unsigned num_return_elems,
LLVMTypeRef *ParamTypes, unsigned ParamCount)
{
/* 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);