diff options
author | Marek Olšák <[email protected]> | 2016-01-26 23:32:23 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-02-09 21:19:51 +0100 |
commit | dc5fc3c2f60b4c208369e0eddbf416af059d88c7 (patch) | |
tree | f444e32562ca274bce1335fe8c7254b127a9866f /src | |
parent | c1041366db7a8af64db5d426f48e253796b77e84 (diff) |
radeonsi: make LLVM IR dumping less messy
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_compute.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 18 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.h | 3 |
3 files changed, 15 insertions, 9 deletions
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c index 825fbb181ba..4d27e86b414 100644 --- a/src/gallium/drivers/radeonsi/si_compute.c +++ b/src/gallium/drivers/radeonsi/si_compute.c @@ -124,7 +124,8 @@ static void *si_create_compute_state( code, header->num_bytes); si_compile_llvm(sctx->screen, &program->kernels[i].binary, &program->kernels[i].config, sctx->tm, - mod, &sctx->b.debug, TGSI_PROCESSOR_COMPUTE); + mod, &sctx->b.debug, TGSI_PROCESSOR_COMPUTE, + "Compute Shader"); si_shader_dump(sctx->screen, &program->kernels[i], &sctx->b.debug, TGSI_PROCESSOR_COMPUTE); si_shader_binary_upload(sctx->screen, &program->kernels[i]); diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 7f151516b8b..4551831dd2a 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -4081,7 +4081,8 @@ int si_compile_llvm(struct si_screen *sscreen, LLVMTargetMachineRef tm, LLVMModuleRef mod, struct pipe_debug_callback *debug, - unsigned processor) + unsigned processor, + const char *name) { int r = 0; unsigned count = p_atomic_inc_return(&sscreen->b.num_compilations); @@ -4089,8 +4090,11 @@ int si_compile_llvm(struct si_screen *sscreen, if (r600_can_dump_shader(&sscreen->b, processor)) { fprintf(stderr, "radeonsi: Compiling shader %d\n", count); - if (!(sscreen->b.debug_flags & (DBG_NO_IR | DBG_PREOPT_IR))) + if (!(sscreen->b.debug_flags & (DBG_NO_IR | DBG_PREOPT_IR))) { + fprintf(stderr, "%s LLVM IR:\n\n", name); LLVMDumpModule(mod); + fprintf(stderr, "\n"); + } } if (!si_replace_shader(count, binary)) { @@ -4183,14 +4187,14 @@ static int si_generate_gs_copy_shader(struct si_screen *sscreen, radeon_llvm_finalize_module(&si_shader_ctx->radeon_bld); - if (r600_can_dump_shader(&sscreen->b, TGSI_PROCESSOR_GEOMETRY)) - fprintf(stderr, "Copy Vertex Shader for Geometry Shader:\n\n"); - r = si_compile_llvm(sscreen, &si_shader_ctx->shader->binary, &si_shader_ctx->shader->config, si_shader_ctx->tm, bld_base->base.gallivm->module, - debug, TGSI_PROCESSOR_GEOMETRY); + debug, TGSI_PROCESSOR_GEOMETRY, + "GS Copy Shader"); if (!r) { + if (r600_can_dump_shader(&sscreen->b, TGSI_PROCESSOR_GEOMETRY)) + fprintf(stderr, "GS Copy Shader:\n"); si_shader_dump(sscreen, si_shader_ctx->shader, debug, TGSI_PROCESSOR_GEOMETRY); r = si_shader_binary_upload(sscreen, si_shader_ctx->shader); @@ -4410,7 +4414,7 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm, radeon_llvm_finalize_module(&si_shader_ctx.radeon_bld); r = si_compile_llvm(sscreen, &shader->binary, &shader->config, tm, - mod, debug, si_shader_ctx.type); + mod, debug, si_shader_ctx.type, "TGSI shader"); if (r) { fprintf(stderr, "LLVM failed to compile shader\n"); goto out; diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index e3d1f4f39a1..c42c51e0455 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -328,7 +328,8 @@ int si_compile_llvm(struct si_screen *sscreen, LLVMTargetMachineRef tm, LLVMModuleRef mod, struct pipe_debug_callback *debug, - unsigned processor); + unsigned processor, + const char *name); void si_shader_destroy(struct si_shader *shader); unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index); int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader); |