[Mesa-dev] [PATCH 1/3] gallivm: Improve debug output
Ben Crocker
bcrocker at redhat.com
Fri Jan 13 20:39:03 UTC 2017
Improve debug output from gallivm_compile_module and
lp_build_create_jit_compiler_for_module, printing the
-mcpu and -mattr options passed to LLC.
Signed-off-by: Ben Crocker <bcrocker at redhat.com>
---
src/gallium/auxiliary/gallivm/lp_bld_init.c | 5 ++++-
src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 9 +++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index d1b2369..fed43e9 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -606,7 +606,10 @@ gallivm_compile_module(struct gallivm_state *gallivm)
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);
+ debug_printf("Invoke as \"llc %s%s -o - %s\"\n",
+ (HAVE_LLVM >= 0x0305) ? "[-mcpu=<-mcpu option] " : "",
+ "[-mattr=<-mattr option(s)>]",
+ filename);
}
if (USE_MCJIT) {
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 21d9e15..f7b31ee 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -627,6 +627,14 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
builder.setMAttrs(MAttrs);
+ int n = MAttrs.size();
+ if (n > 0) {
+ debug_printf("llc -mattr option(s): ");
+ for (int i = 0; i < n; i++)
+ debug_printf("%s%s", MAttrs[i].c_str(), (i < n - 1) ? "," : "");
+ debug_printf("\n");
+ }
+
#if HAVE_LLVM >= 0x0305
StringRef MCPU = llvm::sys::getHostCPUName();
/*
@@ -642,6 +650,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
* can't handle. Not entirely sure if we really need to do anything yet.
*/
builder.setMCPU(MCPU);
+ debug_printf("llc -mcpu option: %s\n", MCPU.str().c_str());
#endif
ShaderMemoryManager *MM = NULL;
--
2.7.4
More information about the mesa-dev
mailing list