From 55eb8eaaa8bf8696d56effce6ed87f03bea779e0 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 30 Apr 2013 07:38:03 -0700 Subject: [PATCH] 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 --- src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 15 +++++++++++++++ src/gallium/drivers/radeon/radeon_llvm_emit.cpp | 14 -------------- 2 files changed, 15 insertions(+), 14 deletions(-) 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 * -- 2.30.2