summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorBen Crocker <bcrocker@redhat.com>2017-02-14 16:16:01 -0500
committerEmil Velikov <emil.l.velikov@gmail.com>2017-03-15 14:39:55 +0000
commitf17a1534973d451a87b21e5808596564d33be385 (patch)
tree0fd65e228258ca7a2aad6f91e759b1117f7cf5cc /src/gallium
parent1441b436e7e79ff3ad5e28e5cee5df7a93e506ea (diff)
gallivm: Improve debug output (V2)
Improve debug output from gallivm_compile_module and lp_build_create_jit_compiler_for_module, printing the -mcpu and -mattr options passed to LLC. V2: enclose MAttrs debug_printf block and llc -mcpu debug_printf in "if (gallivm_debug & <flags>)..." Signed-off-by: Ben Crocker <bcrocker@redhat.com> Cc: 12.0 13.0 17.0 <mesa-stable@lists.freedesktop.org> Reviewed-by: Roland Scheidegger <sroland@vmware.com> (v2) [Emil Velikov: rebase] Signed-off-by: Emil Velikov <emil.velikov@collabora.com> (cherry picked from commit a8e9c630f3dc656d107c4252b90c8e991438a3c4)
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_init.c5
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_misc.cpp14
2 files changed, 18 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index d1b2369f34a..fed43e99e60 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 791a4702556..d13039c0507 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -98,6 +98,7 @@
#include "util/u_cpu_detect.h"
#include "lp_bld_misc.h"
+#include "lp_bld_debug.h"
namespace {
@@ -609,6 +610,16 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
builder.setMAttrs(MAttrs);
+ if (gallivm_debug & (GALLIVM_DEBUG_IR | GALLIVM_DEBUG_ASM | GALLIVM_DEBUG_DUMP_BC)) {
+ 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();
/*
@@ -624,6 +635,9 @@ 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);
+ if (gallivm_debug & (GALLIVM_DEBUG_IR | GALLIVM_DEBUG_ASM | GALLIVM_DEBUG_DUMP_BC)) {
+ debug_printf("llc -mcpu option: %s\n", MCPU.str().c_str());
+ }
#endif
ShaderMemoryManager *MM = NULL;