[Mesa-dev] [PATCH] gallivm: try to fix build with LLVM <= 3.4 due to missing CallSite.h
Brian Paul
brianp at vmware.com
Thu Oct 20 14:54:29 UTC 2016
Reviewed-by: Brian Paul <brianp at vmware.com>
Tested-by: Brian Paul <brianp at vmware.com>
Thanks!
On 10/20/2016 03:22 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> untested
> ---
> src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> index f4045ad..bd4d4d3 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> @@ -70,21 +70,23 @@
> #include <llvm/ExecutionEngine/JITMemoryManager.h>
> #else
> #include <llvm/ExecutionEngine/SectionMemoryManager.h>
> #endif
> #include <llvm/Support/CommandLine.h>
> #include <llvm/Support/Host.h>
> #include <llvm/Support/PrettyStackTrace.h>
>
> #include <llvm/Support/TargetSelect.h>
>
> +#if HAVE_LLVM >= 0x0305
> #include <llvm/IR/CallSite.h>
> +#endif
> #include <llvm/IR/IRBuilder.h>
> #include <llvm/IR/Module.h>
> #include <llvm/Support/CBindingWrapping.h>
>
> #include <llvm/Config/llvm-config.h>
> #if LLVM_USE_INTEL_JITEVENTS
> #include <llvm/ExecutionEngine/JITEventListener.h>
> #endif
>
> // Workaround http://llvm.org/PR23628
> @@ -708,22 +710,24 @@ lp_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)
> B.addDereferenceableAttr(bytes);
> A->addAttr(llvm::AttributeSet::get(A->getContext(), A->getArgNo() + 1, B));
> #endif
> }
>
> extern "C" LLVMValueRef
> lp_get_called_value(LLVMValueRef call)
> {
> #if HAVE_LLVM >= 0x0309
> return LLVMGetCalledValue(call);
> -#else
> +#elif HAVE_LLVM >= 0x0305
> return llvm::wrap(llvm::CallSite(llvm::unwrap<llvm::Instruction>(call)).getCalledValue());
> +#else
> + return NULL; /* radeonsi doesn't support so old LLVM. */
> #endif
> }
>
> extern "C" bool
> lp_is_function(LLVMValueRef v)
> {
> #if HAVE_LLVM >= 0x0309
> return LLVMGetValueKind(v) == LLVMFunctionValueKind;
> #else
> return llvm::isa<llvm::Function>(llvm::unwrap(v));
>
More information about the mesa-dev
mailing list