diff options
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 7 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_debug.h | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_init.c | 15 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_init.h | 1 |
4 files changed, 15 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp index a8c3899ea66..a299c8a86dd 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp @@ -65,13 +65,6 @@ lp_check_alignment(const void *ptr, unsigned alignment) } -extern "C" const char * -lp_get_module_id(LLVMModuleRef module) -{ - return llvm::unwrap(module)->getModuleIdentifier().c_str(); -} - - /** * Same as LLVMDumpValue, but through our debugging channels. */ diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.h b/src/gallium/auxiliary/gallivm/lp_bld_debug.h index 375ba6cb5ff..efb74955479 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.h @@ -76,10 +76,6 @@ lp_build_name(LLVMValueRef val, const char *format, ...) } -const char * -lp_get_module_id(LLVMModuleRef module); - - void lp_debug_dump_value(LLVMValueRef value); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index bf2b65b52cb..687c01f1619 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -187,6 +187,8 @@ gallivm_free_ir(struct gallivm_state *gallivm) LLVMDisposeModule(gallivm->module); } + FREE(gallivm->module_name); + if (!USE_MCJIT) { /* Don't free the TargetData, it's owned by the exec engine */ } else { @@ -203,6 +205,7 @@ gallivm_free_ir(struct gallivm_state *gallivm) gallivm->engine = NULL; gallivm->target = NULL; gallivm->module = NULL; + gallivm->module_name = NULL; gallivm->passmgr = NULL; gallivm->context = NULL; gallivm->builder = NULL; @@ -306,6 +309,15 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name, if (!gallivm->context) goto fail; + gallivm->module_name = NULL; + if (name) { + size_t size = strlen(name) + 1; + gallivm->module_name = MALLOC(size); + if (gallivm->module_name) { + memcpy(gallivm->module_name, name, size); + } + } + gallivm->module = LLVMModuleCreateWithNameInContext(name, gallivm->context); if (!gallivm->module) @@ -574,8 +586,9 @@ gallivm_compile_module(struct gallivm_state *gallivm) if (gallivm_debug & GALLIVM_DEBUG_PERF) { int64_t time_end = os_time_get(); int time_msec = (int)(time_end - time_begin) / 1000; + assert(gallivm->module_name); debug_printf("optimizing module %s took %d msec\n", - lp_get_module_id(gallivm->module), time_msec); + gallivm->module_name, time_msec); } /* Dump byte code to a file */ diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.h b/src/gallium/auxiliary/gallivm/lp_bld_init.h index f0155b3a2ef..62ca0c7faa4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.h @@ -41,6 +41,7 @@ extern "C" { struct gallivm_state { + char *module_name; LLVMModuleRef module; LLVMExecutionEngineRef engine; LLVMTargetDataRef target; |