summaryrefslogtreecommitdiffstats
path: root/src/amd/common/ac_llvm_helper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/amd/common/ac_llvm_helper.cpp')
-rw-r--r--src/amd/common/ac_llvm_helper.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/amd/common/ac_llvm_helper.cpp b/src/amd/common/ac_llvm_helper.cpp
index 11fa80920d6..03877d5ee1e 100644
--- a/src/amd/common/ac_llvm_helper.cpp
+++ b/src/amd/common/ac_llvm_helper.cpp
@@ -61,3 +61,21 @@ bool ac_is_sgpr_param(LLVMValueRef arg)
return AS.hasAttribute(ArgNo + 1, llvm::Attribute::ByVal) ||
AS.hasAttribute(ArgNo + 1, llvm::Attribute::InReg);
}
+
+LLVMValueRef ac_llvm_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
+}
+
+bool ac_llvm_is_function(LLVMValueRef v)
+{
+#if HAVE_LLVM >= 0x0309
+ return LLVMGetValueKind(v) == LLVMFunctionValueKind;
+#else
+ return llvm::isa<llvm::Function>(llvm::unwrap(v));
+#endif
+}