Mesa (master): gallivm: allow additional llc options
Roland Scheidegger
sroland at kemper.freedesktop.org
Thu Oct 5 00:19:32 UTC 2017
Module: Mesa
Branch: master
Commit: 5c75f0c8bb876c1f4c85cda5ed10a4d632d24f56
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5c75f0c8bb876c1f4c85cda5ed10a4d632d24f56
Author: Ben Crocker <bcrocker at redhat.com>
Date: Thu Sep 28 14:09:11 2017 -0400
gallivm: allow additional llc options
In init_native_targets, allow the passing of additional options to
the LLC compiler via new GALLIVM_LLC_OPTIONS environmental control.
This option is available only #ifdef DEBUG, initially.
At top, add #include <llvm-c/Support.h> for LLVMParseCommandLineOptions()
declaration.
v2: Fix compile error with old llvm versions (sroland)
Cc: "17.2" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Ben Crocker <bcrocker at redhat.com>
Acked-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
---
src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 342cb386d6..60d88269e5 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -49,6 +49,9 @@
#endif
#include <llvm-c/Core.h>
+#if HAVE_LLVM >= 0x0306
+#include <llvm-c/Support.h>
+#endif
#include <llvm-c/ExecutionEngine.h>
#include <llvm/Target/TargetOptions.h>
#include <llvm/ExecutionEngine/ExecutionEngine.h>
@@ -122,6 +125,26 @@ static void init_native_targets()
llvm::InitializeNativeTargetAsmPrinter();
llvm::InitializeNativeTargetDisassembler();
+#if DEBUG && HAVE_LLVM >= 0x0306
+ {
+ char *env_llc_options = getenv("GALLIVM_LLC_OPTIONS");
+ if (env_llc_options) {
+ char *option;
+ char *options[64] = {(char *) "llc"}; // Warning without cast
+ int n;
+ for (n = 0, option = strtok(env_llc_options, " "); option; n++, option = strtok(NULL, " ")) {
+ options[n + 1] = option;
+ }
+ if (gallivm_debug & (GALLIVM_DEBUG_IR | GALLIVM_DEBUG_ASM | GALLIVM_DEBUG_DUMP_BC)) {
+ debug_printf("llc additional options (%d):\n", n);
+ for (int i = 1; i <= n; i++)
+ debug_printf("\t%s\n", options[i]);
+ debug_printf("\n");
+ }
+ LLVMParseCommandLineOptions(n + 1, options, NULL);
+ }
+ }
+#endif
}
extern "C" void
More information about the mesa-commit
mailing list