[llvm] r285413 - [lli] Pass command line arguments in to the orc-lazy JIT.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 28 09:52:34 PDT 2016
Author: lhames
Date: Fri Oct 28 11:52:34 2016
New Revision: 285413
URL: http://llvm.org/viewvc/llvm-project?rev=285413&view=rev
Log:
[lli] Pass command line arguments in to the orc-lazy JIT.
This brings the LLI orc-lazy JIT's behavior more closely in-line with LLI's
mcjit bahavior.
Modified:
llvm/trunk/tools/lli/OrcLazyJIT.cpp
llvm/trunk/tools/lli/OrcLazyJIT.h
llvm/trunk/tools/lli/lli.cpp
Modified: llvm/trunk/tools/lli/OrcLazyJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/OrcLazyJIT.cpp?rev=285413&r1=285412&r2=285413&view=diff
==============================================================================
--- llvm/trunk/tools/lli/OrcLazyJIT.cpp (original)
+++ llvm/trunk/tools/lli/OrcLazyJIT.cpp Fri Oct 28 11:52:34 2016
@@ -104,8 +104,8 @@ static PtrTy fromTargetAddress(JITTarget
return reinterpret_cast<PtrTy>(static_cast<uintptr_t>(Addr));
}
-int llvm::runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms, int ArgC,
- char* ArgV[]) {
+int llvm::runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms,
+ const std::vector<std::string> &Args) {
// Add the program's symbols into the JIT's search space.
if (sys::DynamicLibrary::LoadLibraryPermanently(nullptr)) {
errs() << "Error loading program symbols.\n";
@@ -152,7 +152,10 @@ int llvm::runOrcLazyJIT(std::vector<std:
}
typedef int (*MainFnPtr)(int, char*[]);
+ std::vector<const char *> ArgV;
+ for (auto &Arg : Args)
+ ArgV.push_back(Arg.c_str());
auto Main = fromTargetAddress<MainFnPtr>(MainSym.getAddress());
- return Main(ArgC, ArgV);
+ return Main(ArgV.size(), (char**)ArgV.data());
}
Modified: llvm/trunk/tools/lli/OrcLazyJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/OrcLazyJIT.h?rev=285413&r1=285412&r2=285413&view=diff
==============================================================================
--- llvm/trunk/tools/lli/OrcLazyJIT.h (original)
+++ llvm/trunk/tools/lli/OrcLazyJIT.h Fri Oct 28 11:52:34 2016
@@ -167,8 +167,8 @@ private:
std::vector<orc::CtorDtorRunner<CODLayerT>> IRStaticDestructorRunners;
};
-int runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms, int ArgC,
- char* ArgV[]);
+int runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms,
+ const std::vector<std::string> &Args);
} // end namespace llvm
Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=285413&r1=285412&r2=285413&view=diff
==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Fri Oct 28 11:52:34 2016
@@ -403,7 +403,11 @@ int main(int argc, char **argv, char * c
return 1;
}
}
- return runOrcLazyJIT(std::move(Ms), argc, argv);
+ std::vector<std::string> Args;
+ Args.push_back(InputFile);
+ for (auto &Arg : InputArgv)
+ Args.push_back(Arg);
+ return runOrcLazyJIT(std::move(Ms), Args);
}
if (EnableCacheManager) {
More information about the llvm-commits
mailing list