Module: Mesa
Branch: master
Commit: 2d662c0cba27423694a0a84fcfbc361a646c967a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d662c0cba27423694a0a84fcfbc361a646c967a

Author: Marek Olšák <[email protected]>
Date:   Thu Apr 27 02:12:48 2017 +0200

radeonsi: inline si_llvm_shader_type into si_llvm_create_func

Reviewed-by: Nicolai Hähnle <[email protected]>

---

 src/gallium/drivers/radeonsi/si_shader.c           |  1 -
 src/gallium/drivers/radeonsi/si_shader_internal.h  |  1 -
 .../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 f9b9405259..ece9a74163 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 b54db20c70..35315caac6 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 2b0d6001fd..de671ef80d 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)

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to