From: Tom Stellard Date: Thu, 4 Feb 2016 19:36:50 +0000 (+0000) Subject: gallivm: Add helpers for creating and destroying TargetLibraryInfo X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=77f4e1c7ffeb9c98957f0f22c872f8ca7f93970d;p=mesa.git gallivm: Add helpers for creating and destroying TargetLibraryInfo This functionality is not exposed via the LLVM C API. Tested-by: Michel Dänzer Reviewed-by: Marek Olšák --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 3ee708f4fad..30ef37c9d22 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -61,6 +61,11 @@ #include #include #include +#if HAVE_LLVM >= 0x0307 +#include +#else +#include +#endif #if HAVE_LLVM < 0x0306 #include #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( +#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 86d2f86ac45..30b7b1674af 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 +#include #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);