[llvm-commits] [llvm] r169405 - /llvm/trunk/lib/ExecutionEngine/TargetSelect.cpp

Jim Grosbach grosbach at apple.com
Wed Dec 5 11:17:05 PST 2012


Ugh. OK, but a better (still hacky, but better) solution would be put the #if stuff in config.h rather than here. The problem manifests in the JIT, but LLVM_HOSTTRIPLE is wrong globally.

-Jim

On Dec 5, 2012, at 11:09 AM, Bob Wilson <bob.wilson at apple.com> wrote:

> Author: bwilson
> Date: Wed Dec  5 13:09:13 2012
> New Revision: 169405
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=169405&view=rev
> Log:
> Adjust JIT target triple on OS X to match the current architecture.
> 
> For OS X builds, we generate one version of config.h but then build for
> multiple architectures.  This means that the LLVM_HOSTTRIPLE setting may have
> the wrong architecture.  Adjust it dynamically to match the current
> architecture.  <rdar://problem/12715470>
> 
> Modified:
>    llvm/trunk/lib/ExecutionEngine/TargetSelect.cpp
> 
> Modified: llvm/trunk/lib/ExecutionEngine/TargetSelect.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/TargetSelect.cpp?rev=169405&r1=169404&r2=169405&view=diff
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/TargetSelect.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/TargetSelect.cpp Wed Dec  5 13:09:13 2012
> @@ -32,8 +32,18 @@
>   // must use the host architecture.
>   if (UseMCJIT && WhichEngine != EngineKind::Interpreter && M)
>     TT.setTriple(M->getTargetTriple());
> -  else
> +  else {
>     TT.setTriple(LLVM_HOSTTRIPLE);
> +#if defined(__APPLE__)
> +#if defined(__LP64__)
> +    if (TT.isArch32Bit())
> +      TT = TT.get64BitArchVariant();
> +#else
> +    if (TT.isArch64Bit())
> +      TT = TT.get32BitArchVariant();
> +#endif
> +#endif // APPLE
> +  }
>   return selectTarget(TT, MArch, MCPU, MAttrs);
> }
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list