[Mesa-dev] [PATCH 2/9] gallivm: Use LLVMSetTarget.

Emil Velikov emil.l.velikov at gmail.com
Mon Apr 18 12:27:20 UTC 2016


Hi Jose,

On 18 April 2016 at 10:14, Jose Fonseca <jfonseca at vmware.com> wrote:
> Instead of LLVM C++ interfaces.
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> index c1e262b..37e2f08 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> @@ -519,9 +519,11 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
>         /*
>          * MCJIT works on Windows, but currently only through ELF object format.
>          */
> -       std::string targetTriple = llvm::sys::getProcessTriple();
> -       targetTriple.append("-elf");
> -       unwrap(M)->setTargetTriple(targetTriple);
> +#  ifdef _WIN64
> +       LLVMSetTarget(M, "x86_64-pc-win32-elf");
> +#  else
> +       LLVMSetTarget(M, "i686-pc-win32-elf");
> +#  endif

I've noticed that you're using LLVM_HOST_TRIPLE in patch 7/9. Wouldn't
it be better to use it here as well ?

+       LLVMSetTarget(M, LLVM_HOST_TRIPLE "-elf");

That aside I'm really glad to see mesa (modulo swr) no longer using
the unstable LLVM C++ API. Perhaps at some point we could port these
to normal C and make gallivm 'C++ free'  ;-)

-Emil


More information about the mesa-dev mailing list