mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
radeonsi: inline si_llvm_shader_type into si_llvm_create_func
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
parent
4c0e68dfe5
commit
2d662c0cba
3 changed files with 22 additions and 33 deletions
|
|
@ -5706,7 +5706,6 @@ static void si_create_function(struct si_shader_context *ctx,
|
|||
|
||||
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);
|
||||
|
||||
for (i = 0; i <= last_sgpr; ++i) {
|
||||
|
|
|
|||
|
|
@ -240,7 +240,6 @@ si_shader_context(struct lp_build_tgsi_context *bld_base)
|
|||
}
|
||||
|
||||
void si_llvm_add_attribute(LLVMValueRef F, const char *name, int value);
|
||||
void si_llvm_shader_type(LLVMValueRef F, unsigned type);
|
||||
|
||||
LLVMTargetRef si_llvm_get_amdgpu_target(const char *triple);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,37 +65,6 @@ void si_llvm_add_attribute(LLVMValueRef F, const char *name, int value)
|
|||
LLVMAddTargetDependentFunctionAttr(F, name, str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the shader type we want to compile
|
||||
*
|
||||
* @param type shader type to set
|
||||
*/
|
||||
void si_llvm_shader_type(LLVMValueRef F, unsigned type)
|
||||
{
|
||||
enum si_llvm_calling_convention calling_conv;
|
||||
|
||||
switch (type) {
|
||||
case PIPE_SHADER_VERTEX:
|
||||
case PIPE_SHADER_TESS_CTRL:
|
||||
case PIPE_SHADER_TESS_EVAL:
|
||||
calling_conv = RADEON_LLVM_AMDGPU_VS;
|
||||
break;
|
||||
case PIPE_SHADER_GEOMETRY:
|
||||
calling_conv = RADEON_LLVM_AMDGPU_GS;
|
||||
break;
|
||||
case PIPE_SHADER_FRAGMENT:
|
||||
calling_conv = RADEON_LLVM_AMDGPU_PS;
|
||||
break;
|
||||
case PIPE_SHADER_COMPUTE:
|
||||
calling_conv = RADEON_LLVM_AMDGPU_CS;
|
||||
break;
|
||||
default:
|
||||
unreachable("Unhandle shader type");
|
||||
}
|
||||
|
||||
LLVMSetFunctionCallConv(F, calling_conv);
|
||||
}
|
||||
|
||||
static void init_amdgpu_target()
|
||||
{
|
||||
gallivm_init_llvm_targets();
|
||||
|
|
@ -1392,6 +1361,7 @@ void si_llvm_create_func(struct si_shader_context *ctx,
|
|||
{
|
||||
LLVMTypeRef main_fn_type, ret_type;
|
||||
LLVMBasicBlockRef main_fn_body;
|
||||
enum si_llvm_calling_convention call_conv;
|
||||
|
||||
if (num_return_elems)
|
||||
ret_type = LLVMStructTypeInContext(ctx->gallivm.context,
|
||||
|
|
@ -1407,6 +1377,27 @@ void si_llvm_create_func(struct si_shader_context *ctx,
|
|||
main_fn_body = LLVMAppendBasicBlockInContext(ctx->gallivm.context,
|
||||
ctx->main_fn, "main_body");
|
||||
LLVMPositionBuilderAtEnd(ctx->gallivm.builder, main_fn_body);
|
||||
|
||||
switch (ctx->type) {
|
||||
case PIPE_SHADER_VERTEX:
|
||||
case PIPE_SHADER_TESS_CTRL:
|
||||
case PIPE_SHADER_TESS_EVAL:
|
||||
call_conv = RADEON_LLVM_AMDGPU_VS;
|
||||
break;
|
||||
case PIPE_SHADER_GEOMETRY:
|
||||
call_conv = RADEON_LLVM_AMDGPU_GS;
|
||||
break;
|
||||
case PIPE_SHADER_FRAGMENT:
|
||||
call_conv = RADEON_LLVM_AMDGPU_PS;
|
||||
break;
|
||||
case PIPE_SHADER_COMPUTE:
|
||||
call_conv = RADEON_LLVM_AMDGPU_CS;
|
||||
break;
|
||||
default:
|
||||
unreachable("Unhandle shader type");
|
||||
}
|
||||
|
||||
LLVMSetFunctionCallConv(ctx->main_fn, call_conv);
|
||||
}
|
||||
|
||||
void si_llvm_optimize_module(struct si_shader_context *ctx)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue