Mesa (master): gallium/radeon: more descriptive names for LLVM temporaries in debug builds

Nicolai Hähnle nh at kemper.freedesktop.org
Wed Aug 17 10:11:30 UTC 2016


Module: Mesa
Branch: master
Commit: 92b66b38c94bbcdf9633756f92c196fcfea20ac1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=92b66b38c94bbcdf9633756f92c196fcfea20ac1

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Mon Aug  8 21:55:47 2016 +0200

gallium/radeon: more descriptive names for LLVM temporaries in debug builds

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index 7b96a58..22ff18e 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -38,6 +38,7 @@
 #include "util/u_memory.h"
 #include "util/u_debug.h"
 
+#include <stdio.h>
 #include <llvm-c/Core.h>
 #include <llvm-c/Transforms/Scalar.h>
 
@@ -428,6 +429,7 @@ static void emit_declaration(struct lp_build_tgsi_context *bld_base,
 
 	case TGSI_FILE_TEMPORARY:
 	{
+		char name[16] = "";
 		LLVMValueRef array_alloca = NULL;
 		unsigned decl_size;
 		first = decl->Range.First;
@@ -465,10 +467,14 @@ static void emit_declaration(struct lp_build_tgsi_context *bld_base,
 		}
 		if (!array_alloca) {
 			for (i = 0; i < decl_size; ++i) {
+#ifdef DEBUG
+				snprintf(name, sizeof(name), "TEMP%d.%c",
+					 first + i / 4, "xyzw"[i % 4]);
+#endif
 				ctx->temps[first * TGSI_NUM_CHANNELS + i] =
 					si_build_alloca_undef(bld_base->base.gallivm,
 							      bld_base->base.vec_type,
-							      "temp");
+							      name);
 			}
 		} else {
 			LLVMValueRef idxs[2] = {
@@ -476,9 +482,13 @@ static void emit_declaration(struct lp_build_tgsi_context *bld_base,
 				NULL
 			};
 			for (i = 0; i < decl_size; ++i) {
+#ifdef DEBUG
+				snprintf(name, sizeof(name), "TEMP%d.%c",
+					 first + i / 4, "xyzw"[i % 4]);
+#endif
 				idxs[1] = lp_build_const_int32(bld_base->base.gallivm, i);
 				ctx->temps[first * TGSI_NUM_CHANNELS + i] =
-					LLVMBuildGEP(builder, array_alloca, idxs, 2, "temp");
+					LLVMBuildGEP(builder, array_alloca, idxs, 2, name);
 			}
 		}
 		break;




More information about the mesa-commit mailing list