[Mesa-dev] [PATCH 08/11] ac/radv: wrap compiler emit to memory.
Dave Airlie
airlied at gmail.com
Wed Jun 27 03:58:42 UTC 2018
From: Dave Airlie <airlied at redhat.com>
This will be used later.
---
src/amd/common/ac_llvm_helper.cpp | 9 +++++++++
src/amd/common/ac_llvm_util.h | 4 ++++
src/amd/vulkan/radv_nir_to_llvm.c | 4 ++--
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/amd/common/ac_llvm_helper.cpp b/src/amd/common/ac_llvm_helper.cpp
index 4bb89726b88..27403dbe085 100644
--- a/src/amd/common/ac_llvm_helper.cpp
+++ b/src/amd/common/ac_llvm_helper.cpp
@@ -100,3 +100,12 @@ ac_dispose_target_library_info(LLVMTargetLibraryInfoRef library_info)
{
delete reinterpret_cast<llvm::TargetLibraryInfoImpl *>(library_info);
}
+
+bool ac_compile_to_memory_buffer(struct ac_llvm_compiler_info *info,
+ LLVMModuleRef M,
+ char **ErrorMessage,
+ LLVMMemoryBufferRef *OutMemBuf)
+{
+ return LLVMTargetMachineEmitToMemoryBuffer(info->tm, M, LLVMObjectFile,
+ ErrorMessage, OutMemBuf);
+}
diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h
index bc91717b5f1..647cf020e43 100644
--- a/src/amd/common/ac_llvm_util.h
+++ b/src/amd/common/ac_llvm_util.h
@@ -130,6 +130,10 @@ LLVMTargetLibraryInfoRef ac_create_target_library_info(const char *triple);
void ac_dispose_target_library_info(LLVMTargetLibraryInfoRef library_info);
void ac_init_llvm_once(void);
+bool ac_compile_to_memory_buffer(struct ac_llvm_compiler_info *info,
+ LLVMModuleRef M,
+ char **ErrorMessage,
+ LLVMMemoryBufferRef *OutMemBuf);
#ifdef __cplusplus
}
#endif
diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c
index 115aa773e35..76daedcb509 100644
--- a/src/amd/vulkan/radv_nir_to_llvm.c
+++ b/src/amd/vulkan/radv_nir_to_llvm.c
@@ -3345,8 +3345,8 @@ static unsigned ac_llvm_compile(LLVMModuleRef M,
&retval);
/* Compile IR*/
- mem_err = LLVMTargetMachineEmitToMemoryBuffer(llvm_info->tm, M, LLVMObjectFile,
- &err, &out_buffer);
+ mem_err = ac_compile_to_memory_buffer(llvm_info, M,
+ &err, &out_buffer);
/* Process Errors/Warnings */
if (mem_err) {
--
2.17.1
More information about the mesa-dev
mailing list