summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-10-20 00:09:44 +0200
committerMarek Olšák <[email protected]>2016-10-20 11:07:50 +0200
commit2db56434d4a275b5b24445dcaeaa024eca6fa7f9 (patch)
tree48101dfb52066393e02867e544e5697c43829978 /src/gallium/auxiliary
parent4a2dbfff05f7be271c2aa72e783e24b31906db51 (diff)
gallivm: add wrappers for missing functions in LLVM <= 3.8
radeonsi needs these. Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_misc.cpp21
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_misc.h6
2 files changed, 27 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 791a4702556..f4045ad1d89 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -77,6 +77,7 @@
#include <llvm/Support/TargetSelect.h>
+#include <llvm/IR/CallSite.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/Module.h>
#include <llvm/Support/CBindingWrapping.h>
@@ -708,3 +709,23 @@ lp_add_attr_dereferenceable(LLVMValueRef val, uint64_t 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
+ return llvm::wrap(llvm::CallSite(llvm::unwrap<llvm::Instruction>(call)).getCalledValue());
+#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));
+#endif
+}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/src/gallium/auxiliary/gallivm/lp_bld_misc.h
index c127c480d52..a55c6bd508d 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h
@@ -76,6 +76,12 @@ lp_free_memory_manager(LLVMMCJITMemoryManagerRef memorymgr);
extern void
lp_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes);
+extern LLVMValueRef
+lp_get_called_value(LLVMValueRef call);
+
+extern bool
+lp_is_function(LLVMValueRef v);
+
#ifdef __cplusplus
}
#endif