[llvm-commits] [PATCH] Re-introduce llvm::sys::getHostTriple() function.

Peter Collingbourne peter at pcc.me.uk
Fri Jan 4 11:48:42 PST 2013


On Sun, Dec 30, 2012 at 05:47:36PM -0800, Joerg Sonnenberger wrote:
> 
>   The problem I have with this is that there are three pretty much unrelated concepts:
> 
>   (1) The default target of the compiler
>   (2) The platform LLVM was built in
>   (3) The platform LLVM is running on
> 
>   The current answer is the (1) and (3) are identical unless the user explicitly specifies something else. This is important if you consider building and running on a bi-size platform like X86. What is the correct and/or preferable choice -- 64bit or 32bit code? Solaris for example still has a mostly 32bit user land as the majority of programs don't get any benefits (but certain penalties) when compiled as 64bit code. So far I haven't seen a good argument that making (1) and (3) separate switches/choices is useful. At the very least, the name "getHostTriple" doesn't reflect it either, since i386 might very well be a saner default for JIT on x86.

Consider the case where LLVM is configured to act as a cross compiler
by default (using --target=).  This configuration would break the
JIT if we assume (1) and (3) are always the same, unless the client
sets the host triple correctly.  But this then pushes the problem of
figuring out the correct host triple to the client, while it could
be done in a standard way inside LLVM.

I don't think i386 is a sensible default for JIT on x86, at least
because the ABIs for 32- and 64-bit x86 are different.  The triple
has to match whichever ABI is currently being used by whatever is
going to call JITed code (which will be the host ABI 99% of the time).

Thanks,
-- 
Peter



More information about the llvm-commits mailing list