On Sat, Apr 02, 2016 at 03:10:44PM +0200, Bas Nieuwenhuizen wrote:
> Note that old mesa + new LLVM or new mesa + old LLVM breaks
> with this change and the corresponding LLVM change (D18559).
> 
> For LLVM version <= 3.8 we use the old method, but we can't detect
> people using a post 3.8 svn version that is still too old.
> 
> Signed-off-by: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl>
> ---
>  src/gallium/drivers/radeon/radeon_llvm_emit.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c 
> b/src/gallium/drivers/radeon/radeon_llvm_emit.c
> index 474154e..7174132 100644
> --- a/src/gallium/drivers/radeon/radeon_llvm_emit.c
> +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c
> @@ -55,6 +55,13 @@ enum radeon_llvm_shader_type {
>       RADEON_LLVM_SHADER_CS = 3,
>  };
>  
> +enum radeon_llvm_calling_convention {
> +     RADEON_LLVM_AMDGPU_VS = 87,
> +     RADEON_LLVM_AMDGPU_GS = 88,
> +     RADEON_LLVM_AMDGPU_PS = 89,
> +     RADEON_LLVM_AMDGPU_CS = 90,
> +};
> +
>  void radeon_llvm_add_attribute(LLVMValueRef F, const char *name, int value)
>  {
>       char str[16];
> @@ -71,27 +78,35 @@ void radeon_llvm_add_attribute(LLVMValueRef F, const char 
> *name, int value)
>  void radeon_llvm_shader_type(LLVMValueRef F, unsigned type)
>  {
>       enum radeon_llvm_shader_type llvm_type;
> +     enum radeon_llvm_calling_convention calling_conv;
>  

This looks like you will get 'unused variable warnings' with this change.
Probably this easiest thing to do is put (void)variable_name somewhere, but
I'm not sure this is really a big deal.
Either way:

Reviewed-by: Tom Stellard <thomas.stell...@amd.com>


>       switch (type) {
>       case TGSI_PROCESSOR_VERTEX:
>       case TGSI_PROCESSOR_TESS_CTRL:
>       case TGSI_PROCESSOR_TESS_EVAL:
>               llvm_type = RADEON_LLVM_SHADER_VS;
> +             calling_conv = RADEON_LLVM_AMDGPU_VS;
>               break;
>       case TGSI_PROCESSOR_GEOMETRY:
>               llvm_type = RADEON_LLVM_SHADER_GS;
> +             calling_conv = RADEON_LLVM_AMDGPU_GS;
>               break;
>       case TGSI_PROCESSOR_FRAGMENT:
>               llvm_type = RADEON_LLVM_SHADER_PS;
> +             calling_conv = RADEON_LLVM_AMDGPU_PS;
>               break;
>       case TGSI_PROCESSOR_COMPUTE:
>               llvm_type = RADEON_LLVM_SHADER_CS;
> +             calling_conv = RADEON_LLVM_AMDGPU_CS;
>               break;
>       default:
>               assert(0);
>       }
>  
> -     radeon_llvm_add_attribute(F, "ShaderType", llvm_type);
> +     if (HAVE_LLVM >= 0x309)
> +             LLVMSetFunctionCallConv(F, calling_conv);
> +     else
> +             radeon_llvm_add_attribute(F, "ShaderType", llvm_type);
>  }
>  
>  static void init_r600_target()
> -- 
> 2.7.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to