summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-12-27 22:16:05 +0100
committerMarek Olšák <[email protected]>2016-01-03 22:41:16 +0100
commit7fa6bb47e3a19f4ad745f7a9fc77d24c7482d045 (patch)
tree6adb643973b99ee7a295e6b3fbdc4d04b159268f /src
parentfb98acb5a156ce7b50938cc50fc61f8560c8f7f2 (diff)
gallium/radeon: dump LLVM module outside of radeon_llvm_compile
Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/r600/r600_llvm.c4
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm_emit.c5
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm_emit.h2
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c10
4 files changed, 12 insertions, 9 deletions
diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
index b8a20b36af2..7f436067551 100644
--- a/src/gallium/drivers/r600/r600_llvm.c
+++ b/src/gallium/drivers/r600/r600_llvm.c
@@ -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);
diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c
index 408e8156106..3d0987624a6 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.c
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c
@@ -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);
diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.h b/src/gallium/drivers/radeon/radeon_llvm_emit.h
index 4084740f457..45f05a9e0e1 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.h
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.h
@@ -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);
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 4fdcd0dcaba..779550bfb95 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -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;