diff options
author | Marek Olšák <[email protected]> | 2017-04-27 02:12:48 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-05-05 00:23:44 +0200 |
commit | 2d662c0cba27423694a0a84fcfbc361a646c967a (patch) | |
tree | 70486c7352d1303fae6fefb90659d0ea0e9eaa57 | |
parent | 4c0e68dfe5a0bb69f07466ca39e8a243b00d06b8 (diff) |
radeonsi: inline si_llvm_shader_type into si_llvm_create_func
Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_internal.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 53 |
3 files changed, 22 insertions, 33 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index f9b94052597..ece9a74163f 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -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) { diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h index b54db20c704..35315caac6b 100644 --- a/src/gallium/drivers/radeonsi/si_shader_internal.h +++ b/src/gallium/drivers/radeonsi/si_shader_internal.h @@ -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); diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c index 2b0d6001fd5..de671ef80d6 100644 --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c @@ -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) |