[llvm] r199835 - Eliminate inappropriate use of FindProgramByName() from lli

Alp Toker alp at nuanti.com
Wed Jan 22 13:52:35 PST 2014


Author: alp
Date: Wed Jan 22 15:52:35 2014
New Revision: 199835

URL: http://llvm.org/viewvc/llvm-project?rev=199835&view=rev
Log:
Eliminate inappropriate use of FindProgramByName() from lli

Modified:
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/cross-module-a.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/cross-module-sm-pic-a.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/multi-module-a.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/multi-module-sm-pic-a.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/simpletest-remote.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-remote.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-common-symbols-remote.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-data-align-remote.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-fp-no-external-funcs-remote.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-remote.ll
    llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-remote.ll
    llvm/trunk/test/Makefile
    llvm/trunk/test/lit.cfg
    llvm/trunk/test/lit.site.cfg.in
    llvm/trunk/tools/lli/lli.cpp

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/cross-module-a.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/cross-module-a.ll?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/cross-module-a.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/cross-module-a.ll Wed Jan 22 15:52:35 2014
@@ -1,4 +1,4 @@
-; RUN: %lli_mcjit -extra-module=%p/Inputs/cross-module-b.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
+; RUN: %lli_mcjit -extra-module=%p/Inputs/cross-module-b.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
 
 declare i32 @FB()
 

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/cross-module-sm-pic-a.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/cross-module-sm-pic-a.ll?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/cross-module-sm-pic-a.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/cross-module-sm-pic-a.ll Wed Jan 22 15:52:35 2014
@@ -1,4 +1,4 @@
-; RUN: %lli_mcjit -extra-module=%p/Inputs/cross-module-b.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target -relocation-model=pic -code-model=small %s > /dev/null
+; RUN: %lli_mcjit -extra-module=%p/Inputs/cross-module-b.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext -relocation-model=pic -code-model=small %s > /dev/null
 ; XFAIL: mips, i686, i386, arm
 
 declare i32 @FB()

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/multi-module-a.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/multi-module-a.ll?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/multi-module-a.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/multi-module-a.ll Wed Jan 22 15:52:35 2014
@@ -1,4 +1,4 @@
-; RUN: %lli_mcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
+; RUN: %lli_mcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
 
 declare i32 @FB()
 

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/multi-module-sm-pic-a.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/multi-module-sm-pic-a.ll?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/multi-module-sm-pic-a.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/multi-module-sm-pic-a.ll Wed Jan 22 15:52:35 2014
@@ -1,4 +1,4 @@
-; RUN: %lli_mcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target -relocation-model=pic -code-model=small %s > /dev/null
+; RUN: %lli_mcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext -relocation-model=pic -code-model=small %s > /dev/null
 ; XFAIL: mips, i686, i386, arm
 
 declare i32 @FB()

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/simpletest-remote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/simpletest-remote.ll?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/simpletest-remote.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/simpletest-remote.ll Wed Jan 22 15:52:35 2014
@@ -1,4 +1,4 @@
-; RUN: %lli_mcjit -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
+; RUN: %lli_mcjit -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
 
 define i32 @bar() {
 	ret i32 0

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-remote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-remote.ll?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-remote.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/stubs-remote.ll Wed Jan 22 15:52:35 2014
@@ -1,4 +1,4 @@
-; RUN: %lli_mcjit -remote-mcjit -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target %s
+; RUN: %lli_mcjit -remote-mcjit -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target%exeext %s
 ; XFAIL: *
 ; This test should fail until remote symbol resolution is supported.
 

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-common-symbols-remote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-common-symbols-remote.ll?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-common-symbols-remote.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-common-symbols-remote.ll Wed Jan 22 15:52:35 2014
@@ -1,4 +1,4 @@
-; RUN: %lli_mcjit -remote-mcjit -O0 -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target %s
+; RUN: %lli_mcjit -remote-mcjit -O0 -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target%exeext %s
 
 ; The intention of this test is to verify that symbols mapped to COMMON in ELF
 ; work as expected.

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-data-align-remote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-data-align-remote.ll?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-data-align-remote.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-data-align-remote.ll Wed Jan 22 15:52:35 2014
@@ -1,4 +1,4 @@
-; RUN:  %lli_mcjit -remote-mcjit -O0 -mcjit-remote-process=lli-child-target %s
+; RUN:  %lli_mcjit -remote-mcjit -O0 -mcjit-remote-process=lli-child-target%exeext %s
 
 ; Check that a variable is always aligned as specified.
 

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-fp-no-external-funcs-remote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-fp-no-external-funcs-remote.ll?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-fp-no-external-funcs-remote.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-fp-no-external-funcs-remote.ll Wed Jan 22 15:52:35 2014
@@ -1,4 +1,4 @@
-; RUN: %lli_mcjit -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
+; RUN: %lli_mcjit -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
 
 define double @test(double* %DP, double %Arg) {
 	%D = load double* %DP		; <double> [#uses=1]

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-remote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-remote.ll?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-remote.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-global-init-nonzero-remote.ll Wed Jan 22 15:52:35 2014
@@ -1,4 +1,4 @@
-; RUN: %lli_mcjit -remote-mcjit -mcjit-remote-process=lli-child-target %s > /dev/null
+; RUN: %lli_mcjit -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
 
 @count = global i32 1, align 4
 

Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-remote.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-remote.ll?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-remote.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-remote.ll Wed Jan 22 15:52:35 2014
@@ -1,4 +1,4 @@
-; RUN: %lli_mcjit -remote-mcjit -O0 -mcjit-remote-process=lli-child-target %s
+; RUN: %lli_mcjit -remote-mcjit -O0 -mcjit-remote-process=lli-child-target%exeext %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

Modified: llvm/trunk/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/Makefile (original)
+++ llvm/trunk/test/Makefile Wed Jan 22 15:52:35 2014
@@ -125,6 +125,7 @@ lit.site.cfg: FORCE
 	@$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp
 	@$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> lit.tmp
 	@$(ECHOPATH) s=@SHLIBEXT@=$(SHLIBEXT)=g >> lit.tmp
+	@$(ECHOPATH) s=@EXEEXT@=$(EXEEXT)=g >> lit.tmp
 	@$(ECHOPATH) s=@PYTHON_EXECUTABLE@=$(PYTHON)=g >> lit.tmp
 	@$(ECHOPATH) s=@OCAMLOPT@=$(OCAMLOPT) -cc $(subst *,'\\\"',*$(subst =,"\\=",$(CXX_FOR_OCAMLOPT))*) -cclib -L$(LibDir) -I $(LibDir)/ocaml=g >> lit.tmp
 	@$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> lit.tmp

Modified: llvm/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.cfg?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/lit.cfg (original)
+++ llvm/trunk/test/lit.cfg Wed Jan 22 15:52:35 2014
@@ -188,6 +188,7 @@ else:
 config.substitutions.append( ('%ocamlopt', config.ocamlopt_executable) )
 config.substitutions.append( ('%llvmshlibdir', config.llvm_shlib_dir) )
 config.substitutions.append( ('%shlibext', config.llvm_shlib_ext) )
+config.substitutions.append( ('%exeext', config.llvm_exe_ext) )
 
 # For each occurrence of an llvm tool name as its own word, replace it
 # with the full path to the build directory holding that tool.  This

Modified: llvm/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.site.cfg.in?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/test/lit.site.cfg.in (original)
+++ llvm/trunk/test/lit.site.cfg.in Wed Jan 22 15:52:35 2014
@@ -9,6 +9,7 @@ config.llvm_obj_root = "@LLVM_BINARY_DIR
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
 config.llvm_shlib_dir = "@SHLIBDIR@"
 config.llvm_shlib_ext = "@SHLIBEXT@"
+config.llvm_exe_ext = "@EXEEXT@"
 config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
 config.python_executable = "@PYTHON_EXECUTABLE@"
 config.ocamlopt_executable = "@OCAMLOPT@"

Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=199835&r1=199834&r2=199835&view=diff
==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Wed Jan 22 15:52:35 2014
@@ -94,12 +94,11 @@ namespace {
   // execution. The child process will be executed and will communicate with
   // lli via stdin/stdout pipes.
   cl::opt<std::string>
-  MCJITRemoteProcess("mcjit-remote-process",
-            cl::desc("Specify the filename of the process to launch "
-                     "for remote MCJIT execution.  If none is specified,"
-                     "\n\tremote execution will be simulated in-process."),
-            cl::value_desc("filename"),
-            cl::init(""));
+  ChildExecPath("mcjit-remote-process",
+                cl::desc("Specify the filename of the process to launch "
+                         "for remote MCJIT execution.  If none is specified,"
+                         "\n\tremote execution will be simulated in-process."),
+                cl::value_desc("filename"), cl::init(""));
 
   // Determine optimization level.
   cl::opt<char>
@@ -663,18 +662,17 @@ int main(int argc, char **argv, char * c
     // and send it to the target.
 
     OwningPtr<RemoteTarget> Target;
-    if (!MCJITRemoteProcess.empty()) { // Remote execution on a child process
+    if (!ChildExecPath.empty()) { // Remote execution on a child process
       if (!RemoteTarget::hostSupportsExternalRemoteTarget()) {
         errs() << "Warning: host does not support external remote targets.\n"
                << "  Defaulting to simulated remote execution\n";
         Target.reset(RemoteTarget::createRemoteTarget());
       } else {
-        std::string ChildEXE = sys::FindProgramByName(MCJITRemoteProcess);
-        if (ChildEXE == "") {
-          errs() << "Unable to find child target: '\''" << MCJITRemoteProcess << "\'\n";
+        if (!sys::fs::exists(ChildExecPath)) {
+          errs() << "Unable to find child target: '" << ChildExecPath << "'\n";
           return -1;
         }
-        Target.reset(RemoteTarget::createExternalRemoteTarget(ChildEXE));
+        Target.reset(RemoteTarget::createExternalRemoteTarget(ChildExecPath));
       }
     } else {
       // No child process name provided, use simulated remote execution.





More information about the llvm-commits mailing list