[Mesa-dev] [PATCH 06/11] ac: add target library info helpers
Dave Airlie
airlied at gmail.com
Tue Jul 3 00:42:19 UTC 2018
From: Dave Airlie <airlied at redhat.com>
---
src/amd/common/ac_llvm_helper.cpp | 13 +++++++++++++
src/amd/common/ac_llvm_util.h | 2 ++
2 files changed, 15 insertions(+)
diff --git a/src/amd/common/ac_llvm_helper.cpp b/src/amd/common/ac_llvm_helper.cpp
index 495bd98da9c..48a5a44e392 100644
--- a/src/amd/common/ac_llvm_helper.cpp
+++ b/src/amd/common/ac_llvm_helper.cpp
@@ -36,6 +36,7 @@
#include <llvm/IR/Attributes.h>
#include <llvm/IR/CallSite.h>
#include <llvm/IR/IRBuilder.h>
+#include <llvm/Analysis/TargetLibraryInfo.h>
void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)
{
@@ -97,3 +98,15 @@ LLVMBuilderRef ac_create_builder(LLVMContextRef ctx,
return builder;
}
+
+LLVMTargetLibraryInfoRef
+ac_create_target_library_info(const char *triple)
+{
+ return reinterpret_cast<LLVMTargetLibraryInfoRef>(new llvm::TargetLibraryInfoImpl(llvm::Triple(triple)));
+}
+
+void
+ac_dispose_target_library_info(LLVMTargetLibraryInfoRef library_info)
+{
+ delete reinterpret_cast<llvm::TargetLibraryInfoImpl *>(library_info);
+}
diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h
index 1c0e975aec3..95a9f0c1557 100644
--- a/src/amd/common/ac_llvm_util.h
+++ b/src/amd/common/ac_llvm_util.h
@@ -113,6 +113,8 @@ ac_count_scratch_private_memory(LLVMValueRef function);
LLVMPassManagerRef ac_init_passmgr(LLVMTargetLibraryInfoRef target_library_info,
bool check_ir);
+LLVMTargetLibraryInfoRef ac_create_target_library_info(const char *triple);
+void ac_dispose_target_library_info(LLVMTargetLibraryInfoRef library_info);
void ac_init_llvm_once(void);
#ifdef __cplusplus
--
2.17.1
More information about the mesa-dev
mailing list