Am 14.02.2017 um 22:16 schrieb Ben Crocker:
> 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 <bcroc...@redhat.com>
> Cc: 12.0 13.0 17.0 <mesa-sta...@lists.freedesktop.org>
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_init.c   |  5 ++++-
>  src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 14 ++++++++++++++
>  2 files changed, 18 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..13f9a4d 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> @@ -101,6 +101,7 @@
>  #include "util/u_cpu_detect.h"
>  
>  #include "lp_bld_misc.h"
> +#include "lp_bld_debug.h"
>  
>  namespace {
>  
> @@ -627,6 +628,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();
>     /*
> @@ -642,6 +653,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;
> 

Looks great.
Reviewed-by: Roland Scheidegger <srol...@vmware.com>


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to