[Mesa-dev] [PATCH 3/4] configure.ac: Separate HAVE_LLVM defines for gallium and radv

Tobias Droste tdroste at gmx.de
Sat Jan 28 13:58:16 UTC 2017


Ignore that, wrong version...

Am Samstag, 28. Januar 2017, 14:56:59 CET schrieb Tobias Droste:
> Only define HAVE_LLVM if --enable-gallium-llvm is provided.
> If radv is built add HAVE_LLVM_RADV define with the same value
> as HAVE_LLVM.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99010
> 
> Signed-off-by: Tobias Droste <tdroste at gmx.de>
> ---
>  configure.ac                      |  3 ++-
>  src/amd/common/ac_llvm_helper.cpp |  8 +++++++-
>  src/amd/common/ac_llvm_util.c     | 17 ++++++++++++-----
>  3 files changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index f956df5120..5101e3bb0b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1001,7 +1001,6 @@ llvm_set_environment_variables() {
>              LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR}"
>          fi
> 
> -        DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT
> -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH" FOUND_LLVM=yes
>          USE_LLVM=no
>      else
> @@ -1775,6 +1774,7 @@ if test -n "$with_vulkan_drivers"; then
>              PKG_CHECK_MODULES([AMDGPU], [libdrm_amdgpu >=
> $LIBDRM_AMDGPU_REQUIRED]) radeon_llvm_check $LLVM_REQUIRED_RADV "radv"
>              HAVE_RADEON_VULKAN=yes;
> +            DEFINES="${DEFINES} -DHAVE_LLVM_RADV=0x0$LLVM_VERSION_INT
> -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH" ;;
>          *)
>              AC_MSG_ERROR([Vulkan driver '$driver' does not exist])
> @@ -2407,6 +2407,7 @@ if test "x$enable_gallium_llvm" == "xyes"; then
>      llvm_add_default_components "gallium"
> 
>      USE_LLVM_GALLIUM=yes
> +    DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT
> -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH" else
>      USE_LLVM_GALLIUM=no
>  fi
> diff --git a/src/amd/common/ac_llvm_helper.cpp
> b/src/amd/common/ac_llvm_helper.cpp index 594339ee8c..b787bf9e49 100644
> --- a/src/amd/common/ac_llvm_helper.cpp
> +++ b/src/amd/common/ac_llvm_helper.cpp
> @@ -23,10 +23,16 @@
>   *
>   */
> 
> +#if defined(HAVE_LLVM)
> +#  define MESA_LLVM_VERSION HAVE_LLVM
> +#elif defined(HAVE_LLVM_RADV)
> +#  define MESA_LLVM_VERSION HAVE_LLVM_RADV
> +#endif
> +
>  /* based on Marek's patch to lp_bld_misc.cpp */
> 
>  // Workaround http://llvm.org/PR23628
> -#if HAVE_LLVM >= 0x0307
> +#if MESA_LLVM_VERSION >= 0x0307
>  #  pragma push_macro("DEBUG")
>  #  undef DEBUG
>  #endif
> diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/common/ac_llvm_util.c
> index 770e3bd13c..e8ae27d209 100644
> --- a/src/amd/common/ac_llvm_util.c
> +++ b/src/amd/common/ac_llvm_util.c
> @@ -22,6 +22,13 @@
>   * of the Software.
>   *
>   */
> +
> +#if defined(HAVE_LLVM)
> +#  define MESA_LLVM_VERSION HAVE_LLVM
> +#elif defined(HAVE_LLVM_RADV)
> +#  define MESA_LLVM_VERSION HAVE_LLVM_RADV
> +#endif
> +
>  /* based on pieces from si_pipe.c and radeon_llvm_emit.c */
>  #include "ac_llvm_util.h"
> 
> @@ -37,7 +44,7 @@
> 
>  static void ac_init_llvm_target()
>  {
> -#if HAVE_LLVM < 0x0307
> +#if MESA_LLVM_VERSION < 0x0307
>  	LLVMInitializeR600TargetInfo();
>  	LLVMInitializeR600Target();
>  	LLVMInitializeR600TargetMC();
> @@ -99,7 +106,7 @@ static const char *ac_get_llvm_processor_name(enum
> radeon_family family) return "iceland";
>  	case CHIP_CARRIZO:
>  		return "carrizo";
> -#if HAVE_LLVM <= 0x0307
> +#if MESA_LLVM_VERSION <= 0x0307
>  	case CHIP_FIJI:
>  		return "tonga";
>  	case CHIP_STONEY:
> @@ -110,7 +117,7 @@ static const char *ac_get_llvm_processor_name(enum
> radeon_family family) case CHIP_STONEY:
>  		return "stoney";
>  #endif
> -#if HAVE_LLVM <= 0x0308
> +#if MESA_LLVM_VERSION <= 0x0308
>  	case CHIP_POLARIS10:
>  		return "tonga";
>  	case CHIP_POLARIS11:
> @@ -166,7 +173,7 @@ ac_llvm_context_init(struct ac_llvm_context *ctx,
> LLVMContextRef context) ctx->fpmath_md_2p5_ulp =
> LLVMMDNodeInContext(ctx->context, args, 1); }
> 
> -#if HAVE_LLVM < 0x0400
> +#if MESA_LLVM_VERSION < 0x0400
>  static LLVMAttribute ac_attr_to_llvm_attr(enum ac_func_attr attr)
>  {
>     switch (attr) {
> @@ -209,7 +216,7 @@ ac_add_function_attr(LLVMValueRef function,
>                       enum ac_func_attr attr)
>  {
> 
> -#if HAVE_LLVM < 0x0400
> +#if MESA_LLVM_VERSION < 0x0400
>     LLVMAttribute llvm_attr = ac_attr_to_llvm_attr(attr);
>     if (attr_idx == -1) {
>        LLVMAddFunctionAttr(function, llvm_attr);


More information about the mesa-dev mailing list