Mesa (master): gallivm: Remove lp_get_module_id.
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Tue Apr 19 10:32:39 UTC 2016
Module: Mesa
Branch: master
Commit: b5ca689ceea39dc54ffa47d263dc1a6705702c6e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b5ca689ceea39dc54ffa47d263dc1a6705702c6e
Author: Jose Fonseca <jfonseca at vmware.com>
Date: Fri Apr 15 11:27:02 2016 +0100
gallivm: Remove lp_get_module_id.
Just keep a copy of the module_name in gallivm.
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
---
src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 7 -------
src/gallium/auxiliary/gallivm/lp_bld_debug.h | 4 ----
src/gallium/auxiliary/gallivm/lp_bld_init.c | 15 ++++++++++++++-
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 a8c3899..a299c8a 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 375ba6c..efb7495 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 bf2b65b..687c01f 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 f0155b3..62ca0c7 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;
More information about the mesa-commit
mailing list