[Mesa-dev] [PATCH 6/6] gallium/radeon: cleanup dump parameters to radeon_llvm_compile
Marek Olšák
maraeo at gmail.com
Fri Jan 1 03:15:10 PST 2016
Sorry, but I think this can be dropped. I have a bigger cleanup of
these functions. I should send that soon.
Marek
On Thu, Dec 31, 2015 at 3:30 AM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> Now that the functions gets a context pointer, it can determine IR and ASM
> dumping by itself.
>
> The dump parameter is still required because we cannot easily tell the shader
> type at this point (one might argue that the separate enable flags for the
> different types offer little value, but that would be a separate change).
> ---
> src/gallium/drivers/r600/r600_llvm.c | 2 +-
> src/gallium/drivers/radeon/radeon_llvm_emit.c | 6 +++---
> src/gallium/drivers/radeon/radeon_llvm_emit.h | 2 +-
> src/gallium/drivers/radeonsi/si_shader.c | 7 +++----
> 4 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
> index a68f265..b72401d 100644
> --- a/src/gallium/drivers/r600/r600_llvm.c
> +++ b/src/gallium/drivers/r600/r600_llvm.c
> @@ -923,7 +923,7 @@ 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(rctx, mod, &binary, gpu_family, dump, dump, NULL);
> + r = radeon_llvm_compile(rctx, mod, &binary, gpu_family, dump, 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 62e06ca..03dd5dd 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)
> */
> unsigned radeon_llvm_compile(struct r600_common_context *rctx,
> LLVMModuleRef M, struct radeon_shader_binary *binary,
> - const char *gpu_family, bool dump_ir, bool dump_asm,
> + const char *gpu_family, bool dump,
> LLVMTargetMachineRef tm)
> {
> struct radeon_llvm_diagnostics diag;
> @@ -198,14 +198,14 @@ unsigned radeon_llvm_compile(struct r600_common_context *rctx,
> }
> strncpy(cpu, gpu_family, CPU_STRING_LEN);
> memset(fs, 0, sizeof(fs));
> - if (dump_asm)
> + if (dump && !(rctx->screen->debug_flags & DBG_NO_ASM))
> strncpy(fs, "+DumpCode", FS_STRING_LEN);
> tm = LLVMCreateTargetMachine(target, triple, cpu, fs,
> LLVMCodeGenLevelDefault, LLVMRelocDefault,
> LLVMCodeModelDefault);
> dispose_tm = true;
> }
> - if (dump_ir)
> + if (dump && !(rctx->screen->debug_flags & DBG_NO_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 be72c6b..e15d2f9 100644
> --- a/src/gallium/drivers/radeon/radeon_llvm_emit.h
> +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.h
> @@ -40,7 +40,7 @@ LLVMTargetRef radeon_llvm_get_r600_target(const char *triple);
>
> unsigned radeon_llvm_compile(struct r600_common_context *rctx,
> LLVMModuleRef M, struct radeon_shader_binary *binary,
> - const char *gpu_family, bool dump_ir, bool dump_asm,
> + const char *gpu_family, bool dump,
> 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 3f5690e..6102845 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -3924,17 +3924,16 @@ int si_compile_llvm(struct si_context *sctx, struct si_shader *shader,
> {
> struct si_screen *sscreen = sctx->screen;
> int r = 0;
> - bool dump_asm = r600_can_dump_shader(&sscreen->b,
> + bool dump = r600_can_dump_shader(&sscreen->b,
> shader->selector ? shader->selector->tokens : NULL);
> - 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 (dump)
> fprintf(stderr, "radeonsi: Compiling shader %d\n", count);
>
> if (!si_replace_shader(count, &shader->binary)) {
> r = radeon_llvm_compile(&sctx->b, mod, &shader->binary,
> - r600_get_llvm_processor_name(sscreen->b.family), dump_ir, dump_asm, tm);
> + r600_get_llvm_processor_name(sscreen->b.family), dump, tm);
> if (r)
> return r;
> }
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list