[Mesa-dev] [PATCH 6/9] gallium/radeon: dump LLVM module outside of radeon_llvm_compile

Marek Olšák maraeo at gmail.com
Fri Jan 1 06:13:59 PST 2016


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/r600/r600_llvm.c          | 4 +++-
 src/gallium/drivers/radeon/radeon_llvm_emit.c | 6 ++----
 src/gallium/drivers/radeon/radeon_llvm_emit.h | 3 +--
 src/gallium/drivers/radeonsi/si_shader.c      | 8 +++++---
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
index 7d93658..722d019 100644
--- a/src/gallium/drivers/r600/r600_llvm.c
+++ b/src/gallium/drivers/r600/r600_llvm.c
@@ -922,7 +922,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);
+	if (dump)
+		LLVMDumpModule(mod);
+	r = radeon_llvm_compile(mod, &binary, gpu_family, NULL);
 
 	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 f8c7f54..d2b0462 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.c
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c
@@ -141,8 +141,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,
-			     LLVMTargetMachineRef tm)
+			     const char *gpu_family, LLVMTargetMachineRef tm)
 {
 
 	char cpu[CPU_STRING_LEN];
@@ -171,8 +170,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 5f956dd..fbc39ca 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.h
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.h
@@ -38,7 +38,6 @@ 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,
-			     LLVMTargetMachineRef tm);
+			     const char *gpu_family, LLVMTargetMachineRef tm);
 
 #endif /* RADEON_LLVM_EMIT_H */
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 4044961..8051cbde 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -3880,11 +3880,13 @@ int si_compile_llvm(struct si_screen *sscreen, struct si_shader *shader,
 		    LLVMTargetMachineRef tm, LLVMModuleRef mod, 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);
+
+	if (r600_can_dump_shader(&sscreen->b, processor) &&
+            !(sscreen->b.debug_flags & DBG_NO_IR))
+		LLVMDumpModule(mod);
 
 	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);
 	if (r)
 		return r;
 
-- 
2.1.4



More information about the mesa-dev mailing list