[Mesa-dev] [PATCH 04/12] gallivm: Stop using module providers.
jfonseca at vmware.com
jfonseca at vmware.com
Tue May 13 05:01:10 PDT 2014
From: José Fonseca <jfonseca at vmware.com>
Nowadays LLVMModuleProviderRef is just an alias for LLVMModuleRef, so
its use just causes unnecessary confusion.
---
src/gallium/auxiliary/gallivm/lp_bld_init.c | 33 ++++++-----------------------
src/gallium/auxiliary/gallivm/lp_bld_init.h | 1 -
2 files changed, 7 insertions(+), 27 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index 85faef5..6934a28 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -122,7 +122,7 @@ create_pass_manager(struct gallivm_state *gallivm)
assert(!gallivm->passmgr);
assert(gallivm->target);
- gallivm->passmgr = LLVMCreateFunctionPassManager(gallivm->provider);
+ gallivm->passmgr = LLVMCreateFunctionPassManagerForModule(gallivm->module);
if (!gallivm->passmgr)
return FALSE;
@@ -177,26 +177,16 @@ create_pass_manager(struct gallivm_state *gallivm)
static void
free_gallivm_state(struct gallivm_state *gallivm)
{
- /* This leads to crashes w/ some versions of LLVM */
- LLVMModuleRef mod;
- char *error;
-
- if (gallivm->engine && gallivm->provider)
- LLVMRemoveModuleProvider(gallivm->engine, gallivm->provider,
- &mod, &error);
-
if (gallivm->passmgr) {
LLVMDisposePassManager(gallivm->passmgr);
}
-#if 0
- /* XXX this seems to crash with all versions of LLVM */
- if (gallivm->provider)
- LLVMDisposeModuleProvider(gallivm->provider);
-#endif
-
- /* This will already destroy any associated module */
- LLVMDisposeExecutionEngine(gallivm->engine);
+ if (gallivm->engine) {
+ /* This will already destroy any associated module */
+ LLVMDisposeExecutionEngine(gallivm->engine);
+ } else if (gallivm->module) {
+ LLVMDisposeModule(gallivm->module);
+ }
#if !USE_MCJIT
/* Don't free the TargetData, it's owned by the exec engine */
@@ -219,7 +209,6 @@ free_gallivm_state(struct gallivm_state *gallivm)
gallivm->engine = NULL;
gallivm->target = NULL;
gallivm->module = NULL;
- gallivm->provider = NULL;
gallivm->passmgr = NULL;
gallivm->context = NULL;
gallivm->builder = NULL;
@@ -253,8 +242,6 @@ init_gallivm_engine(struct gallivm_state *gallivm)
}
}
- LLVMAddModuleProvider(gallivm->engine, gallivm->provider);//new
-
#if !USE_MCJIT
gallivm->target = LLVMGetExecutionEngineTargetData(gallivm->engine);
if (!gallivm->target)
@@ -311,7 +298,6 @@ init_gallivm_state(struct gallivm_state *gallivm)
{
assert(!gallivm->context);
assert(!gallivm->module);
- assert(!gallivm->provider);
lp_build_init();
@@ -327,11 +313,6 @@ init_gallivm_state(struct gallivm_state *gallivm)
if (!gallivm->module)
goto fail;
- gallivm->provider =
- LLVMCreateModuleProviderForExistingModule(gallivm->module);
- if (!gallivm->provider)
- goto fail;
-
gallivm->builder = LLVMCreateBuilderInContext(gallivm->context);
if (!gallivm->builder)
goto fail;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.h b/src/gallium/auxiliary/gallivm/lp_bld_init.h
index 7edea61..68f4006 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.h
@@ -40,7 +40,6 @@ struct gallivm_state
{
LLVMModuleRef module;
LLVMExecutionEngineRef engine;
- LLVMModuleProviderRef provider;
LLVMTargetDataRef target;
LLVMPassManagerRef passmgr;
LLVMContextRef context;
--
1.9.1
More information about the mesa-dev
mailing list