[llvm] r277521 - [lli] Add the ability for OrcLazyJIT to accept multiple input modules.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 10:29:20 PDT 2016


On Tue, Aug 2, 2016 at 2:08 PM Lang Hames via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: lhames
> Date: Tue Aug  2 16:00:40 2016
> New Revision: 277521
>
> URL: http://llvm.org/viewvc/llvm-project?rev=277521&view=rev
> Log:
> [lli] Add the ability for OrcLazyJIT to accept multiple input modules.
>
> LLI already supported passing multiple input modules to MCJIT via the
> -extra-module option. This patch adds the plumbing to pass these modules to
> the OrcLazy JIT too.
>
> This functionality will be used in an upcoming test case for weak symbol
> handling.
>

Does this only enable functionality for weak symbol handling?

(or does it, say, make it possible to have a simple two module unlinked
situation (one module declares and calls a function, the other module
defines that function)? That could be tested without the weak symbol
handling)


>
>
> 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=277521&r1=277520&r2=277521&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/lli/OrcLazyJIT.cpp (original)
> +++ llvm/trunk/tools/lli/OrcLazyJIT.cpp Tue Aug  2 16:00:40 2016
> @@ -105,7 +105,8 @@ static PtrTy fromTargetAddress(JITTarget
>    return reinterpret_cast<PtrTy>(static_cast<uintptr_t>(Addr));
>  }
>
> -int llvm::runOrcLazyJIT(std::unique_ptr<Module> M, int ArgC, char*
> ArgV[]) {
> +int llvm::runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms, int ArgC,
> +                        char* ArgV[]) {
>    // Add the program's symbols into the JIT's search space.
>    if (sys::DynamicLibrary::LoadLibraryPermanently(nullptr)) {
>      errs() << "Error loading program symbols.\n";
> @@ -143,8 +144,9 @@ int llvm::runOrcLazyJIT(std::unique_ptr<
>                 OrcInlineStubs);
>
>    // Add the module, look up main and run it.
> -  auto MainHandle = J.addModule(std::move(M));
> -  auto MainSym = J.findSymbolIn(MainHandle, "main");
> +  for (auto &M : Ms)
> +    J.addModule(std::move(M));
> +  auto MainSym = J.findSymbol("main");
>
>    if (!MainSym) {
>      errs() << "Could not find main function.\n";
>
> Modified: llvm/trunk/tools/lli/OrcLazyJIT.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/OrcLazyJIT.h?rev=277521&r1=277520&r2=277521&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/lli/OrcLazyJIT.h (original)
> +++ llvm/trunk/tools/lli/OrcLazyJIT.h Tue Aug  2 16:00:40 2016
> @@ -156,7 +156,8 @@ private:
>    std::vector<orc::CtorDtorRunner<CODLayerT>> IRStaticDestructorRunners;
>  };
>
> -int runOrcLazyJIT(std::unique_ptr<Module> M, int ArgC, char* ArgV[]);
> +int runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms, int ArgC,
> +                  char* ArgV[]);
>
>  } // end namespace llvm
>
>
> Modified: llvm/trunk/tools/lli/lli.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=277521&r1=277520&r2=277521&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/lli/lli.cpp (original)
> +++ llvm/trunk/tools/lli/lli.cpp Tue Aug  2 16:00:40 2016
> @@ -397,8 +397,18 @@ int main(int argc, char **argv, char * c
>      return 1;
>    }
>
> -  if (UseJITKind == JITKind::OrcLazy)
> -    return runOrcLazyJIT(std::move(Owner), argc, argv);
> +  if (UseJITKind == JITKind::OrcLazy) {
> +    std::vector<std::unique_ptr<Module>> Ms;
> +    Ms.push_back(std::move(Owner));
> +    for (auto &ExtraMod : ExtraModules) {
> +      Ms.push_back(parseIRFile(ExtraMod, Err, Context));
> +      if (!Ms.back()) {
> +        Err.print(argv[0], errs());
> +        return 1;
> +      }
> +    }
> +    return runOrcLazyJIT(std::move(Ms), argc, argv);
> +  }
>
>    if (EnableCacheManager) {
>      std::string CacheName("file:");
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160808/9e882e6d/attachment.html>


More information about the llvm-commits mailing list