summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2016-05-11 04:42:51 +0200
committerRoland Scheidegger <[email protected]>2016-05-11 04:43:35 +0200
commit430797843a4e9b3bc69562c4ef18dd2ddda39990 (patch)
tree58f50a085532a09a36a07b449542d66cf366e12f /src/gallium/auxiliary/gallivm
parent8d639138c712c5bbe0b9ea8adbc810b23a2e8d1b (diff)
gallivm: improve dumping of bitcode
Use GALLIVM_DEBUG=dumpbc for dumping of modules as bitcode. Instead of a fixed llvmpipe.bc name, use ir_<modulename>.bc so multiple modules can be dumped (albeit it might still overwrite previous modules, particularly the modules from draw tend to always have the same name). Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/gallivm')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_debug.h1
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_init.c12
2 files changed, 9 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.h b/src/gallium/auxiliary/gallivm/lp_bld_debug.h
index efb74955479..f96a1afa7aa 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.h
@@ -45,6 +45,7 @@
#define GALLIVM_DEBUG_NO_RHO_APPROX (1 << 6)
#define GALLIVM_DEBUG_NO_QUAD_LOD (1 << 7)
#define GALLIVM_DEBUG_GC (1 << 8)
+#define GALLIVM_DEBUG_DUMP_BC (1 << 9)
#ifdef __cplusplus
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index 687c01f1619..cf21ab0653b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -66,6 +66,7 @@ static const struct debug_named_value lp_bld_debug_flags[] = {
{ "no_rho_approx", GALLIVM_DEBUG_NO_RHO_APPROX, NULL },
{ "no_quad_lod", GALLIVM_DEBUG_NO_QUAD_LOD, NULL },
{ "gc", GALLIVM_DEBUG_GC, NULL },
+ { "dumpbc", GALLIVM_DEBUG_DUMP_BC, NULL },
DEBUG_NAMED_VALUE_END
};
@@ -592,10 +593,13 @@ gallivm_compile_module(struct gallivm_state *gallivm)
}
/* Dump byte code to a file */
- if (0) {
- LLVMWriteBitcodeToFile(gallivm->module, "llvmpipe.bc");
- debug_printf("llvmpipe.bc written\n");
- debug_printf("Invoke as \"llc -o - llvmpipe.bc\"\n");
+ if (gallivm_debug & GALLIVM_DEBUG_DUMP_BC) {
+ char filename[256];
+ assert(gallivm->module_name);
+ util_snprintf(filename, sizeof(filename), "ir_%s.bc", gallivm->module_name);
+ LLVMWriteBitcodeToFile(gallivm->module, filename);
+ debug_printf("%s written\n", filename);
+ debug_printf("Invoke as \"llc -o - %s\"\n", filename);
}
if (USE_MCJIT) {