diff options
author | Samuel Pitoiset <[email protected]> | 2018-03-14 10:34:13 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2018-03-15 17:20:03 +0100 |
commit | 81818662a5e5f252f95f4b4611b0840854d25beb (patch) | |
tree | 27c43722e267b68a129c2c5e2f8d190edcc36878 /src/amd/vulkan/radv_nir_to_llvm.c | |
parent | d07edf5fdf70b42324cac961feb10fb41c71b13b (diff) |
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 <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_nir_to_llvm.c')
-rw-r--r-- | src/amd/vulkan/radv_nir_to_llvm.c | 7 |
1 files changed, 7 insertions, 0 deletions
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"); |