From: José Fonseca Date: Mon, 12 May 2014 13:03:47 +0000 (+0100) Subject: gallivm: Stop using module providers. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=69f0835ff1dbf1d70418b56af9c97bb3aaecef27;p=mesa.git gallivm: Stop using module providers. Nowadays LLVMModuleProviderRef is just an alias for LLVMModuleRef, so its use just causes unnecessary confusion. Reviewed-by: Roland Scheidegger --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index 85faef508b9..6934a28891b 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 7edea616c4e..68f400661a3 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;