[Mesa-dev] [PATCH] gallivm: correctly manage MCJIT at run-time
Emil Velikov
emil.l.velikov at gmail.com
Sat Jan 14 01:31:14 UTC 2017
Earlier commit made the decision whether to use MCJIT a run-time one. At
the same time, it changed the code-flow in the following manner:
- LLVMLinkInMCJIT() was executed regardless of whether MCJIT is to be
used or not. Admittedly it is a no-op at least in some builds.
- LLVMLinkInJIT() was executed regardless of weather MCJIT is to be
used or not.
Resolve that my promoting USE_MCJIT to be static bool, always. Make sure
it's honoured and the correct LLVMLinkIn{MC,}JIT() function is called
only as needed.
Fixes: cf4105740f0 "gallivm: Make MCJIT a runtime option."
Cc: Zhen Wu <wuzhen at jidemail.com>
Cc: Jose Fonseca <jfonseca at vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
Jose, rather than jumping around like a headless chicken I've went ahead
and fixed things... or maybe I broke it ? Afaict this preserves the
original behaviour and linking should be perfectly fine.
XXX: worth dropping the ALL_CAPS from the, now, variable name ? Should
we squash it here or as separate patch ?
As an added bonus might even solve the issue Wu Zhen is hitting :-)
---
src/gallium/auxiliary/gallivm/lp_bld_init.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index d1b2369f34..9a77c87ae4 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -45,9 +45,9 @@
/* Only MCJIT is available as of LLVM SVN r216982 */
#if HAVE_LLVM >= 0x0306
-# define USE_MCJIT 1
+static bool USE_MCJIT = 1;
#elif defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_ARM) || defined(PIPE_ARCH_AARCH64)
-# define USE_MCJIT 1
+static bool USE_MCJIT = 1;
#else
static bool USE_MCJIT = 0;
#endif
@@ -395,11 +395,11 @@ lp_build_init(void)
if (gallivm_initialized)
return TRUE;
- LLVMLinkInMCJIT();
-#if !defined(USE_MCJIT)
- USE_MCJIT = debug_get_bool_option("GALLIVM_MCJIT", 0);
- LLVMLinkInJIT();
-#endif
+ USE_MCJIT = debug_get_bool_option("GALLIVM_MCJIT", USE_MCJIT);
+ if (USE_MCJIT)
+ LLVMLinkInMCJIT();
+ else
+ LLVMLinkInJIT();
#ifdef DEBUG
gallivm_debug = debug_get_option_gallivm_debug();
--
2.11.0
More information about the mesa-dev
mailing list