From 0fca80b3db64dc1d004f78e22b9de86a07e9de96 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Sat, 28 Jan 2017 17:32:05 +0100 Subject: various: Fix missing DumpModule with recent LLVM. Since LLVM revision 293359 DumpModule gets only implemented when either a debug build or LLVM_ENABLE_DUMP is set. This patch adds a direct replacement for the function for radv and radeonsi, However, as I don't know a good place to put common LLVM code for all three I inlined the implementation for LLVMPipe. v2: Use the new code for LLVM 3.4+ instead of LLVM 5+ & fixed indentation Signed-off-by: Bas Nieuwenhuizen Reviewed-by: Roland Scheidegger --- src/amd/common/ac_llvm_util.c | 8 ++++++++ src/amd/common/ac_llvm_util.h | 3 +++ src/amd/common/ac_nir_to_llvm.c | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/amd/common') diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/common/ac_llvm_util.c index 770e3bd13c1..7317db76baa 100644 --- a/src/amd/common/ac_llvm_util.c +++ b/src/amd/common/ac_llvm_util.c @@ -504,3 +504,11 @@ ac_prepare_cube_coords(struct ac_llvm_context *ctx, memcpy(coords_arg, coords, sizeof(coords)); } + +void +ac_dump_module(LLVMModuleRef module) +{ + char *str = LLVMPrintModuleToString(module); + fprintf(stderr, "%s", str); + LLVMDisposeMessage(str); +} diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h index 802c2662470..2d301c93575 100644 --- a/src/amd/common/ac_llvm_util.h +++ b/src/amd/common/ac_llvm_util.h @@ -95,6 +95,9 @@ ac_prepare_cube_coords(struct ac_llvm_context *ctx, LLVMValueRef *coords_arg, LLVMValueRef *derivs_arg); +void +ac_dump_module(LLVMModuleRef module); + #ifdef __cplusplus } #endif diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 72ae6eb0730..e83c7a2e488 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -4569,7 +4569,7 @@ static void ac_compile_llvm_module(LLVMTargetMachineRef tm, bool dump_shader) { if (dump_shader) - LLVMDumpModule(llvm_module); + ac_dump_module(llvm_module); memset(binary, 0, sizeof(*binary)); int v = ac_llvm_compile(llvm_module, binary, tm); -- cgit v1.2.3