----- Original Message ----- > From: "Nicolai Hähnle" <nhaeh...@gmail.com> > To: "Ben Crocker" <bcroc...@redhat.com>, mesa-dev@lists.freedesktop.org > Cc: "Emil Velikov" <emil.l.veli...@gmail.com>, "17.2" > <mesa-sta...@lists.freedesktop.org> > Sent: Monday, October 2, 2017 5:40:31 AM > Subject: Re: [Mesa-dev] [PATCH 2/4] gallivm: allow additional llc options > > On 28.09.2017 20:09, Ben Crocker wrote: > > 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. > > > > Cc: "17.2" <mesa-sta...@lists.freedesktop.org> > > > > Signed-off-by: Ben Crocker <bcroc...@redhat.com> > > --- > > src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 21 +++++++++++++++++++++ > > 1 file changed, 21 insertions(+) > > > > diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp > > b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp > > index 342cb38..0b43c96 100644 > > --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp > > +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp > > @@ -49,6 +49,7 @@ > > #endif > > > > #include <llvm-c/Core.h> > > +#include <llvm-c/Support.h> > > #include <llvm-c/ExecutionEngine.h> > > #include <llvm/Target/TargetOptions.h> > > #include <llvm/ExecutionEngine/ExecutionEngine.h> > > @@ -122,6 +123,26 @@ static void init_native_targets() > > llvm::InitializeNativeTargetAsmPrinter(); > > > > llvm::InitializeNativeTargetDisassembler(); > > +#if DEBUG > > + { > > + 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 > > Just FYI, we're also calling LLVMParseCommandLineOptions from > ac_llvm_util.c, and that function doesn't seem to appreciate being > called multiple times. Not really an issue here since this will surely > only be used for llvmpipe, so: >
Indeed, I used the code in ac_llvm_util.c as a model for my code. And you're right: my change is for llvmpipe only. > Acked-by: Nicolai Hähnle <nicolai.haeh...@amd.com> Thanks for the review and ack.... -- Ben > > > > } > > > > extern "C" void > > > > > -- > Lerne, wie die Welt wirklich ist, > Aber vergiss niemals, wie sie sein sollte. > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev