ac: add target library info helpers
authorDave Airlie <airlied@redhat.com>
Tue, 26 Jun 2018 23:34:42 +0000 (09:34 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 3 Jul 2018 19:31:29 +0000 (05:31 +1000)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_llvm_helper.cpp
src/amd/common/ac_llvm_util.h

index 495bd98da9cb93b83d95957b2c1cf3819d5773a9..48a5a44e392b20bf8a0589cb32a5878b9f9dc924 100644 (file)
@@ -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);
+}
index 8d4f7d83150daf37bcf0726c4b7018da52af73e5..1175971e2577f9c78094872768cf44cd39e19639 100644 (file)
@@ -113,6 +113,8 @@ ac_count_scratch_private_memory(LLVMValueRef function);
 
 LLVMPassManagerRef ac_create_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