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

Peter Collingbourne peter at pcc.me.uk
Fri Dec 28 20:41:26 PST 2012


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 host architecture, leading to illegal instruction and other such
errors at run time.

Reintroduce the getHostTriple() function for use in the JIT and its
clients, and cause the JIT to use it.  At the same time, fix JIT
for the 32-on-64-bit (and vice versa) build on non-Apple platforms
by causing getHostTriple() to change the architecture variant if
necessary.

In this email thread:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120102/134416.html
an objection was raised against a similar patch on the grounds
that the JIT could deliberately be used to compile binaries for a
different architecture.  However, the normal usage scenario for the
JIT is that the code is being compiled and run on the same machine,
and if the client is doing anything out of the ordinary it should
know the target architecture (which would not necessarily match the
default target architecture) and set up the target triple itself.

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

Files:
  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/lit.cfg
  tools/llvm-jitlistener/llvm-jitlistener.cpp
  unittests/ExecutionEngine/MCJIT/MCJITTestBase.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D254.1.patch
Type: text/x-patch
Size: 29205 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121228/a050b673/attachment.bin>


More information about the llvm-commits mailing list