From 81818662a5e5f252f95f4b4611b0840854d25beb Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Wed, 14 Mar 2018 10:34:13 +0100 Subject: radv: record LLVM IR when debugging shaders If AMD_shader_info or RADV_TRACE_FILE is used we might need to keep trace of LLVM IR. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_nir_to_llvm.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/amd/vulkan/radv_nir_to_llvm.c') diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index 298150b8092..8c316959280 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -3229,6 +3229,13 @@ static void ac_compile_llvm_module(LLVMTargetMachineRef tm, ac_dump_module(llvm_module); memset(binary, 0, sizeof(*binary)); + + if (options->record_llvm_ir) { + char *llvm_ir = LLVMPrintModuleToString(llvm_module); + binary->llvm_ir_string = strdup(llvm_ir); + LLVMDisposeMessage(llvm_ir); + } + int v = ac_llvm_compile(llvm_module, binary, tm); if (v) { fprintf(stderr, "compile failed\n"); -- cgit v1.2.3