[Mesa-dev] [PATCH 2/3] gallium/radeon: assign a name to LLVM output variables in debug builds

Nicolai Hähnle nhaehnle at gmail.com
Fri Oct 7 16:04:48 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

This can be helpful with R600_DEBUG=preoptir.
---
 src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index da4a030..c843541 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -696,30 +696,35 @@ static void emit_declaration(struct lp_build_tgsi_context *bld_base,
 	{
 		unsigned idx;
 		for (idx = decl->Range.First; idx <= decl->Range.Last; idx++) {
 			ctx->load_system_value(ctx, idx, decl);
 		}
 	}
 	break;
 
 	case TGSI_FILE_OUTPUT:
 	{
+		char name[16] = "";
 		unsigned idx;
 		for (idx = decl->Range.First; idx <= decl->Range.Last; idx++) {
 			unsigned chan;
 			assert(idx < RADEON_LLVM_MAX_OUTPUTS);
 			if (ctx->soa.outputs[idx][0])
 				continue;
 			for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
+#ifdef DEBUG
+				snprintf(name, sizeof(name), "OUT%d.%c",
+					 idx, "xyzw"[chan % 4]);
+#endif
 				ctx->soa.outputs[idx][chan] = lp_build_alloca_undef(
 					&ctx->gallivm,
-					ctx->soa.bld_base.base.elem_type, "");
+					ctx->soa.bld_base.base.elem_type, name);
 			}
 		}
 		break;
 	}
 
 	case TGSI_FILE_MEMORY:
 		ctx->declare_memory_region(ctx, decl);
 		break;
 
 	default:
-- 
2.7.4



More information about the mesa-dev mailing list