]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/commitdiff
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)
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

index 5cb3c58673fe86643701a900bcfc711c240824b9..10a524fb4683a9df9ae05c5496f0c2920ca6eb79 100644 (file)
@@ -134,6 +134,9 @@ BUILD_CXX=@BUILD_CXX@
 # Triple for configuring build tools when cross-compiling
 BUILD_TRIPLE=@build@
 
+# Target triple (cpu-vendor-os) which LLVM is compiled for
+HOST_TRIPLE=@host@
+
 # Target triple (cpu-vendor-os) for which we should generate code
 TARGET_TRIPLE=@target@
 
index 139aab20a338c37eddc90cf1ba637a416e5ed1c4..3a4440573910948d5824cb089d25050ee27072b0 100644 (file)
@@ -42,6 +42,10 @@ namespace sys {
   ///   CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM
   std::string getDefaultTargetTriple();
 
+  /// getProcessTriple() - Return an appropriate target triple for generating
+  /// code to be loaded into the current process, e.g. when using the JIT.
+  std::string getProcessTriple();
+
   /// getHostCPUName - Get the LLVM name for the host CPU. The particular format
   /// of the name is target dependent, and suitable for passing as -mcpu to the
   /// target which matches the host.
index 3c4da75dba0ec49400de3f0bd22d164c0e21913b..ca4330fa22b0443296c586334f36a1c729b2948c 100644 (file)
@@ -32,18 +32,7 @@ TargetMachine *EngineBuilder::selectTarget() {
   // must use the host architecture.
   if (UseMCJIT && WhichEngine != EngineKind::Interpreter && M)
     TT.setTriple(M->getTargetTriple());
-  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);
 }
 
@@ -55,7 +44,7 @@ TargetMachine *EngineBuilder::selectTarget(const Triple &TargetTriple,
                               const SmallVectorImpl<std::string>& MAttrs) {
   Triple TheTriple(TargetTriple);
   if (TheTriple.getTriple().empty())
-    TheTriple.setTriple(sys::getDefaultTargetTriple());
+    TheTriple.setTriple(sys::getProcessTriple());
 
   // Adjust the triple to match what the user requested.
   const Target *TheTarget = 0;
index 5ad5308c41e4a5f4f28f1d73ec69ba6c253761fb..afbf0bf07fcf9aa9c470184819f0fb70125b6c85 100644 (file)
@@ -15,6 +15,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/Triple.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/DataStream.h"
 #include "llvm/Support/Debug.h"
@@ -578,3 +579,14 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features){
   return false;
 }
 #endif
+
+std::string sys::getProcessTriple() {
+  Triple PT(LLVM_HOSTTRIPLE);
+
+  if (sizeof(void *) == 8 && PT.isArch32Bit())
+    PT = PT.get64BitArchVariant();
+  if (sizeof(void *) == 4 && PT.isArch64Bit())
+    PT = PT.get32BitArchVariant();
+
+  return PT.str();
+}
index 28cc54a868061e8af2b7b81aa11be5b2984477df..babd8f6a78031a33cab8cabbbe56e9968f04b139 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 @.LC0 = internal global [10 x i8] c"argc: %d\0A\00"            ; <[10 x i8]*> [#uses=1]
 
index 9f895983fdb16d9f0121f0761c0a05bc3926fc36..bbb81b88b16a79820f72935ab987ee9c8e4a8bd7 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @foo(i32 %X, i32 %Y, double %A) {
        %cond212 = fcmp une double %A, 1.000000e+00             ; <i1> [#uses=1]
index 997b2a9037ee312bfcd2d34f23ab0a2649457e27..7574267bdcdceb4ecebc1ea3cdd39364b4846caf 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @main() {
        call i32 @mylog( i32 4 )                ; <i32>:1 [#uses=0]
index ba35b5bcc436e54167817d860832d0b63a133c2c..261939ad2028b1054d8e5e02c49322bf42e879de 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @main() {
 ; <label>:0
index f3c88adf84355da9724e73c20f92e7ffb4ca9c43..f76f998328254da11855f7806aa829a14695355a 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 ; We were accidentally inverting the signedness of right shifts.  Whoops.
 
index f925e79f24849b2952defa3ccff6bfbd49bab336..2b83bb9e43e8133029e4fbf852d41880bbd97db3 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @main() {
        %X = fadd double 0.000000e+00, 1.000000e+00             ; <double> [#uses=1]
index 5b426f6c330b5a17620db7ae7b62695d18264676..d1ca2bee39944728d1329ed4bcdd209713e07999 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @bar(i8* %X) {
         ; pointer should be 4 byte aligned!
index c0a7393f8244f8dcf299934f0631fa9ae9c06554..20ef0ff95cdd18928596b1dcb106e0ad8cf59cba 100644 (file)
@@ -1,6 +1,6 @@
 ; This testcase should return with an exit code of 1.
 ;
-; RUN: not %lli -mtriple=%mcjit_triple -use-mcjit %s
+; RUN: not %lli_mcjit %s
 
 @test = global i64 0           ; <i64*> [#uses=1]
 
index d3e6204a85be1a708982fb3d55d47c61acaae99a..c7bcc5450b09b4214490dcbef321d79bd9ffc3ea 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s test
+; RUN: %lli_mcjit %s test
 
 declare i32 @puts(i8*)
 
index 55a169754104444edea6dade71f84819f8d18248..0512575d1b4e140eb11fe469874da9f610d135ce 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 target datalayout = "e-p:32:32"
 
index 79c6e7fe4caee850b41a92b60c329f3e9b53a932..c292a818a09185cde6533c588334139247f5145a 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 ; Testcase distilled from 256.bzip2.
 
index ffd6df6e5e2544be599d0fbe891e656445449208..c0a83f5ecbdba0a2ca4c8e8e9c38c837feef88ee 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 ; Testcase distilled from 256.bzip2.
 
index 90839e96986ff559c265025f4e73d158f7623991..55ce689b865b00a4a4268a21fa90e3deeeb3f92a 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 ; This testcase failed to work because two variable sized allocas confused the
 ; local register allocator.
index 29ef2c556cd01e6d6c4224552cf386036d95def4..2e999967a2c588c6c10a6c55ee6ead58f01c4544 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 ;
 ; Regression Test: EnvironmentTest.ll
index 2adb608acbb186a659611b247f3c6d24676e203b..659901b9b36f749a39f07d66ac9209babe6f7a9d 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 ; This testcase exposes a bug in the local register allocator where it runs out
 ; of registers (due to too many overlapping live ranges), but then attempts to
index 91bde46903614a29d63fb5a214858e47d5b6fe60..68e31a7074dd5c4de15ab6093055a1286562e531 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 @A = global i32 0              ; <i32*> [#uses=1]
 
index a7462d9e698a7e0f208be3edf6eb5d6fa0b8f43e..0bc010584f1e436866dda84c1a083ac4a5c9344e 100644 (file)
@@ -1,5 +1,5 @@
 ; PR672
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s
+; RUN: %lli_mcjit %s
 ; XFAIL: mcjit-ia32
 
 define i32 @main() {
index 2406596602522fa841d2741d35be3c099e52c31b..43188f2be481e78cedc07da0f469253b97b06a0a 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -force-interpreter %s
+; RUN: %lli_mcjit -force-interpreter %s
 ; PR1836
 
 define i32 @main() {
index d429d519e04f08157bd752e782f750ef4f0eb01b..0912897c05fab3cd99e733f3db391480985fc486 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -force-interpreter=true %s | grep 1
+; RUN: %lli_mcjit -force-interpreter=true %s | grep 1
 
 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
 target triple = "i686-pc-linux-gnu"
index a6d18e7919ccb7e7646a85ebd88b33b01706fc6f..7ed0e3870a3bc6f72041dfbede2b19cd7981f1b3 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -force-interpreter=true %s > /dev/null
+; RUN: %lli_mcjit -force-interpreter=true %s > /dev/null
 
 define i32 @main() {
        %a = add i32 0, undef
index bb4957e9e66edf3568711e4f66a94ffa80ff9d63..fb5ab6f24215be532a0abf676d58436c5377e625 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -force-interpreter=true %s | grep 40091eb8
+; RUN: %lli_mcjit -force-interpreter=true %s | grep 40091eb8
 ;
 define i32 @test(double %x) {
 entry:
index ceb9c12ab4bd80fb058ad84f9383d2ad83801839..b74470724debab812e0b0347e65e8587fccd0165 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 @.LC0 = internal global [12 x i8] c"Hello World\00"            ; <[12 x i8]*> [#uses=1]
 
index 756fcadb1cafaf149358f3af1c5b98c825cdb3ec..cd033d50947af7f1904d351c9aa91e2609aae608 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 @X = global i32 7              ; <i32*> [#uses=0]
 @msg = internal global [13 x i8] c"Hello World\0A\00"          ; <[13 x i8]*> [#uses=1]
index c33bf328108723c358c02159bf9ba1247fba0e7a..1c719c5b7c27ca9975972c980b9202dae9ab71fc 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -O0 -disable-lazy-compilation=false %s
+; RUN: %lli_mcjit -O0 -disable-lazy-compilation=false %s
 
 ; The intention of this test is to verify that symbols mapped to COMMON in ELF
 ; work as expected.
index 02ad0061fd13f2c9297ce2e441833309a8a85617..318baf4e8ffda60b6c1ec9d54c3edf92bed917a3 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @main() {
        ret i32 0
index 272204c63c64cee122ed021159e64548db02ff9e..9ceaf545c5e603ed235a7e35c3461c6ab38dd772 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit %s > /dev/null
+; RUN: %lli_mcjit -remote-mcjit %s > /dev/null
 ; XFAIL: arm, mips
 
 define i32 @bar() {
index 958b783067e48fcf1b744fd8e3452da112bfb89a..5b0f2dd3055e55c2b95e0395e6308657e3724130 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @bar() {
        ret i32 0
index 4c7684fd20e34408d32b4604fa3955c420682400..15cb5d037efc6a55956fa95e8ec713621d8e4215 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit -disable-lazy-compilation=false %s
+; RUN: %lli_mcjit -remote-mcjit -disable-lazy-compilation=false %s
 ; XFAIL: arm, mips
 
 define i32 @main() nounwind {
index 9e5d5b2e4186a28f71e40f9a174b4ec62d3936b0..f4aac3339450ff2f6b4d054a020877fb5a8ef206 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -disable-lazy-compilation=false %s
+; RUN: %lli_mcjit -disable-lazy-compilation=false %s
 
 define i32 @main() nounwind {
 entry:
index b73227fe635eafa61b1593029693b737bd16605b..e1cc23b9fcd3aed399e4b34b0f14ced9f0a1b78b 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @main() {
        %A = add i8 0, 12               ; <i8> [#uses=1]
index 8f3c7279051eeb2d583fbc1981ad85022d4b26b7..cdf10350ec11781c8e89766415365eb36d52be35 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 ; test unconditional branch
 define i32 @main() {
index 20150b2de626cbee7e2cd3b86e082970efc05287..8a36cf2953f72027c90e0b5c6f2070716fbb7325 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @_Z14func_exit_codev() nounwind uwtable {
 entry:
index 51d19fe991787a9928dcd05232c843f1e6e9a200..1a0f008416852f6f51bcbbced677856f429e0765 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 declare void @exit(i32)
 
index dcc97f466568ce04b7ad730092d9d6c3db41038d..335ec508eff14a46be98ef2908e6c94f2550373d 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @foo() {
        ret i32 0
index d666a2aa4aa3551d67791101f08906bb3fa1b781..989a473423395c40e0574eab27698a6f3dd0ff11 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -O0 %s
+; RUN: %lli_mcjit -O0 %s
 
 ; This test checks that common symbols have been allocated addresses honouring
 ; the alignment requirement.
index 285ce5cea14a0597ad3a81c5745e0735ff36e845..3b8ee9dd1cce023f73e093145903770b20f0a1d6 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit -O0 -disable-lazy-compilation=false %s
+; RUN: %lli_mcjit -remote-mcjit -O0 -disable-lazy-compilation=false %s
 ; XFAIL: arm, mips
 
 ; The intention of this test is to verify that symbols mapped to COMMON in ELF
index 8c8190291f18fc923ed00f9d811055bccf17cb3c..13ee06a650716d2a85eaac7123bd008e3ccfb474 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -O0 -disable-lazy-compilation=false %s
+; RUN: %lli_mcjit -O0 -disable-lazy-compilation=false %s
 
 ; The intention of this test is to verify that symbols mapped to COMMON in ELF
 ; work as expected.
index 56c1290448adeac26528a2fad281f18cb2f2ae25..8f15cbd7f7ef3c3b1e1d7b80931e3460be09b95f 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 ; This tests to make sure that we can evaluate weird constant expressions
 
index a1591d0fc4f1c11a257a1c8eae099a58d13476fa..5e0bb4076b390043cc471b2294388bcd7276f8f2 100644 (file)
@@ -1,4 +1,4 @@
-; RUN:  %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit -O0 %s
+; RUN:  %lli_mcjit -remote-mcjit -O0 %s
 ; XFAIL: arm, mips
 
 ; Check that a variable is always aligned as specified.
index 0493cba87fdbe418114fa64c84d2ae82afdbdb9d..2472d95e777801ea47fec9f1ba3c2615b0f27a31 100644 (file)
@@ -1,4 +1,4 @@
-; RUN:  %lli -mtriple=%mcjit_triple -use-mcjit -O0 %s
+; RUN:  %lli_mcjit -O0 %s
 
 ; Check that a variable is always aligned as specified.
 
index 69c73b99c91cb7ece29b4dc60adb479eba1218c0..847d2253a0edbf3cd31a899784134f534fce632c 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit %s > /dev/null
+; RUN: %lli_mcjit -remote-mcjit %s > /dev/null
 ; XFAIL: arm, mips
 
 define double @test(double* %DP, double %Arg) {
index 7af1d8b53910701462804608b0aa40382ffb3280..f094f3d91923c561b9216b93fe14e765df7b2818 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define double @test(double* %DP, double %Arg) {
        %D = load double* %DP           ; <double> [#uses=1]
index f7e6fb9ba18e2f6647b9f0e4e29c15f7b2074993..b10e9d6c169d0a9f482ef93cd0347bd992e4daaa 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define double @test(double* %DP, double %Arg) {
        %D = load double* %DP           ; <double> [#uses=1]
index fbe9118d5365d233c40566c60a0c0e48290209d9..4510d9b6a4955cc12df63a749d5e89d7b1c34fef 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 @var = global i32 1, align 4
 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @ctor_func }]
 @llvm.global_dtors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @dtor_func }]
index 8b7c83e018b4d706a10650447f07d052c441cc9b..b8d94b50cfe2821c5245d18b1696fc0efcc62de2 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit %s > /dev/null
+; RUN: %lli_mcjit -remote-mcjit %s > /dev/null
 ; XFAIL: arm, mips
 
 @count = global i32 1, align 4
index ec6cbad2f14ec6e24ebd65b7848ea6f3b57706d9..b9f74b8be403a855b144175f999b1dcb4fb721df 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 @count = global i32 1, align 4
 
index e7972f978e95c552ba24ca33a3aeb4edacd6cb99..6a8c042ef89e9f4a09b66a600758e7660275e066 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 @count = global i32 0, align 4
 
index f450d0ab528b1af1820a755728d5eb31c6857a4e..90381947e8fb250d6f95c400d463a27544928e78 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define void @test(i8* %P, i16* %P.upgrd.1, i32* %P.upgrd.2, i64* %P.upgrd.3) {
        %V = load i8* %P                ; <i8> [#uses=1]
index d4e9f444e426948c3de81a0c5c454856d05770b8..d7c17342797772ddd96d6f4ec3b1fd6d168ac18a 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @main() nounwind uwtable {
 entry:
index 32f45ef119e6d78e485b98f442a459906489c9db..a03833e5c5162311e9323dfefb39cad7ade72c43 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @main() {
        %A = and i8 4, 8                ; <i8> [#uses=2]
index ebc689664d6554652e8f3a963b63300d8e5747bd..5ed8c4020f7662162dc6d6aa886f0a0a8b38f709 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @main() {
 ; <label>:0
index 1408533d7ae9061e1576788375476c9e9f832b75..4245ccabed784a391fac90716dd6b7814f78f883 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 ; test phi node
 @Y = global i32 6              ; <i32*> [#uses=1]
index 773e4a195f28b29d602cc1d57ab8e44f727731be..f2c2cd6199f7745d7dcf53ef7319cc6b3261ee26 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -remote-mcjit -O0 %s
+; RUN: %lli_mcjit -remote-mcjit -O0 %s
 ; XFAIL: arm, mips
 
 @.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1
index 93b6a6deffd1145a7851e810f222093633290656..871d8bfa29e8c700e6b4ed1ff0e641bdbd8d3085 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit -O0 %s
+; RUN: %lli_mcjit -O0 %s
 
 @.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1
 @ptr = global i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), align 4
index af282926907fb3b706d63381e8546a897d28d076..6bfc48052d02f7a262dd62b062a448adf4a7ee9b 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 ; test return instructions
 define void @test1() {
index 67f7107c3d7dd551eba3e3d382f4e6473d0134c3..4db1c3fe39f0cbb493f56bf4c0c5ba4e4a58023e 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @main() nounwind uwtable {
 entry:
index a8f4bd8529f8bb9aee06e741a457dca41d4e57b0..b4367d0337a0e75441ed1d89013a11e660c8e686 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 
 define i32 @main() {
index ed52b5065c84429270d4939e1a54eadbc3e4cc24..8c7d815446cb91737af1c4efba137308a4f63990 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @main() {
        %int1 = add i32 0, 0            ; <i32> [#uses=6]
index 5a5c10d560506b2283d2ecb7f5b809fd53731c57..8d9a94ef12c86da4a50b6279263526cccbb400b1 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: %lli -mtriple=%mcjit_triple -use-mcjit %s > /dev/null
+; RUN: %lli_mcjit %s > /dev/null
 
 define i32 @main() {
        %shamt = add i8 0, 1            ; <i8> [#uses=8]
index 4e690cc325e95674039a4f59d526f1ff4daf0f63..f6ed44da7924e8ff4d8e0ef470287a3d1dc4227a 100644 (file)
@@ -131,7 +131,8 @@ endif
 
 lit.site.cfg: FORCE
        @echo "Making LLVM 'lit.site.cfg' file..."
-       @$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g > lit.tmp
+       @$(ECHOPATH) s=@LLVM_HOSTTRIPLE@=$(HOST_TRIPLE)=g > lit.tmp
+       @$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp
        @$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g >> lit.tmp
        @$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp
        @$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp
index 5a4cceda0e166aa6b08720537fb9c03367deec7f..128bbe927a3fe8dde4fcc2a1778383610888ff3f 100644 (file)
@@ -140,12 +140,16 @@ if config.test_exec_root is None:
 
 ###
 
-# Provide a target triple for mcjit tests
-mcjit_triple = config.target_triple
-# Force ELF format on Windows
-if re.search(r'cygwin|mingw32|win32', mcjit_triple):
-  mcjit_triple += "-elf"
-config.substitutions.append( ('%mcjit_triple', mcjit_triple) )
+# Provide a command line for mcjit tests
+lli_mcjit = 'lli -use-mcjit'
+# The target triple used by default by lli is the process target triple (some
+# triple appropriate for generating code for the current process) but because
+# we don't support COFF in MCJIT well enough for the tests, force ELF format on
+# Windows.  FIXME: the process target triple should be used here, but this is
+# difficult to obtain on Windows.
+if re.search(r'cygwin|mingw32|win32', config.host_triple):
+  lli_mcjit += ' -mtriple='+config.host_triple+'-elf'
+config.substitutions.append( ('%lli_mcjit', lli_mcjit) )
 
 # Provide a substition for those tests that need to run the jit to obtain data
 # but simply want use the currently considered most reliable jit for platform
index 7a328f0f28e9b13c02f0e19480105a9b68fc1688..bfd901a0797b0b96c477120dd2bd98b0d35ccaf4 100644 (file)
@@ -1,5 +1,6 @@
 ## Autogenerated by LLVM/Clang configuration.
 # Do not edit!
+config.host_triple = "@LLVM_HOSTTRIPLE@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
index 2f72e42425490d99fb49b8a75e39e68fb0b4e4a4..d6f5032d6e62acf5412b29239781167bb73db94b 100644 (file)
@@ -137,7 +137,7 @@ protected:
     // Override the triple to generate ELF on Windows since that's supported
     Triple Tuple(TheModule->getTargetTriple());
     if (Tuple.getTriple().empty())
-      Tuple.setTriple(LLVM_HOSTTRIPLE);
+      Tuple.setTriple(sys::getProcessTriple());
 
     if (Tuple.isOSWindows() && Triple::ELF != Tuple.getEnvironment()) {
       Tuple.setEnvironment(Triple::ELF);
index 4604aa54994c34dee18adc43412095f9c6d67b10..fc774abd6215f30fe6c453e2e17187e360cfcdea 100644 (file)
@@ -52,7 +52,7 @@ protected:
     , MArch("")
     , Builder(Context)
     , MM(new SectionMemoryManager)
-    , HostTriple(LLVM_HOSTTRIPLE)
+    , HostTriple(sys::getProcessTriple())
   {
     InitializeNativeTarget();
     InitializeNativeTargetAsmPrinter();