Introduce llvm::sys::getProcessTriple() function.
authorPeter Collingbourne <peter@pcc.me.uk>
Wed, 16 Jan 2013 17:27:22 +0000 (17:27 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Wed, 16 Jan 2013 17:27:22 +0000 (17:27 +0000)
commitfbb662f840c2f76988ff9f3f152695632cfc71be
tree55e8542b647a6f8916a7cecd930d566b21e6a0b8
parent6a3cbc35a75468d565385a0db8e7051478f383f4
Introduce llvm::sys::getProcessTriple() function.

In r143502, we renamed getHostTriple() to getDefaultTargetTriple()
as part of work to allow the user to supply a different default
target triple at configure time.  This change also affected the JIT.
However, it is inappropriate to use the default target triple in the
JIT in most circumstances because this will not necessarily match
the current architecture used by the process, leading to illegal
instruction and other such errors at run time.

Introduce the getProcessTriple() function for use in the JIT and
its clients, and cause the JIT to use it.  On architectures with a
single bitness, the host and process triples are identical.  On other
architectures, the host triple represents the architecture of the
host CPU, while the process triple represents the architecture used
by the host CPU to interpret machine code within the current process.
For example, when executing 32-bit code on a 64-bit Linux machine,
the host triple may be 'x86_64-unknown-linux-gnu', while the process
triple may be 'i386-unknown-linux-gnu'.

This fixes JIT for the 32-on-64-bit (and vice versa) build on non-Apple
platforms.

Differential Revision: http://llvm-reviews.chandlerc.com/D254

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172627 91177308-0d34-0410-b5e6-96231b3b80d8
68 files changed:
Makefile.config.in
include/llvm/Support/Host.h
lib/ExecutionEngine/TargetSelect.cpp
lib/Support/Host.cpp
test/ExecutionEngine/MCJIT/2002-12-16-ArgTest.ll
test/ExecutionEngine/MCJIT/2003-01-04-ArgumentBug.ll
test/ExecutionEngine/MCJIT/2003-01-04-LoopTest.ll
test/ExecutionEngine/MCJIT/2003-01-04-PhiTest.ll
test/ExecutionEngine/MCJIT/2003-01-09-SARTest.ll
test/ExecutionEngine/MCJIT/2003-01-10-FUCOM.ll
test/ExecutionEngine/MCJIT/2003-01-15-AlignmentTest.ll
test/ExecutionEngine/MCJIT/2003-05-06-LivenessClobber.ll
test/ExecutionEngine/MCJIT/2003-05-07-ArgumentTest.ll
test/ExecutionEngine/MCJIT/2003-05-11-PHIRegAllocBug.ll
test/ExecutionEngine/MCJIT/2003-06-04-bzip2-bug.ll
test/ExecutionEngine/MCJIT/2003-06-05-PHIBug.ll
test/ExecutionEngine/MCJIT/2003-08-15-AllocaAssertion.ll
test/ExecutionEngine/MCJIT/2003-08-21-EnvironmentTest.ll
test/ExecutionEngine/MCJIT/2003-08-23-RegisterAllocatePhysReg.ll
test/ExecutionEngine/MCJIT/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll
test/ExecutionEngine/MCJIT/2005-12-02-TailCallBug.ll
test/ExecutionEngine/MCJIT/2007-12-10-APIntLoadStore.ll
test/ExecutionEngine/MCJIT/2008-06-05-APInt-OverAShr.ll
test/ExecutionEngine/MCJIT/2010-01-15-UndefValue.ll
test/ExecutionEngine/MCJIT/fpbitcast.ll
test/ExecutionEngine/MCJIT/hello.ll
test/ExecutionEngine/MCJIT/hello2.ll
test/ExecutionEngine/MCJIT/pr13727.ll
test/ExecutionEngine/MCJIT/simplesttest.ll
test/ExecutionEngine/MCJIT/simpletest-remote.ll
test/ExecutionEngine/MCJIT/simpletest.ll
test/ExecutionEngine/MCJIT/stubs-remote.ll
test/ExecutionEngine/MCJIT/stubs.ll
test/ExecutionEngine/MCJIT/test-arith.ll
test/ExecutionEngine/MCJIT/test-branch.ll
test/ExecutionEngine/MCJIT/test-call-no-external-funcs.ll
test/ExecutionEngine/MCJIT/test-call.ll
test/ExecutionEngine/MCJIT/test-cast.ll
test/ExecutionEngine/MCJIT/test-common-symbols-alignment.ll
test/ExecutionEngine/MCJIT/test-common-symbols-remote.ll
test/ExecutionEngine/MCJIT/test-common-symbols.ll
test/ExecutionEngine/MCJIT/test-constantexpr.ll
test/ExecutionEngine/MCJIT/test-data-align-remote.ll
test/ExecutionEngine/MCJIT/test-data-align.ll
test/ExecutionEngine/MCJIT/test-fp-no-external-funcs-remote.ll
test/ExecutionEngine/MCJIT/test-fp-no-external-funcs.ll
test/ExecutionEngine/MCJIT/test-fp.ll
test/ExecutionEngine/MCJIT/test-global-ctors.ll
test/ExecutionEngine/MCJIT/test-global-init-nonzero-remote.ll
test/ExecutionEngine/MCJIT/test-global-init-nonzero.ll
test/ExecutionEngine/MCJIT/test-global.ll
test/ExecutionEngine/MCJIT/test-loadstore.ll
test/ExecutionEngine/MCJIT/test-local.ll
test/ExecutionEngine/MCJIT/test-logical.ll
test/ExecutionEngine/MCJIT/test-loop.ll
test/ExecutionEngine/MCJIT/test-phi.ll
test/ExecutionEngine/MCJIT/test-ptr-reloc-remote.ll
test/ExecutionEngine/MCJIT/test-ptr-reloc.ll
test/ExecutionEngine/MCJIT/test-ret.ll
test/ExecutionEngine/MCJIT/test-return.ll
test/ExecutionEngine/MCJIT/test-setcond-fp.ll
test/ExecutionEngine/MCJIT/test-setcond-int.ll
test/ExecutionEngine/MCJIT/test-shift.ll
test/Makefile
test/lit.cfg
test/lit.site.cfg.in
tools/llvm-jitlistener/llvm-jitlistener.cpp
unittests/ExecutionEngine/MCJIT/MCJITTestBase.h