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)
commita51c6ed608dc6372bd20eccc27d09064751e82d8
tree3b2154d91124244fba6d267b9736641f5ebe2e96
parent373feca7a02a75e5ab4788ac77fd061883c23ff6
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

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