gallium/radeon: dump LLVM module outside of radeon_llvm_compile

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
Marek Olšák
2015-12-27 22:16:05 +01:00
parent fb98acb5a1
commit 7fa6bb47e3
4 changed files with 12 additions and 9 deletions

View File

@@ -923,7 +923,9 @@ unsigned r600_llvm_compile(
const char * gpu_family = r600_get_llvm_processor_name(family);
memset(&binary, 0, sizeof(struct radeon_shader_binary));
r = radeon_llvm_compile(mod, &binary, gpu_family, dump, NULL, debug);
if (dump)
LLVMDumpModule(mod);
r = radeon_llvm_compile(mod, &binary, gpu_family, NULL, debug);
r = r600_create_shader(bc, &binary, use_kill);

View File

@@ -172,7 +172,7 @@ static void radeonDiagnosticHandler(LLVMDiagnosticInfoRef di, void *context)
* @returns 0 for success, 1 for failure
*/
unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binary,
const char *gpu_family, bool dump_ir,
const char *gpu_family,
LLVMTargetMachineRef tm,
struct pipe_debug_callback *debug)
{
@@ -205,8 +205,7 @@ unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binar
LLVMCodeModelDefault);
dispose_tm = true;
}
if (dump_ir)
LLVMDumpModule(M);
/* Setup Diagnostic Handler*/
llvm_ctx = LLVMGetModuleContext(M);

View File

@@ -39,7 +39,7 @@ void radeon_llvm_shader_type(LLVMValueRef F, unsigned type);
LLVMTargetRef radeon_llvm_get_r600_target(const char *triple);
unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binary,
const char *gpu_family, bool dump_ir,
const char *gpu_family,
LLVMTargetMachineRef tm,
struct pipe_debug_callback *debug);

View File

@@ -3922,16 +3922,18 @@ int si_compile_llvm(struct si_screen *sscreen, struct si_shader *shader,
struct pipe_debug_callback *debug, unsigned processor)
{
int r = 0;
bool dump_asm = r600_can_dump_shader(&sscreen->b, processor);
bool dump_ir = dump_asm && !(sscreen->b.debug_flags & DBG_NO_IR);
unsigned count = p_atomic_inc_return(&sscreen->b.num_compilations);
if (dump_ir || dump_asm)
if (r600_can_dump_shader(&sscreen->b, processor)) {
fprintf(stderr, "radeonsi: Compiling shader %d\n", count);
if (!(sscreen->b.debug_flags & DBG_NO_IR))
LLVMDumpModule(mod);
}
if (!si_replace_shader(count, &shader->binary)) {
r = radeon_llvm_compile(mod, &shader->binary,
r600_get_llvm_processor_name(sscreen->b.family), dump_ir, tm,
r600_get_llvm_processor_name(sscreen->b.family), tm,
debug);
if (r)
return r;