From: Tom Stellard Date: Tue, 30 Apr 2013 14:38:03 +0000 (-0700) Subject: gallivm: Move LLVMStartMultithreaded() static initializer into gallivm X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=55eb8eaaa8bf8696d56effce6ed87f03bea779e0;p=mesa.git gallivm: Move LLVMStartMultithreaded() static initializer into gallivm This does not solve all of the problems with using LLVM in a multithreaded enivronment, but it should help in some cases. Reviewed-by: Mathias.Froehlich@web.de --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index a531d98e881..897f7ffb276 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -79,6 +79,21 @@ #include "lp_bld_misc.h" +namespace { + +class LLVMEnsureMultithreaded { +public: + LLVMEnsureMultithreaded() + { + if (!LLVMIsMultithreaded()) { + LLVMStartMultithreaded(); + } + } +}; + +static LLVMEnsureMultithreaded lLVMEnsureMultithreaded; + +} extern "C" void lp_set_target_options(void) diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp index fb974f91ac2..10127151b10 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp @@ -58,20 +58,6 @@ using namespace llvm; -namespace { - -class LLVMEnsureMultithreaded { -public: - LLVMEnsureMultithreaded() - { - llvm_start_multithreaded(); - } -}; - -static LLVMEnsureMultithreaded lLVMEnsureMultithreaded; - -} - /** * Set the shader type we want to compile *