[Mesa-dev] [PATCH 1/3] gallivm: Add helpers for creating and destroying TargetLibraryInfo

Marek Olšák maraeo at gmail.com
Fri Feb 5 10:20:50 UTC 2016


For the series:
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Thu, Feb 4, 2016 at 10:02 PM, Tom Stellard <thomas.stellard at amd.com> wrote:
> This functionality is not exposed via the LLVM C API.
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 30 +++++++++++++++++++++++++++
>  src/gallium/auxiliary/gallivm/lp_bld_misc.h   |  7 +++++++
>  2 files changed, 37 insertions(+)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> index 3ee708f..30ef37c 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> @@ -61,6 +61,11 @@
>  #include <llvm/Target/TargetOptions.h>
>  #include <llvm/ExecutionEngine/ExecutionEngine.h>
>  #include <llvm/ADT/Triple.h>
> +#if HAVE_LLVM >= 0x0307
> +#include <llvm/Analysis/TargetLibraryInfo.h>
> +#else
> +#include <llvm/Target/TargetLibraryInfo.h>
> +#endif
>  #if HAVE_LLVM < 0x0306
>  #include <llvm/ExecutionEngine/JITMemoryManager.h>
>  #else
> @@ -147,6 +152,31 @@ lp_set_target_options(void)
>     gallivm_init_llvm_targets();
>  }
>
> +extern "C"
> +LLVMTargetLibraryInfoRef
> +gallivm_create_target_library_info(const char *triple)
> +{
> +   return reinterpret_cast<LLVMTargetLibraryInfoRef>(
> +#if HAVE_LLVM < 0x0307
> +   new llvm::TargetLibraryInfo(
> +#else
> +   new llvm::TargetLibraryInfoImpl(
> +#endif
> +   llvm::Triple(triple)));
> +}
> +
> +extern "C"
> +void
> +gallivm_dispose_target_library_info(LLVMTargetLibraryInfoRef library_info)
> +{
> +   delete reinterpret_cast<
> +#if HAVE_LLVM < 0x0307
> +   llvm::TargetLibraryInfo
> +#else
> +   llvm::TargetLibraryInfoImpl
> +#endif
> +   *>(library_info);
> +}
>
>  extern "C"
>  LLVMValueRef
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/src/gallium/auxiliary/gallivm/lp_bld_misc.h
> index 86d2f86..30b7b16 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h
> @@ -32,6 +32,7 @@
>
>  #include "lp_bld.h"
>  #include <llvm-c/ExecutionEngine.h>
> +#include <llvm-c/Target.h>
>
>
>  #ifdef __cplusplus
> @@ -44,6 +45,12 @@ struct lp_generated_code;
>  extern void
>  gallivm_init_llvm_targets(void);
>
> +extern LLVMTargetLibraryInfoRef
> +gallivm_create_target_library_info(const char *triple);
> +
> +extern void
> +gallivm_dispose_target_library_info(LLVMTargetLibraryInfoRef library_info);
> +
>  extern void
>  lp_set_target_options(void);
>
> --
> 2.0.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list