[llvm] r344572 - [ORC] Rename ORC layers to make the "new" ORC layers the default.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 15 15:56:10 PDT 2018


Author: lhames
Date: Mon Oct 15 15:56:10 2018
New Revision: 344572

URL: http://llvm.org/viewvc/llvm-project?rev=344572&view=rev
Log:
[ORC] Rename ORC layers to make the "new" ORC layers the default.

This commit adds a 'Legacy' prefix to old ORC layers and utilities, and removes
the '2' suffix from the new ORC layers. If you wish to continue using the old
ORC layers you will need to add a 'Legacy' prefix to your classes. If you were
already using the new ORC layers you will need to drop the '2' suffix.

The legacy layers will remain in-tree until the new layers reach feature
parity with them. This will involve adding support for removing code from the
new layers, and ensuring that performance is comperable.

Added:
    llvm/trunk/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp
      - copied, changed from r344569, llvm/trunk/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp
    llvm/trunk/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp
      - copied, changed from r344569, llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
Removed:
    llvm/trunk/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp
    llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayer2Test.cpp
Modified:
    llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h
    llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h
    llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
    llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
    llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h
    llvm/trunk/examples/Kaleidoscope/include/KaleidoscopeJIT.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/IRTransformLayer.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
    llvm/trunk/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
    llvm/trunk/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
    llvm/trunk/lib/ExecutionEngine/Orc/IRCompileLayer.cpp
    llvm/trunk/lib/ExecutionEngine/Orc/IRTransformLayer.cpp
    llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp
    llvm/trunk/lib/ExecutionEngine/Orc/ObjectTransformLayer.cpp
    llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h
    llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp
    llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
    llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
    llvm/trunk/tools/lli/lli.cpp
    llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt
    llvm/trunk/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp
    llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp

Modified: llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h (original)
+++ llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h Mon Oct 15 15:56:10 2018
@@ -42,8 +42,8 @@ private:
   std::shared_ptr<SymbolResolver> Resolver;
   std::unique_ptr<TargetMachine> TM;
   const DataLayout DL;
-  RTDyldObjectLinkingLayer ObjectLayer;
-  IRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
+  LegacyRTDyldObjectLinkingLayer ObjectLayer;
+  LegacyIRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
 
 public:
   KaleidoscopeJIT()
@@ -63,7 +63,7 @@ public:
         TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
         ObjectLayer(ES,
                     [this](VModuleKey) {
-                      return RTDyldObjectLinkingLayer::Resources{
+                      return LegacyRTDyldObjectLinkingLayer::Resources{
                           std::make_shared<SectionMemoryManager>(), Resolver};
                     }),
         CompileLayer(ObjectLayer, SimpleCompiler(*TM)) {

Modified: llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h (original)
+++ llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h Mon Oct 15 15:56:10 2018
@@ -47,13 +47,13 @@ private:
   std::shared_ptr<SymbolResolver> Resolver;
   std::unique_ptr<TargetMachine> TM;
   const DataLayout DL;
-  RTDyldObjectLinkingLayer ObjectLayer;
-  IRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
+  LegacyRTDyldObjectLinkingLayer ObjectLayer;
+  LegacyIRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
 
   using OptimizeFunction =
       std::function<std::unique_ptr<Module>(std::unique_ptr<Module>)>;
 
-  IRTransformLayer<decltype(CompileLayer), OptimizeFunction> OptimizeLayer;
+  LegacyIRTransformLayer<decltype(CompileLayer), OptimizeFunction> OptimizeLayer;
 
 public:
   KaleidoscopeJIT()
@@ -73,7 +73,7 @@ public:
         TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
         ObjectLayer(ES,
                     [this](VModuleKey) {
-                      return RTDyldObjectLinkingLayer::Resources{
+                      return LegacyRTDyldObjectLinkingLayer::Resources{
                           std::make_shared<SectionMemoryManager>(), Resolver};
                     }),
         CompileLayer(ObjectLayer, SimpleCompiler(*TM)),

Modified: llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h (original)
+++ llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h Mon Oct 15 15:56:10 2018
@@ -51,23 +51,23 @@ private:
   std::map<VModuleKey, std::shared_ptr<SymbolResolver>> Resolvers;
   std::unique_ptr<TargetMachine> TM;
   const DataLayout DL;
-  RTDyldObjectLinkingLayer ObjectLayer;
-  IRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
+  LegacyRTDyldObjectLinkingLayer ObjectLayer;
+  LegacyIRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
 
   using OptimizeFunction =
       std::function<std::unique_ptr<Module>(std::unique_ptr<Module>)>;
 
-  IRTransformLayer<decltype(CompileLayer), OptimizeFunction> OptimizeLayer;
+  LegacyIRTransformLayer<decltype(CompileLayer), OptimizeFunction> OptimizeLayer;
 
   std::unique_ptr<JITCompileCallbackManager> CompileCallbackManager;
-  CompileOnDemandLayer<decltype(OptimizeLayer)> CODLayer;
+  LegacyCompileOnDemandLayer<decltype(OptimizeLayer)> CODLayer;
 
 public:
   KaleidoscopeJIT()
       : TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
         ObjectLayer(ES,
                     [this](VModuleKey K) {
-                      return RTDyldObjectLinkingLayer::Resources{
+                      return LegacyRTDyldObjectLinkingLayer::Resources{
                           std::make_shared<SectionMemoryManager>(),
                           Resolvers[K]};
                     }),

Modified: llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h (original)
+++ llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h Mon Oct 15 15:56:10 2018
@@ -77,13 +77,13 @@ private:
   std::shared_ptr<SymbolResolver> Resolver;
   std::unique_ptr<TargetMachine> TM;
   const DataLayout DL;
-  RTDyldObjectLinkingLayer ObjectLayer;
-  IRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
+  LegacyRTDyldObjectLinkingLayer ObjectLayer;
+  LegacyIRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
 
   using OptimizeFunction =
       std::function<std::unique_ptr<Module>(std::unique_ptr<Module>)>;
 
-  IRTransformLayer<decltype(CompileLayer), OptimizeFunction> OptimizeLayer;
+  LegacyIRTransformLayer<decltype(CompileLayer), OptimizeFunction> OptimizeLayer;
 
   std::unique_ptr<JITCompileCallbackManager> CompileCallbackMgr;
   std::unique_ptr<IndirectStubsManager> IndirectStubsMgr;
@@ -108,7 +108,7 @@ public:
         TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
         ObjectLayer(ES,
                     [this](VModuleKey K) {
-                      return RTDyldObjectLinkingLayer::Resources{
+                      return LegacyRTDyldObjectLinkingLayer::Resources{
                           std::make_shared<SectionMemoryManager>(), Resolver};
                     }),
         CompileLayer(ObjectLayer, SimpleCompiler(*TM)),

Modified: llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h (original)
+++ llvm/trunk/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h Mon Oct 15 15:56:10 2018
@@ -82,13 +82,13 @@ private:
   std::shared_ptr<SymbolResolver> Resolver;
   std::unique_ptr<TargetMachine> TM;
   const DataLayout DL;
-  RTDyldObjectLinkingLayer ObjectLayer;
-  IRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
+  LegacyRTDyldObjectLinkingLayer ObjectLayer;
+  LegacyIRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
 
   using OptimizeFunction =
       std::function<std::unique_ptr<Module>(std::unique_ptr<Module>)>;
 
-  IRTransformLayer<decltype(CompileLayer), OptimizeFunction> OptimizeLayer;
+  LegacyIRTransformLayer<decltype(CompileLayer), OptimizeFunction> OptimizeLayer;
 
   JITCompileCallbackManager *CompileCallbackMgr;
   std::unique_ptr<IndirectStubsManager> IndirectStubsMgr;
@@ -116,7 +116,7 @@ public:
         DL(TM->createDataLayout()),
         ObjectLayer(ES,
                     [this](VModuleKey K) {
-                      return RTDyldObjectLinkingLayer::Resources{
+                      return LegacyRTDyldObjectLinkingLayer::Resources{
                           cantFail(this->Remote.createRemoteMemoryManager()),
                           Resolver};
                     }),

Modified: llvm/trunk/examples/Kaleidoscope/include/KaleidoscopeJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/include/KaleidoscopeJIT.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/include/KaleidoscopeJIT.h (original)
+++ llvm/trunk/examples/Kaleidoscope/include/KaleidoscopeJIT.h Mon Oct 15 15:56:10 2018
@@ -40,8 +40,8 @@ namespace orc {
 
 class KaleidoscopeJIT {
 public:
-  using ObjLayerT = RTDyldObjectLinkingLayer;
-  using CompileLayerT = IRCompileLayer<ObjLayerT, SimpleCompiler>;
+  using ObjLayerT = LegacyRTDyldObjectLinkingLayer;
+  using CompileLayerT = LegacyIRCompileLayer<ObjLayerT, SimpleCompiler>;
 
   KaleidoscopeJIT()
       : Resolver(createLegacyLookupResolver(

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h Mon Oct 15 15:56:10 2018
@@ -62,7 +62,7 @@ namespace orc {
 
 class ExtractingIRMaterializationUnit;
 
-class CompileOnDemandLayer2 : public IRLayer {
+class CompileOnDemandLayer : public IRLayer {
   friend class PartitioningIRMaterializationUnit;
 
 public:
@@ -84,8 +84,8 @@ public:
   /// symbol in them is requested.
   static Optional<GlobalValueSet> compileWholeModule(GlobalValueSet Requested);
 
-  /// Construct a CompileOnDemandLayer2.
-  CompileOnDemandLayer2(ExecutionSession &ES, IRLayer &BaseLayer,
+  /// Construct a CompileOnDemandLayer.
+  CompileOnDemandLayer(ExecutionSession &ES, IRLayer &BaseLayer,
                         LazyCallThroughManager &LCTMgr,
                         IndirectStubsManagerBuilder BuildIndirectStubsManager);
 
@@ -142,7 +142,7 @@ private:
 template <typename BaseLayerT,
           typename CompileCallbackMgrT = JITCompileCallbackManager,
           typename IndirectStubsMgrT = IndirectStubsManager>
-class CompileOnDemandLayer {
+class LegacyCompileOnDemandLayer {
 private:
   template <typename MaterializerFtor>
   class LambdaMaterializer final : public ValueMaterializer {
@@ -266,13 +266,13 @@ public:
       std::function<void(VModuleKey K, std::shared_ptr<SymbolResolver> R)>;
 
   /// Construct a compile-on-demand layer instance.
-  CompileOnDemandLayer(ExecutionSession &ES, BaseLayerT &BaseLayer,
-                       SymbolResolverGetter GetSymbolResolver,
-                       SymbolResolverSetter SetSymbolResolver,
-                       PartitioningFtor Partition,
-                       CompileCallbackMgrT &CallbackMgr,
-                       IndirectStubsManagerBuilderT CreateIndirectStubsManager,
-                       bool CloneStubsIntoPartitions = true)
+  LegacyCompileOnDemandLayer(ExecutionSession &ES, BaseLayerT &BaseLayer,
+                             SymbolResolverGetter GetSymbolResolver,
+                             SymbolResolverSetter SetSymbolResolver,
+                             PartitioningFtor Partition,
+                             CompileCallbackMgrT &CallbackMgr,
+                             IndirectStubsManagerBuilderT CreateIndirectStubsManager,
+                             bool CloneStubsIntoPartitions = true)
       : ES(ES), BaseLayer(BaseLayer),
         GetSymbolResolver(std::move(GetSymbolResolver)),
         SetSymbolResolver(std::move(SetSymbolResolver)),
@@ -280,7 +280,7 @@ public:
         CreateIndirectStubsManager(std::move(CreateIndirectStubsManager)),
         CloneStubsIntoPartitions(CloneStubsIntoPartitions) {}
 
-  ~CompileOnDemandLayer() {
+  ~LegacyCompileOnDemandLayer() {
     // FIXME: Report error on log.
     while (!LogicalDylibs.empty())
       consumeError(removeModule(LogicalDylibs.begin()->first));

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h Mon Oct 15 15:56:10 2018
@@ -94,11 +94,11 @@ iterator_range<CtorDtorIterator> getDest
 /// Convenience class for recording constructor/destructor names for
 ///        later execution.
 template <typename JITLayerT>
-class CtorDtorRunner {
+class LegacyCtorDtorRunner {
 public:
   /// Construct a CtorDtorRunner for the given range using the given
   ///        name mangling function.
-  CtorDtorRunner(std::vector<std::string> CtorDtorNames, VModuleKey K)
+  LegacyCtorDtorRunner(std::vector<std::string> CtorDtorNames, VModuleKey K)
       : CtorDtorNames(std::move(CtorDtorNames)), K(K) {}
 
   /// Run the recorded constructors/destructors through the given JIT
@@ -129,9 +129,9 @@ private:
   orc::VModuleKey K;
 };
 
-class CtorDtorRunner2 {
+class CtorDtorRunner {
 public:
-  CtorDtorRunner2(JITDylib &JD) : JD(JD) {}
+  CtorDtorRunner(JITDylib &JD) : JD(JD) {}
   void add(iterator_range<CtorDtorIterator> CtorDtors);
   Error run();
 
@@ -177,11 +177,11 @@ protected:
                                void *DSOHandle);
 };
 
-class LocalCXXRuntimeOverrides : public LocalCXXRuntimeOverridesBase {
+class LegacyLocalCXXRuntimeOverrides : public LocalCXXRuntimeOverridesBase {
 public:
   /// Create a runtime-overrides class.
   template <typename MangleFtorT>
-  LocalCXXRuntimeOverrides(const MangleFtorT &Mangle) {
+  LegacyLocalCXXRuntimeOverrides(const MangleFtorT &Mangle) {
     addOverride(Mangle("__dso_handle"), toTargetAddress(&DSOHandleOverride));
     addOverride(Mangle("__cxa_atexit"), toTargetAddress(&CXAAtExitOverride));
   }
@@ -202,7 +202,7 @@ private:
   StringMap<JITTargetAddress> CXXRuntimeOverrides;
 };
 
-class LocalCXXRuntimeOverrides2 : public LocalCXXRuntimeOverridesBase {
+class LocalCXXRuntimeOverrides : public LocalCXXRuntimeOverridesBase {
 public:
   Error enable(JITDylib &JD, MangleAndInterner &Mangler);
 };

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h Mon Oct 15 15:56:10 2018
@@ -28,7 +28,7 @@ class Module;
 
 namespace orc {
 
-class IRCompileLayer2 : public IRLayer {
+class IRCompileLayer : public IRLayer {
 public:
   using CompileFunction =
       std::function<Expected<std::unique_ptr<MemoryBuffer>>(Module &)>;
@@ -36,8 +36,8 @@ public:
   using NotifyCompiledFunction =
       std::function<void(VModuleKey K, ThreadSafeModule TSM)>;
 
-  IRCompileLayer2(ExecutionSession &ES, ObjectLayer &BaseLayer,
-                  CompileFunction Compile);
+  IRCompileLayer(ExecutionSession &ES, ObjectLayer &BaseLayer,
+                 CompileFunction Compile);
 
   void setNotifyCompiled(NotifyCompiledFunction NotifyCompiled);
 
@@ -57,15 +57,15 @@ private:
 /// object file and adds this module file to the layer below, which must
 /// implement the object layer concept.
 template <typename BaseLayerT, typename CompileFtor>
-class IRCompileLayer {
+class LegacyIRCompileLayer {
 public:
   /// Callback type for notifications when modules are compiled.
   using NotifyCompiledCallback =
       std::function<void(VModuleKey K, std::unique_ptr<Module>)>;
 
-  /// Construct an IRCompileLayer with the given BaseLayer, which must
+  /// Construct an LegacyIRCompileLayer with the given BaseLayer, which must
   ///        implement the ObjectLayer concept.
-  IRCompileLayer(
+  LegacyIRCompileLayer(
       BaseLayerT &BaseLayer, CompileFtor Compile,
       NotifyCompiledCallback NotifyCompiled = NotifyCompiledCallback())
       : BaseLayer(BaseLayer), Compile(std::move(Compile)),

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/IRTransformLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/IRTransformLayer.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/IRTransformLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/IRTransformLayer.h Mon Oct 15 15:56:10 2018
@@ -23,13 +23,13 @@ namespace llvm {
 class Module;
 namespace orc {
 
-class IRTransformLayer2 : public IRLayer {
+class IRTransformLayer : public IRLayer {
 public:
   using TransformFunction = std::function<Expected<ThreadSafeModule>(
       ThreadSafeModule, const MaterializationResponsibility &R)>;
 
-  IRTransformLayer2(ExecutionSession &ES, IRLayer &BaseLayer,
-                    TransformFunction Transform = identityTransform);
+  IRTransformLayer(ExecutionSession &ES, IRLayer &BaseLayer,
+                   TransformFunction Transform = identityTransform);
 
   void setTransform(TransformFunction Transform) {
     this->Transform = std::move(Transform);
@@ -54,11 +54,11 @@ private:
 ///   This layer applies a user supplied transform to each module that is added,
 /// then adds the transformed module to the layer below.
 template <typename BaseLayerT, typename TransformFtor>
-class IRTransformLayer {
+class LegacyIRTransformLayer {
 public:
 
-  /// Construct an IRTransformLayer with the given BaseLayer
-  IRTransformLayer(BaseLayerT &BaseLayer,
+  /// Construct an LegacyIRTransformLayer with the given BaseLayer
+  LegacyIRTransformLayer(BaseLayerT &BaseLayer,
                    TransformFtor Transform = TransformFtor())
     : BaseLayer(BaseLayer), Transform(std::move(Transform)) {}
 

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h Mon Oct 15 15:56:10 2018
@@ -99,7 +99,7 @@ public:
   Error runDestructors() { return DtorRunner.run(); }
 
   /// Returns a reference to the ObjLinkingLayer
-  RTDyldObjectLinkingLayer2 &getObjLinkingLayer() { return ObjLinkingLayer; }
+  RTDyldObjectLinkingLayer &getObjLinkingLayer() { return ObjLinkingLayer; }
 
 protected:
 
@@ -125,10 +125,10 @@ protected:
   DataLayout DL;
   std::unique_ptr<ThreadPool> CompileThreads;
 
-  RTDyldObjectLinkingLayer2 ObjLinkingLayer;
-  IRCompileLayer2 CompileLayer;
+  RTDyldObjectLinkingLayer ObjLinkingLayer;
+  IRCompileLayer CompileLayer;
 
-  CtorDtorRunner2 CtorRunner, DtorRunner;
+  CtorDtorRunner CtorRunner, DtorRunner;
 };
 
 /// An extended version of LLJIT that supports lazy function-at-a-time
@@ -145,13 +145,13 @@ public:
 
   /// Set an IR transform (e.g. pass manager pipeline) to run on each function
   /// when it is compiled.
-  void setLazyCompileTransform(IRTransformLayer2::TransformFunction Transform) {
+  void setLazyCompileTransform(IRTransformLayer::TransformFunction Transform) {
     TransformLayer.setTransform(std::move(Transform));
   }
 
   /// Sets the partition function.
   void
-  setPartitionFunction(CompileOnDemandLayer2::PartitionFunction Partition) {
+  setPartitionFunction(CompileOnDemandLayer::PartitionFunction Partition) {
     CODLayer.setPartitionFunction(std::move(Partition));
   }
 
@@ -180,8 +180,8 @@ private:
   std::unique_ptr<LazyCallThroughManager> LCTMgr;
   std::function<std::unique_ptr<IndirectStubsManager>()> ISMBuilder;
 
-  IRTransformLayer2 TransformLayer;
-  CompileOnDemandLayer2 CODLayer;
+  IRTransformLayer TransformLayer;
+  CompileOnDemandLayer CODLayer;
 };
 
 } // End namespace orc

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h Mon Oct 15 15:56:10 2018
@@ -23,14 +23,14 @@
 namespace llvm {
 namespace orc {
 
-class ObjectTransformLayer2 : public ObjectLayer {
+class ObjectTransformLayer : public ObjectLayer {
 public:
   using TransformFunction =
       std::function<Expected<std::unique_ptr<MemoryBuffer>>(
           std::unique_ptr<MemoryBuffer>)>;
 
-  ObjectTransformLayer2(ExecutionSession &ES, ObjectLayer &BaseLayer,
-                        TransformFunction Transform);
+  ObjectTransformLayer(ExecutionSession &ES, ObjectLayer &BaseLayer,
+                       TransformFunction Transform);
 
   void emit(MaterializationResponsibility R, VModuleKey K,
             std::unique_ptr<MemoryBuffer> O) override;
@@ -46,11 +46,11 @@ private:
 /// immediately applies the user supplied functor to each object, then adds
 /// the set of transformed objects to the layer below.
 template <typename BaseLayerT, typename TransformFtor>
-class ObjectTransformLayer {
+class LegacyObjectTransformLayer {
 public:
   /// Construct an ObjectTransformLayer with the given BaseLayer
-  ObjectTransformLayer(BaseLayerT &BaseLayer,
-                       TransformFtor Transform = TransformFtor())
+  LegacyObjectTransformLayer(BaseLayerT &BaseLayer,
+                             TransformFtor Transform = TransformFtor())
       : BaseLayer(BaseLayer), Transform(std::move(Transform)) {}
 
   /// Apply the transform functor to each object in the object set, then

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h Mon Oct 15 15:56:10 2018
@@ -36,7 +36,7 @@
 namespace llvm {
 namespace orc {
 
-class RTDyldObjectLinkingLayer2 : public ObjectLayer {
+class RTDyldObjectLinkingLayer : public ObjectLayer {
 public:
   /// Functor for receiving object-loaded notifications.
   using NotifyLoadedFunction =
@@ -51,7 +51,7 @@ public:
 
   /// Construct an ObjectLinkingLayer with the given NotifyLoaded,
   ///        and NotifyEmitted functors.
-  RTDyldObjectLinkingLayer2(
+  RTDyldObjectLinkingLayer(
       ExecutionSession &ES, GetMemoryManagerFunction GetMemoryManager,
       NotifyLoadedFunction NotifyLoaded = NotifyLoadedFunction(),
       NotifyEmittedFunction NotifyEmitted = NotifyEmittedFunction());
@@ -66,7 +66,7 @@ public:
   /// the memory manager, rather than just the sections required for execution.
   ///
   /// This is kludgy, and may be removed in the future.
-  RTDyldObjectLinkingLayer2 &setProcessAllSections(bool ProcessAllSections) {
+  RTDyldObjectLinkingLayer &setProcessAllSections(bool ProcessAllSections) {
     this->ProcessAllSections = ProcessAllSections;
     return *this;
   }
@@ -79,13 +79,13 @@ public:
   ///
   /// FIXME: We should be able to remove this if/when COFF properly tracks
   /// exported symbols.
-  RTDyldObjectLinkingLayer2 &
+  RTDyldObjectLinkingLayer &
   setOverrideObjectFlagsWithResponsibilityFlags(bool OverrideObjectFlags) {
     this->OverrideObjectFlags = OverrideObjectFlags;
     return *this;
   }
 
-  /// If set, this RTDyldObjectLinkingLayer2 instance will claim responsibility
+  /// If set, this RTDyldObjectLinkingLayer instance will claim responsibility
   /// for any symbols provided by a given object file that were not already in
   /// the MaterializationResponsibility instance. Setting this flag allows
   /// higher-level program representations (e.g. LLVM IR) to be added based on
@@ -96,7 +96,7 @@ public:
   /// deterministically). If this option is set, clashes for the additional
   /// symbols may not be detected until late, and detection may depend on
   /// the flow of control through JIT'd code. Use with care.
-  RTDyldObjectLinkingLayer2 &
+  RTDyldObjectLinkingLayer &
   setAutoClaimResponsibilityForObjectSymbols(bool AutoClaimObjectSymbols) {
     this->AutoClaimObjectSymbols = AutoClaimObjectSymbols;
     return *this;
@@ -121,7 +121,7 @@ private:
   std::map<VModuleKey, std::shared_ptr<RuntimeDyld::MemoryManager>> MemMgrs;
 };
 
-class RTDyldObjectLinkingLayerBase {
+class LegacyRTDyldObjectLinkingLayerBase {
 public:
   using ObjectPtr = std::unique_ptr<MemoryBuffer>;
 
@@ -173,10 +173,10 @@ protected:
 /// object files to be loaded into memory, linked, and the addresses of their
 /// symbols queried. All objects added to this layer can see each other's
 /// symbols.
-class RTDyldObjectLinkingLayer : public RTDyldObjectLinkingLayerBase {
+class LegacyRTDyldObjectLinkingLayer : public LegacyRTDyldObjectLinkingLayerBase {
 public:
 
-  using RTDyldObjectLinkingLayerBase::ObjectPtr;
+  using LegacyRTDyldObjectLinkingLayerBase::ObjectPtr;
 
   /// Functor for receiving object-loaded notifications.
   using NotifyLoadedFtor =
@@ -197,7 +197,7 @@ private:
   template <typename MemoryManagerPtrT>
   class ConcreteLinkedObject : public LinkedObject {
   public:
-    ConcreteLinkedObject(RTDyldObjectLinkingLayer &Parent, VModuleKey K,
+    ConcreteLinkedObject(LegacyRTDyldObjectLinkingLayer &Parent, VModuleKey K,
                          OwnedObject Obj, MemoryManagerPtrT MemMgr,
                          std::shared_ptr<SymbolResolver> Resolver,
                          bool ProcessAllSections)
@@ -313,7 +313,7 @@ private:
     };
 
     VModuleKey K;
-    RTDyldObjectLinkingLayer &Parent;
+    LegacyRTDyldObjectLinkingLayer &Parent;
     MemoryManagerPtrT MemMgr;
     OwnedObject ObjForNotify;
     std::unique_ptr<PreFinalizeContents> PFC;
@@ -321,7 +321,7 @@ private:
 
   template <typename MemoryManagerPtrT>
   std::unique_ptr<ConcreteLinkedObject<MemoryManagerPtrT>>
-  createLinkedObject(RTDyldObjectLinkingLayer &Parent, VModuleKey K,
+  createLinkedObject(LegacyRTDyldObjectLinkingLayer &Parent, VModuleKey K,
                      OwnedObject Obj, MemoryManagerPtrT MemMgr,
                      std::shared_ptr<SymbolResolver> Resolver,
                      bool ProcessAllSections) {
@@ -341,7 +341,7 @@ public:
 
   /// Construct an ObjectLinkingLayer with the given NotifyLoaded,
   ///        and NotifyFinalized functors.
-  RTDyldObjectLinkingLayer(
+  LegacyRTDyldObjectLinkingLayer(
       ExecutionSession &ES, ResourcesGetter GetResources,
       NotifyLoadedFtor NotifyLoaded = NotifyLoadedFtor(),
       NotifyFinalizedFtor NotifyFinalized = NotifyFinalizedFtor(),

Modified: llvm/trunk/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp Mon Oct 15 15:56:10 2018
@@ -68,13 +68,13 @@ namespace orc {
 class PartitioningIRMaterializationUnit : public IRMaterializationUnit {
 public:
   PartitioningIRMaterializationUnit(ExecutionSession &ES, ThreadSafeModule TSM,
-                                    CompileOnDemandLayer2 &Parent)
+                                    CompileOnDemandLayer &Parent)
       : IRMaterializationUnit(ES, std::move(TSM)), Parent(Parent) {}
 
   PartitioningIRMaterializationUnit(
       ThreadSafeModule TSM, SymbolFlagsMap SymbolFlags,
       SymbolNameToDefinitionMap SymbolToDefinition,
-      CompileOnDemandLayer2 &Parent)
+      CompileOnDemandLayer &Parent)
       : IRMaterializationUnit(std::move(TSM), std::move(SymbolFlags),
                               std::move(SymbolToDefinition)),
         Parent(Parent) {}
@@ -93,30 +93,30 @@ private:
   }
 
   mutable std::mutex SourceModuleMutex;
-  CompileOnDemandLayer2 &Parent;
+  CompileOnDemandLayer &Parent;
 };
 
-Optional<CompileOnDemandLayer2::GlobalValueSet>
-CompileOnDemandLayer2::compileRequested(GlobalValueSet Requested) {
+Optional<CompileOnDemandLayer::GlobalValueSet>
+CompileOnDemandLayer::compileRequested(GlobalValueSet Requested) {
   return std::move(Requested);
 }
 
-Optional<CompileOnDemandLayer2::GlobalValueSet>
-CompileOnDemandLayer2::compileWholeModule(GlobalValueSet Requested) {
+Optional<CompileOnDemandLayer::GlobalValueSet>
+CompileOnDemandLayer::compileWholeModule(GlobalValueSet Requested) {
   return None;
 }
 
-CompileOnDemandLayer2::CompileOnDemandLayer2(
+CompileOnDemandLayer::CompileOnDemandLayer(
     ExecutionSession &ES, IRLayer &BaseLayer, LazyCallThroughManager &LCTMgr,
     IndirectStubsManagerBuilder BuildIndirectStubsManager)
     : IRLayer(ES), BaseLayer(BaseLayer), LCTMgr(LCTMgr),
       BuildIndirectStubsManager(std::move(BuildIndirectStubsManager)) {}
 
-void CompileOnDemandLayer2::setPartitionFunction(PartitionFunction Partition) {
+void CompileOnDemandLayer::setPartitionFunction(PartitionFunction Partition) {
   this->Partition = std::move(Partition);
 }
 
-void CompileOnDemandLayer2::emit(MaterializationResponsibility R, VModuleKey K,
+void CompileOnDemandLayer::emit(MaterializationResponsibility R, VModuleKey K,
                                  ThreadSafeModule TSM) {
   assert(TSM.getModule() && "Null module");
 
@@ -160,8 +160,8 @@ void CompileOnDemandLayer2::emit(Materia
                           std::move(Callables)));
 }
 
-CompileOnDemandLayer2::PerDylibResources &
-CompileOnDemandLayer2::getPerDylibResources(JITDylib &TargetD) {
+CompileOnDemandLayer::PerDylibResources &
+CompileOnDemandLayer::getPerDylibResources(JITDylib &TargetD) {
   auto I = DylibResources.find(&TargetD);
   if (I == DylibResources.end()) {
     auto &ImplD =
@@ -176,7 +176,7 @@ CompileOnDemandLayer2::getPerDylibResour
   return I->second;
 }
 
-void CompileOnDemandLayer2::cleanUpModule(Module &M) {
+void CompileOnDemandLayer::cleanUpModule(Module &M) {
   for (auto &F : M.functions()) {
     if (F.isDeclaration())
       continue;
@@ -189,7 +189,7 @@ void CompileOnDemandLayer2::cleanUpModul
   }
 }
 
-void CompileOnDemandLayer2::expandPartition(GlobalValueSet &Partition) {
+void CompileOnDemandLayer::expandPartition(GlobalValueSet &Partition) {
   // Expands the partition to ensure the following rules hold:
   // (1) If any alias is in the partition, its aliasee is also in the partition.
   // (2) If any aliasee is in the partition, its aliases are also in the
@@ -221,7 +221,7 @@ void CompileOnDemandLayer2::expandPartit
     Partition.insert(GV);
 }
 
-void CompileOnDemandLayer2::emitPartition(
+void CompileOnDemandLayer::emitPartition(
     MaterializationResponsibility R, ThreadSafeModule TSM,
     IRMaterializationUnit::SymbolNameToDefinitionMap Defs) {
 

Modified: llvm/trunk/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/ExecutionUtils.cpp?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/ExecutionUtils.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/ExecutionUtils.cpp Mon Oct 15 15:56:10 2018
@@ -87,7 +87,7 @@ iterator_range<CtorDtorIterator> getDest
                     CtorDtorIterator(DtorsList, true));
 }
 
-void CtorDtorRunner2::add(iterator_range<CtorDtorIterator> CtorDtors) {
+void CtorDtorRunner::add(iterator_range<CtorDtorIterator> CtorDtors) {
   if (CtorDtors.begin() == CtorDtors.end())
     return;
 
@@ -115,7 +115,7 @@ void CtorDtorRunner2::add(iterator_range
   }
 }
 
-Error CtorDtorRunner2::run() {
+Error CtorDtorRunner::run() {
   using CtorDtorTy = void (*)();
 
   SymbolNameSet Names;
@@ -165,7 +165,7 @@ int LocalCXXRuntimeOverridesBase::CXAAtE
   return 0;
 }
 
-Error LocalCXXRuntimeOverrides2::enable(JITDylib &JD,
+Error LocalCXXRuntimeOverrides::enable(JITDylib &JD,
                                         MangleAndInterner &Mangle) {
   SymbolMap RuntimeInterposes;
   RuntimeInterposes[Mangle("__dso_handle")] =

Modified: llvm/trunk/lib/ExecutionEngine/Orc/IRCompileLayer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/IRCompileLayer.cpp?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/IRCompileLayer.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/IRCompileLayer.cpp Mon Oct 15 15:56:10 2018
@@ -12,16 +12,16 @@
 namespace llvm {
 namespace orc {
 
-IRCompileLayer2::IRCompileLayer2(ExecutionSession &ES, ObjectLayer &BaseLayer,
+IRCompileLayer::IRCompileLayer(ExecutionSession &ES, ObjectLayer &BaseLayer,
                                  CompileFunction Compile)
     : IRLayer(ES), BaseLayer(BaseLayer), Compile(std::move(Compile)) {}
 
-void IRCompileLayer2::setNotifyCompiled(NotifyCompiledFunction NotifyCompiled) {
+void IRCompileLayer::setNotifyCompiled(NotifyCompiledFunction NotifyCompiled) {
   std::lock_guard<std::mutex> Lock(IRLayerMutex);
   this->NotifyCompiled = std::move(NotifyCompiled);
 }
 
-void IRCompileLayer2::emit(MaterializationResponsibility R, VModuleKey K,
+void IRCompileLayer::emit(MaterializationResponsibility R, VModuleKey K,
                            ThreadSafeModule TSM) {
   assert(TSM.getModule() && "Module must not be null");
 

Modified: llvm/trunk/lib/ExecutionEngine/Orc/IRTransformLayer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/IRTransformLayer.cpp?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/IRTransformLayer.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/IRTransformLayer.cpp Mon Oct 15 15:56:10 2018
@@ -13,12 +13,12 @@
 namespace llvm {
 namespace orc {
 
-IRTransformLayer2::IRTransformLayer2(ExecutionSession &ES,
+IRTransformLayer::IRTransformLayer(ExecutionSession &ES,
                                      IRLayer &BaseLayer,
                                      TransformFunction Transform)
     : IRLayer(ES), BaseLayer(BaseLayer), Transform(std::move(Transform)) {}
 
-void IRTransformLayer2::emit(MaterializationResponsibility R, VModuleKey K,
+void IRTransformLayer::emit(MaterializationResponsibility R, VModuleKey K,
                              ThreadSafeModule TSM) {
   assert(TSM.getModule() && "Module must not be null");
 

Modified: llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp Mon Oct 15 15:56:10 2018
@@ -21,7 +21,7 @@ namespace {
       : llvm::orc::SimpleCompiler(*TM), TM(std::move(TM)) {}
   private:
     // FIXME: shared because std::functions (and thus
-    // IRCompileLayer2::CompileFunction) are not moveable.
+    // IRCompileLayer::CompileFunction) are not moveable.
     std::shared_ptr<llvm::TargetMachine> TM;
   };
 

Modified: llvm/trunk/lib/ExecutionEngine/Orc/ObjectTransformLayer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/ObjectTransformLayer.cpp?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/ObjectTransformLayer.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/ObjectTransformLayer.cpp Mon Oct 15 15:56:10 2018
@@ -13,13 +13,13 @@
 namespace llvm {
 namespace orc {
 
-ObjectTransformLayer2::ObjectTransformLayer2(ExecutionSession &ES,
-                                             ObjectLayer &BaseLayer,
-                                             TransformFunction Transform)
+ObjectTransformLayer::ObjectTransformLayer(ExecutionSession &ES,
+                                            ObjectLayer &BaseLayer,
+                                            TransformFunction Transform)
     : ObjectLayer(ES), BaseLayer(BaseLayer), Transform(std::move(Transform)) {}
 
-void ObjectTransformLayer2::emit(MaterializationResponsibility R, VModuleKey K,
-                                 std::unique_ptr<MemoryBuffer> O) {
+void ObjectTransformLayer::emit(MaterializationResponsibility R, VModuleKey K,
+                                std::unique_ptr<MemoryBuffer> O) {
   assert(O && "Module must not be null");
 
   if (auto TransformedObj = Transform(std::move(O)))

Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h Mon Oct 15 15:56:10 2018
@@ -77,9 +77,9 @@ public:
   };
 
   template <>
-  class GenericLayerImpl<orc::RTDyldObjectLinkingLayer> : public GenericLayer {
+  class GenericLayerImpl<orc::LegacyRTDyldObjectLinkingLayer> : public GenericLayer {
   private:
-    using LayerT = orc::RTDyldObjectLinkingLayer;
+    using LayerT = orc::LegacyRTDyldObjectLinkingLayer;
   public:
     GenericLayerImpl(LayerT &Layer) : Layer(Layer) {}
 
@@ -107,10 +107,10 @@ class OrcCBindingsStack {
 public:
 
   using CompileCallbackMgr = orc::JITCompileCallbackManager;
-  using ObjLayerT = orc::RTDyldObjectLinkingLayer;
-  using CompileLayerT = orc::IRCompileLayer<ObjLayerT, orc::SimpleCompiler>;
+  using ObjLayerT = orc::LegacyRTDyldObjectLinkingLayer;
+  using CompileLayerT = orc::LegacyIRCompileLayer<ObjLayerT, orc::SimpleCompiler>;
   using CODLayerT =
-        orc::CompileOnDemandLayer<CompileLayerT, CompileCallbackMgr>;
+        orc::LegacyCompileOnDemandLayer<CompileLayerT, CompileCallbackMgr>;
 
   using CallbackManagerBuilder =
       std::function<std::unique_ptr<CompileCallbackMgr>()>;
@@ -312,7 +312,7 @@ public:
 
     // Run the static constructors, and save the static destructor runner for
     // execution when the JIT is torn down.
-    orc::CtorDtorRunner<OrcCBindingsStack> CtorRunner(std::move(CtorNames), K);
+    orc::LegacyCtorDtorRunner<OrcCBindingsStack> CtorRunner(std::move(CtorNames), K);
     if (auto Err = CtorRunner.runViaLayer(*this))
       return std::move(Err);
 
@@ -517,8 +517,8 @@ private:
 
   std::map<orc::VModuleKey, std::unique_ptr<detail::GenericLayer>> KeyLayers;
 
-  orc::LocalCXXRuntimeOverrides CXXRuntimeOverrides;
-  std::vector<orc::CtorDtorRunner<OrcCBindingsStack>> IRStaticDestructorRunners;
+  orc::LegacyLocalCXXRuntimeOverrides CXXRuntimeOverrides;
+  std::vector<orc::LegacyCtorDtorRunner<OrcCBindingsStack>> IRStaticDestructorRunners;
   std::string ErrMsg;
 
   ResolverMap Resolvers;

Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp Mon Oct 15 15:56:10 2018
@@ -128,7 +128,7 @@ void OrcMCJITReplacement::runStaticConst
   auto &CtorDtorsMap = isDtors ? UnexecutedDestructors : UnexecutedConstructors;
 
   for (auto &KV : CtorDtorsMap)
-    cantFail(CtorDtorRunner<LazyEmitLayerT>(std::move(KV.second), KV.first)
+    cantFail(LegacyCtorDtorRunner<LazyEmitLayerT>(std::move(KV.second), KV.first)
                  .runViaLayer(LazyEmitLayer));
 
   CtorDtorsMap.clear();

Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h Mon Oct 15 15:56:10 2018
@@ -461,8 +461,8 @@ private:
     return MangledName;
   }
 
-  using ObjectLayerT = RTDyldObjectLinkingLayer;
-  using CompileLayerT = IRCompileLayer<ObjectLayerT, orc::SimpleCompiler>;
+  using ObjectLayerT = LegacyRTDyldObjectLinkingLayer;
+  using CompileLayerT = LegacyIRCompileLayer<ObjectLayerT, orc::SimpleCompiler>;
   using LazyEmitLayerT = LazyEmittingLayer<CompileLayerT>;
 
   ExecutionSession ES;

Modified: llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp Mon Oct 15 15:56:10 2018
@@ -76,14 +76,14 @@ private:
 namespace llvm {
 namespace orc {
 
-RTDyldObjectLinkingLayer2::RTDyldObjectLinkingLayer2(
+RTDyldObjectLinkingLayer::RTDyldObjectLinkingLayer(
     ExecutionSession &ES, GetMemoryManagerFunction GetMemoryManager,
     NotifyLoadedFunction NotifyLoaded, NotifyEmittedFunction NotifyEmitted)
     : ObjectLayer(ES), GetMemoryManager(GetMemoryManager),
       NotifyLoaded(std::move(NotifyLoaded)),
       NotifyEmitted(std::move(NotifyEmitted)) {}
 
-void RTDyldObjectLinkingLayer2::emit(MaterializationResponsibility R,
+void RTDyldObjectLinkingLayer::emit(MaterializationResponsibility R,
                                      VModuleKey K,
                                      std::unique_ptr<MemoryBuffer> O) {
   assert(O && "Object must not be null");
@@ -153,7 +153,7 @@ void RTDyldObjectLinkingLayer2::emit(Mat
       });
 }
 
-Error RTDyldObjectLinkingLayer2::onObjLoad(
+Error RTDyldObjectLinkingLayer::onObjLoad(
     VModuleKey K, MaterializationResponsibility &R, object::ObjectFile &Obj,
     std::unique_ptr<RuntimeDyld::LoadedObjectInfo> LoadedObjInfo,
     std::map<StringRef, JITEvaluatedSymbol> Resolved,
@@ -196,7 +196,7 @@ Error RTDyldObjectLinkingLayer2::onObjLo
   return Error::success();
 }
 
-void RTDyldObjectLinkingLayer2::onObjEmit(VModuleKey K,
+void RTDyldObjectLinkingLayer::onObjEmit(VModuleKey K,
                                           MaterializationResponsibility &R,
                                           Error Err) {
   if (Err) {

Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Mon Oct 15 15:56:10 2018
@@ -696,7 +696,7 @@ int main(int argc, char **argv, char * c
   return Result;
 }
 
-static orc::IRTransformLayer2::TransformFunction createDebugDumper() {
+static orc::IRTransformLayer::TransformFunction createDebugDumper() {
   switch (OrcDumpKind) {
   case DumpKind::NoDump:
     return [](orc::ThreadSafeModule TSM,
@@ -781,7 +781,7 @@ int runOrcLazyJIT(const char *ProgName)
   auto J = ExitOnErr(orc::LLLazyJIT::Create(std::move(JTMB), DL, LazyJITCompileThreads));
 
   if (PerModuleLazy)
-    J->setPartitionFunction(orc::CompileOnDemandLayer2::compileWholeModule);
+    J->setPartitionFunction(orc::CompileOnDemandLayer::compileWholeModule);
 
   auto Dump = createDebugDumper();
 
@@ -797,7 +797,7 @@ int runOrcLazyJIT(const char *ProgName)
       ExitOnErr(orc::DynamicLibrarySearchGenerator::GetForCurrentProcess(DL)));
 
   orc::MangleAndInterner Mangle(J->getExecutionSession(), DL);
-  orc::LocalCXXRuntimeOverrides2 CXXRuntimeOverrides;
+  orc::LocalCXXRuntimeOverrides CXXRuntimeOverrides;
   ExitOnErr(CXXRuntimeOverrides.enable(J->getMainJITDylib(), Mangle));
 
   // Add the main module.

Modified: llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt Mon Oct 15 15:56:10 2018
@@ -10,7 +10,6 @@ set(LLVM_LINK_COMPONENTS
   )
 
 add_llvm_unittest(OrcJITTests
-  CompileOnDemandLayerTest.cpp
   CoreAPIsTest.cpp
   IndirectionUtilsTest.cpp
   GlobalMappingLayerTest.cpp
@@ -18,6 +17,8 @@ add_llvm_unittest(OrcJITTests
   LazyCallThroughAndReexportsTest.cpp
   LazyEmittingLayerTest.cpp
   LegacyAPIInteropTest.cpp
+  LegacyCompileOnDemandLayerTest.cpp
+  LegacyRTDyldObjectLinkingLayerTest.cpp
   ObjectTransformLayerTest.cpp
   OrcCAPITest.cpp
   OrcTestCommon.cpp
@@ -25,7 +26,6 @@ add_llvm_unittest(OrcJITTests
   RemoteObjectLayerTest.cpp
   RPCUtilsTest.cpp
   RTDyldObjectLinkingLayerTest.cpp
-  RTDyldObjectLinkingLayer2Test.cpp
   SymbolStringPoolTest.cpp
   ThreadSafeModuleTest.cpp
   )

Removed: llvm/trunk/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp?rev=344571&view=auto
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp (removed)
@@ -1,89 +0,0 @@
-//===----- CompileOnDemandLayerTest.cpp - Unit tests for the COD layer ----===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h"
-#include "OrcTestCommon.h"
-#include "gtest/gtest.h"
-
-using namespace llvm;
-using namespace llvm::orc;
-
-namespace {
-
-class DummyTrampolinePool : public orc::TrampolinePool {
-public:
-  Expected<JITTargetAddress> getTrampoline() {
-    llvm_unreachable("Unimplemented");
-  }
-};
-
-class DummyCallbackManager : public JITCompileCallbackManager {
-public:
-  DummyCallbackManager(ExecutionSession &ES)
-      : JITCompileCallbackManager(llvm::make_unique<DummyTrampolinePool>(), ES,
-                                  0) {}
-};
-
-class DummyStubsManager : public orc::IndirectStubsManager {
-public:
-  Error createStub(StringRef StubName, JITTargetAddress InitAddr,
-                   JITSymbolFlags Flags) override {
-    llvm_unreachable("Not implemented");
-  }
-
-  Error createStubs(const StubInitsMap &StubInits) override {
-    llvm_unreachable("Not implemented");
-  }
-
-  JITEvaluatedSymbol findStub(StringRef Name, bool ExportedStubsOnly) override {
-    llvm_unreachable("Not implemented");
-  }
-
-  JITEvaluatedSymbol findPointer(StringRef Name) override {
-    llvm_unreachable("Not implemented");
-  }
-
-  Error updatePointer(StringRef Name, JITTargetAddress NewAddr) override {
-    llvm_unreachable("Not implemented");
-  }
-};
-
-TEST(CompileOnDemandLayerTest, FindSymbol) {
-  MockBaseLayer<int, std::shared_ptr<Module>> TestBaseLayer;
-  TestBaseLayer.findSymbolImpl =
-    [](const std::string &Name, bool) {
-      if (Name == "foo")
-        return JITSymbol(1, JITSymbolFlags::Exported);
-      return JITSymbol(nullptr);
-    };
-
-
-  ExecutionSession ES(std::make_shared<SymbolStringPool>());
-  DummyCallbackManager CallbackMgr(ES);
-
-  auto GetResolver =
-      [](orc::VModuleKey) -> std::shared_ptr<llvm::orc::SymbolResolver> {
-    llvm_unreachable("Should never be called");
-  };
-
-  auto SetResolver = [](orc::VModuleKey, std::shared_ptr<orc::SymbolResolver>) {
-    llvm_unreachable("Should never be called");
-  };
-
-  llvm::orc::CompileOnDemandLayer<decltype(TestBaseLayer)> COD(
-      ES, TestBaseLayer, GetResolver, SetResolver,
-      [](Function &F) { return std::set<Function *>{&F}; }, CallbackMgr,
-      [] { return llvm::make_unique<DummyStubsManager>(); }, true);
-
-  auto Sym = COD.findSymbol("foo", true);
-
-  EXPECT_TRUE(!!Sym) << "CompileOnDemand::findSymbol should call findSymbol in "
-                        "the base layer.";
-}
-}

Copied: llvm/trunk/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp (from r344569, llvm/trunk/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp?p2=llvm/trunk/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp&p1=llvm/trunk/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp&r1=344569&r2=344572&rev=344572&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/CompileOnDemandLayerTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp Mon Oct 15 15:56:10 2018
@@ -54,7 +54,7 @@ public:
   }
 };
 
-TEST(CompileOnDemandLayerTest, FindSymbol) {
+TEST(LegacyCompileOnDemandLayerTest, FindSymbol) {
   MockBaseLayer<int, std::shared_ptr<Module>> TestBaseLayer;
   TestBaseLayer.findSymbolImpl =
     [](const std::string &Name, bool) {
@@ -76,7 +76,7 @@ TEST(CompileOnDemandLayerTest, FindSymbo
     llvm_unreachable("Should never be called");
   };
 
-  llvm::orc::CompileOnDemandLayer<decltype(TestBaseLayer)> COD(
+  llvm::orc::LegacyCompileOnDemandLayer<decltype(TestBaseLayer)> COD(
       ES, TestBaseLayer, GetResolver, SetResolver,
       [](Function &F) { return std::set<Function *>{&F}; }, CallbackMgr,
       [] { return llvm::make_unique<DummyStubsManager>(); }, true);

Copied: llvm/trunk/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp (from r344569, llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp?p2=llvm/trunk/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp&p1=llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp&r1=344569&r2=344572&rev=344572&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp Mon Oct 15 15:56:10 2018
@@ -24,7 +24,7 @@ using namespace llvm::orc;
 
 namespace {
 
-class RTDyldObjectLinkingLayerExecutionTest : public testing::Test,
+class LegacyRTDyldObjectLinkingLayerExecutionTest : public testing::Test,
                                               public OrcExecutionTest {
 
 };
@@ -45,7 +45,7 @@ public:
   }
 };
 
-TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
+TEST(LegacyRTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
   class MemoryManagerWrapper : public SectionMemoryManager {
   public:
     MemoryManagerWrapper(bool &DebugSeen) : DebugSeen(DebugSeen) {}
@@ -69,8 +69,8 @@ TEST(RTDyldObjectLinkingLayerTest, TestS
 
   ExecutionSession ES;
 
-  RTDyldObjectLinkingLayer ObjLayer(ES, [&MM](VModuleKey) {
-    return RTDyldObjectLinkingLayer::Resources{
+  LegacyRTDyldObjectLinkingLayer ObjLayer(ES, [&MM](VModuleKey) {
+    return LegacyRTDyldObjectLinkingLayer::Resources{
         MM, std::make_shared<NullResolver>()};
   });
 
@@ -119,7 +119,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestS
   }
 }
 
-TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
+TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
   if (!SupportsJIT)
     return;
 
@@ -129,12 +129,12 @@ TEST_F(RTDyldObjectLinkingLayerExecution
 
   std::map<orc::VModuleKey, std::shared_ptr<orc::SymbolResolver>> Resolvers;
 
-  RTDyldObjectLinkingLayer ObjLayer(ES, [&](VModuleKey K) {
+  LegacyRTDyldObjectLinkingLayer ObjLayer(ES, [&](VModuleKey K) {
     auto I = Resolvers.find(K);
     assert(I != Resolvers.end() && "Missing resolver");
     auto R = std::move(I->second);
     Resolvers.erase(I);
-    return RTDyldObjectLinkingLayer::Resources{MM, std::move(R)};
+    return LegacyRTDyldObjectLinkingLayer::Resources{MM, std::move(R)};
   });
   SimpleCompiler Compile(*TM);
 
@@ -203,7 +203,7 @@ TEST_F(RTDyldObjectLinkingLayerExecution
       << "Extra call to finalize";
 }
 
-TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
+TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
   if (!SupportsJIT)
     return;
 
@@ -211,8 +211,8 @@ TEST_F(RTDyldObjectLinkingLayerExecution
 
   auto MM = std::make_shared<SectionMemoryManagerWrapper>();
 
-  RTDyldObjectLinkingLayer ObjLayer(ES, [&MM](VModuleKey K) {
-    return RTDyldObjectLinkingLayer::Resources{
+  LegacyRTDyldObjectLinkingLayer ObjLayer(ES, [&MM](VModuleKey K) {
+    return LegacyRTDyldObjectLinkingLayer::Resources{
         MM, std::make_shared<NullResolver>()};
   });
   SimpleCompiler Compile(*TM);
@@ -267,12 +267,12 @@ TEST_F(RTDyldObjectLinkingLayerExecution
          "(multiple unrelated objects loaded prior to finalization)";
 }
 
-TEST_F(RTDyldObjectLinkingLayerExecutionTest, TestNotifyLoadedSignature) {
+TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, TestNotifyLoadedSignature) {
   ExecutionSession ES;
-  RTDyldObjectLinkingLayer ObjLayer(
+  LegacyRTDyldObjectLinkingLayer ObjLayer(
       ES,
       [](VModuleKey) {
-        return RTDyldObjectLinkingLayer::Resources{
+        return LegacyRTDyldObjectLinkingLayer::Resources{
             nullptr, std::make_shared<NullResolver>()};
       },
       [](VModuleKey, const object::ObjectFile &obj,

Modified: llvm/trunk/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp Mon Oct 15 15:56:10 2018
@@ -175,19 +175,19 @@ private:
   }
 };
 
-// Test each operation on ObjectTransformLayer.
-TEST(ObjectTransformLayerTest, Main) {
+// Test each operation on LegacyObjectTransformLayer.
+TEST(LegacyObjectTransformLayerTest, Main) {
   MockBaseLayer M;
 
   ExecutionSession ES(std::make_shared<SymbolStringPool>());
 
   // Create one object transform layer using a transform (as a functor)
   // that allocates new objects, and deals in unique pointers.
-  ObjectTransformLayer<MockBaseLayer, AllocatingTransform> T1(M);
+  LegacyObjectTransformLayer<MockBaseLayer, AllocatingTransform> T1(M);
 
   // Create a second object transform layer using a transform (as a lambda)
   // that mutates objects in place, and deals in naked pointers
-  ObjectTransformLayer<MockBaseLayer,
+  LegacyObjectTransformLayer<MockBaseLayer,
                          std::function<std::shared_ptr<MockObjectFile>(
                            std::shared_ptr<MockObjectFile>)>>
     T2(M, [](std::shared_ptr<MockObjectFile> Obj) {
@@ -257,9 +257,9 @@ TEST(ObjectTransformLayerTest, Main) {
   if (!RunStaticChecks)
     return;
 
-  // Make sure that ObjectTransformLayer implements the object layer concept
+  // Make sure that LegacyObjectTransformLayer implements the object layer concept
   // correctly by sandwitching one between an ObjectLinkingLayer and an
-  // IRCompileLayer, verifying that it compiles if we have a call to the
+  // LegacyIRCompileLayer, verifying that it compiles if we have a call to the
   // IRComileLayer's addModule that should call the transform layer's
   // addObject, and also calling the other public transform layer methods
   // directly to make sure the methods they intend to forward to exist on
@@ -282,8 +282,8 @@ TEST(ObjectTransformLayerTest, Main) {
   };
 
   // Construct the jit layers.
-  RTDyldObjectLinkingLayer BaseLayer(ES, [](VModuleKey) {
-    return RTDyldObjectLinkingLayer::Resources{
+  LegacyRTDyldObjectLinkingLayer BaseLayer(ES, [](VModuleKey) {
+    return LegacyRTDyldObjectLinkingLayer::Resources{
         std::make_shared<llvm::SectionMemoryManager>(),
         std::make_shared<NullResolver>()};
   });
@@ -291,20 +291,20 @@ TEST(ObjectTransformLayerTest, Main) {
   auto IdentityTransform = [](std::unique_ptr<llvm::MemoryBuffer> Obj) {
     return Obj;
   };
-  ObjectTransformLayer<decltype(BaseLayer), decltype(IdentityTransform)>
+  LegacyObjectTransformLayer<decltype(BaseLayer), decltype(IdentityTransform)>
       TransformLayer(BaseLayer, IdentityTransform);
   auto NullCompiler = [](llvm::Module &) {
     return std::unique_ptr<llvm::MemoryBuffer>(nullptr);
   };
-  IRCompileLayer<decltype(TransformLayer), decltype(NullCompiler)>
+  LegacyIRCompileLayer<decltype(TransformLayer), decltype(NullCompiler)>
     CompileLayer(TransformLayer, NullCompiler);
 
-  // Make sure that the calls from IRCompileLayer to ObjectTransformLayer
+  // Make sure that the calls from LegacyIRCompileLayer to LegacyObjectTransformLayer
   // compile.
   cantFail(CompileLayer.addModule(ES.allocateVModule(),
                                   std::unique_ptr<llvm::Module>()));
 
-  // Make sure that the calls from ObjectTransformLayer to ObjectLinkingLayer
+  // Make sure that the calls from LegacyObjectTransformLayer to ObjectLinkingLayer
   // compile.
   VModuleKey DummyKey = ES.allocateVModule();
   cantFail(TransformLayer.emitAndFinalize(DummyKey));

Removed: llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayer2Test.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayer2Test.cpp?rev=344571&view=auto
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayer2Test.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayer2Test.cpp (removed)
@@ -1,228 +0,0 @@
-//===--- RTDyldObjectLinkingLayer2Test.cpp - RTDyld linking layer tests ---===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "OrcTestCommon.h"
-#include "llvm/ExecutionEngine/ExecutionEngine.h"
-#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
-#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
-#include "llvm/ExecutionEngine/Orc/LambdaResolver.h"
-#include "llvm/ExecutionEngine/Orc/Legacy.h"
-#include "llvm/ExecutionEngine/Orc/NullResolver.h"
-#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
-#include "llvm/ExecutionEngine/SectionMemoryManager.h"
-#include "llvm/IR/Constants.h"
-#include "llvm/IR/LLVMContext.h"
-#include "gtest/gtest.h"
-
-using namespace llvm;
-using namespace llvm::orc;
-
-namespace {
-
-class RTDyldObjectLinkingLayer2ExecutionTest : public testing::Test,
-                                               public OrcExecutionTest {};
-
-// Adds an object with a debug section to RuntimeDyld and then returns whether
-// the debug section was passed to the memory manager.
-static bool testSetProcessAllSections(std::unique_ptr<MemoryBuffer> Obj,
-                                      bool ProcessAllSections) {
-  class MemoryManagerWrapper : public SectionMemoryManager {
-  public:
-    MemoryManagerWrapper(bool &DebugSeen) : DebugSeen(DebugSeen) {}
-    uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
-                                 unsigned SectionID, StringRef SectionName,
-                                 bool IsReadOnly) override {
-      if (SectionName == ".debug_str")
-        DebugSeen = true;
-      return SectionMemoryManager::allocateDataSection(
-          Size, Alignment, SectionID, SectionName, IsReadOnly);
-    }
-
-  private:
-    bool &DebugSeen;
-  };
-
-  bool DebugSectionSeen = false;
-
-  ExecutionSession ES;
-  auto &JD = ES.createJITDylib("main");
-  auto Foo = ES.intern("foo");
-
-  RTDyldObjectLinkingLayer2 ObjLayer(ES, [&DebugSectionSeen](VModuleKey) {
-    return llvm::make_unique<MemoryManagerWrapper>(DebugSectionSeen);
-  });
-
-  auto OnResolveDoNothing = [](Expected<SymbolMap> R) {
-    cantFail(std::move(R));
-  };
-
-  auto OnReadyDoNothing = [](Error Err) { cantFail(std::move(Err)); };
-
-  ObjLayer.setProcessAllSections(ProcessAllSections);
-  auto K = ES.allocateVModule();
-  cantFail(ObjLayer.add(JD, K, std::move(Obj)));
-  ES.lookup({&JD}, {Foo}, OnResolveDoNothing, OnReadyDoNothing,
-            NoDependenciesToRegister);
-  return DebugSectionSeen;
-}
-
-TEST(RTDyldObjectLinkingLayer2Test, TestSetProcessAllSections) {
-  LLVMContext Context;
-  auto M = llvm::make_unique<Module>("", Context);
-  M->setTargetTriple("x86_64-unknown-linux-gnu");
-  Type *Int32Ty = IntegerType::get(Context, 32);
-  GlobalVariable *GV =
-      new GlobalVariable(*M, Int32Ty, false, GlobalValue::ExternalLinkage,
-                         ConstantInt::get(Int32Ty, 42), "foo");
-
-  GV->setSection(".debug_str");
-
-  // Initialize the native target in case this is the first unit test
-  // to try to build a TM.
-  OrcNativeTarget::initialize();
-  std::unique_ptr<TargetMachine> TM(EngineBuilder().selectTarget(
-      Triple(M->getTargetTriple()), "", "", SmallVector<std::string, 1>()));
-  if (!TM)
-    return;
-
-  auto Obj = SimpleCompiler(*TM)(*M);
-
-  EXPECT_FALSE(testSetProcessAllSections(
-      MemoryBuffer::getMemBufferCopy(Obj->getBuffer()), false))
-      << "Debug section seen despite ProcessAllSections being false";
-  EXPECT_TRUE(testSetProcessAllSections(std::move(Obj), true))
-      << "Expected to see debug section when ProcessAllSections is true";
-}
-
-TEST(RTDyldObjectLinkingLayer2Test, TestOverrideObjectFlags) {
-
-  OrcNativeTarget::initialize();
-
-  std::unique_ptr<TargetMachine> TM(
-      EngineBuilder().selectTarget(Triple("x86_64-unknown-linux-gnu"), "", "",
-                                   SmallVector<std::string, 1>()));
-
-  if (!TM)
-    return;
-
-  // Our compiler is going to modify symbol visibility settings without telling
-  // ORC. This will test our ability to override the flags later.
-  class FunkySimpleCompiler : public SimpleCompiler {
-  public:
-    FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {}
-
-    CompileResult operator()(Module &M) {
-      auto *Foo = M.getFunction("foo");
-      assert(Foo && "Expected function Foo not found");
-      Foo->setVisibility(GlobalValue::HiddenVisibility);
-      return SimpleCompiler::operator()(M);
-    }
-  };
-
-  // Create a module with two void() functions: foo and bar.
-  ThreadSafeContext TSCtx(llvm::make_unique<LLVMContext>());
-  ThreadSafeModule M;
-  {
-    ModuleBuilder MB(*TSCtx.getContext(), TM->getTargetTriple().str(), "dummy");
-    MB.getModule()->setDataLayout(TM->createDataLayout());
-
-    Function *FooImpl = MB.createFunctionDecl<void()>("foo");
-    BasicBlock *FooEntry =
-        BasicBlock::Create(*TSCtx.getContext(), "entry", FooImpl);
-    IRBuilder<> B1(FooEntry);
-    B1.CreateRetVoid();
-
-    Function *BarImpl = MB.createFunctionDecl<void()>("bar");
-    BasicBlock *BarEntry =
-        BasicBlock::Create(*TSCtx.getContext(), "entry", BarImpl);
-    IRBuilder<> B2(BarEntry);
-    B2.CreateRetVoid();
-
-    M = ThreadSafeModule(MB.takeModule(), std::move(TSCtx));
-  }
-
-  // Create a simple stack and set the override flags option.
-  ExecutionSession ES;
-  auto &JD = ES.createJITDylib("main");
-  auto Foo = ES.intern("foo");
-  RTDyldObjectLinkingLayer2 ObjLayer(
-      ES, [](VModuleKey) { return llvm::make_unique<SectionMemoryManager>(); });
-  IRCompileLayer2 CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM));
-
-  ObjLayer.setOverrideObjectFlagsWithResponsibilityFlags(true);
-
-  cantFail(CompileLayer.add(JD, ES.allocateVModule(), std::move(M)));
-  ES.lookup({&JD}, {Foo}, [](Expected<SymbolMap> R) { cantFail(std::move(R)); },
-            [](Error Err) { cantFail(std::move(Err)); },
-            NoDependenciesToRegister);
-}
-
-TEST(RTDyldObjectLinkingLayer2Test, TestAutoClaimResponsibilityForSymbols) {
-
-  OrcNativeTarget::initialize();
-
-  std::unique_ptr<TargetMachine> TM(
-      EngineBuilder().selectTarget(Triple("x86_64-unknown-linux-gnu"), "", "",
-                                   SmallVector<std::string, 1>()));
-
-  if (!TM)
-    return;
-
-  // Our compiler is going to add a new symbol without telling ORC.
-  // This will test our ability to auto-claim responsibility later.
-  class FunkySimpleCompiler : public SimpleCompiler {
-  public:
-    FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {}
-
-    CompileResult operator()(Module &M) {
-      Function *BarImpl =
-          Function::Create(TypeBuilder<void(), false>::get(M.getContext()),
-                           GlobalValue::ExternalLinkage, "bar", &M);
-      BasicBlock *BarEntry =
-          BasicBlock::Create(M.getContext(), "entry", BarImpl);
-      IRBuilder<> B(BarEntry);
-      B.CreateRetVoid();
-
-      return SimpleCompiler::operator()(M);
-    }
-  };
-
-  // Create a module with two void() functions: foo and bar.
-  ThreadSafeContext TSCtx(llvm::make_unique<LLVMContext>());
-  ThreadSafeModule M;
-  {
-    ModuleBuilder MB(*TSCtx.getContext(), TM->getTargetTriple().str(), "dummy");
-    MB.getModule()->setDataLayout(TM->createDataLayout());
-
-    Function *FooImpl = MB.createFunctionDecl<void()>("foo");
-    BasicBlock *FooEntry =
-        BasicBlock::Create(*TSCtx.getContext(), "entry", FooImpl);
-    IRBuilder<> B(FooEntry);
-    B.CreateRetVoid();
-
-    M = ThreadSafeModule(MB.takeModule(), std::move(TSCtx));
-  }
-
-  // Create a simple stack and set the override flags option.
-  ExecutionSession ES;
-  auto &JD = ES.createJITDylib("main");
-  auto Foo = ES.intern("foo");
-  RTDyldObjectLinkingLayer2 ObjLayer(
-      ES, [](VModuleKey) { return llvm::make_unique<SectionMemoryManager>(); });
-  IRCompileLayer2 CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM));
-
-  ObjLayer.setAutoClaimResponsibilityForObjectSymbols(true);
-
-  cantFail(CompileLayer.add(JD, ES.allocateVModule(), std::move(M)));
-  ES.lookup({&JD}, {Foo}, [](Expected<SymbolMap> R) { cantFail(std::move(R)); },
-            [](Error Err) { cantFail(std::move(Err)); },
-            NoDependenciesToRegister);
-}
-
-} // end anonymous namespace

Modified: llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp?rev=344572&r1=344571&r2=344572&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp Mon Oct 15 15:56:10 2018
@@ -1,4 +1,4 @@
-//===- RTDyldObjectLinkingLayerTest.cpp - RTDyld linking layer unit tests -===//
+//===--- RTDyldObjectLinkingLayerTest.cpp - RTDyld linking layer tests ---===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,13 +7,14 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
 #include "OrcTestCommon.h"
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
 #include "llvm/ExecutionEngine/Orc/CompileUtils.h"
+#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
 #include "llvm/ExecutionEngine/Orc/LambdaResolver.h"
 #include "llvm/ExecutionEngine/Orc/Legacy.h"
 #include "llvm/ExecutionEngine/Orc/NullResolver.h"
+#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/LLVMContext.h"
@@ -25,258 +26,203 @@ using namespace llvm::orc;
 namespace {
 
 class RTDyldObjectLinkingLayerExecutionTest : public testing::Test,
-                                              public OrcExecutionTest {
-
-};
-
-class SectionMemoryManagerWrapper : public SectionMemoryManager {
-public:
-  int FinalizationCount = 0;
-  int NeedsToReserveAllocationSpaceCount = 0;
-
-  bool needsToReserveAllocationSpace() override {
-    ++NeedsToReserveAllocationSpaceCount;
-    return SectionMemoryManager::needsToReserveAllocationSpace();
-  }
-
-  bool finalizeMemory(std::string *ErrMsg = nullptr) override {
-    ++FinalizationCount;
-    return SectionMemoryManager::finalizeMemory(ErrMsg);
-  }
-};
+                                               public OrcExecutionTest {};
 
-TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
+// Adds an object with a debug section to RuntimeDyld and then returns whether
+// the debug section was passed to the memory manager.
+static bool testSetProcessAllSections(std::unique_ptr<MemoryBuffer> Obj,
+                                      bool ProcessAllSections) {
   class MemoryManagerWrapper : public SectionMemoryManager {
   public:
     MemoryManagerWrapper(bool &DebugSeen) : DebugSeen(DebugSeen) {}
     uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
-                                 unsigned SectionID,
-                                 StringRef SectionName,
+                                 unsigned SectionID, StringRef SectionName,
                                  bool IsReadOnly) override {
       if (SectionName == ".debug_str")
         DebugSeen = true;
-      return SectionMemoryManager::allocateDataSection(Size, Alignment,
-                                                         SectionID,
-                                                         SectionName,
-                                                         IsReadOnly);
+      return SectionMemoryManager::allocateDataSection(
+          Size, Alignment, SectionID, SectionName, IsReadOnly);
     }
+
   private:
     bool &DebugSeen;
   };
 
   bool DebugSectionSeen = false;
-  auto MM = std::make_shared<MemoryManagerWrapper>(DebugSectionSeen);
 
   ExecutionSession ES;
+  auto &JD = ES.createJITDylib("main");
+  auto Foo = ES.intern("foo");
 
-  RTDyldObjectLinkingLayer ObjLayer(ES, [&MM](VModuleKey) {
-    return RTDyldObjectLinkingLayer::Resources{
-        MM, std::make_shared<NullResolver>()};
+  RTDyldObjectLinkingLayer ObjLayer(ES, [&DebugSectionSeen](VModuleKey) {
+    return llvm::make_unique<MemoryManagerWrapper>(DebugSectionSeen);
   });
 
+  auto OnResolveDoNothing = [](Expected<SymbolMap> R) {
+    cantFail(std::move(R));
+  };
+
+  auto OnReadyDoNothing = [](Error Err) { cantFail(std::move(Err)); };
+
+  ObjLayer.setProcessAllSections(ProcessAllSections);
+  auto K = ES.allocateVModule();
+  cantFail(ObjLayer.add(JD, K, std::move(Obj)));
+  ES.lookup({&JD}, {Foo}, OnResolveDoNothing, OnReadyDoNothing,
+            NoDependenciesToRegister);
+  return DebugSectionSeen;
+}
+
+TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
   LLVMContext Context;
   auto M = llvm::make_unique<Module>("", Context);
   M->setTargetTriple("x86_64-unknown-linux-gnu");
   Type *Int32Ty = IntegerType::get(Context, 32);
   GlobalVariable *GV =
-    new GlobalVariable(*M, Int32Ty, false, GlobalValue::ExternalLinkage,
+      new GlobalVariable(*M, Int32Ty, false, GlobalValue::ExternalLinkage,
                          ConstantInt::get(Int32Ty, 42), "foo");
 
   GV->setSection(".debug_str");
 
-
   // Initialize the native target in case this is the first unit test
   // to try to build a TM.
   OrcNativeTarget::initialize();
-  std::unique_ptr<TargetMachine> TM(
-    EngineBuilder().selectTarget(Triple(M->getTargetTriple()), "", "",
-                                 SmallVector<std::string, 1>()));
+  std::unique_ptr<TargetMachine> TM(EngineBuilder().selectTarget(
+      Triple(M->getTargetTriple()), "", "", SmallVector<std::string, 1>()));
   if (!TM)
     return;
 
   auto Obj = SimpleCompiler(*TM)(*M);
 
-  {
-    // Test with ProcessAllSections = false (the default).
-    auto K = ES.allocateVModule();
-    cantFail(ObjLayer.addObject(
-        K, MemoryBuffer::getMemBufferCopy(Obj->getBuffer())));
-    cantFail(ObjLayer.emitAndFinalize(K));
-    EXPECT_EQ(DebugSectionSeen, false)
-      << "Unexpected debug info section";
-    cantFail(ObjLayer.removeObject(K));
-  }
-
-  {
-    // Test with ProcessAllSections = true.
-    ObjLayer.setProcessAllSections(true);
-    auto K = ES.allocateVModule();
-    cantFail(ObjLayer.addObject(K, std::move(Obj)));
-    cantFail(ObjLayer.emitAndFinalize(K));
-    EXPECT_EQ(DebugSectionSeen, true)
-      << "Expected debug info section not seen";
-    cantFail(ObjLayer.removeObject(K));
-  }
+  EXPECT_FALSE(testSetProcessAllSections(
+      MemoryBuffer::getMemBufferCopy(Obj->getBuffer()), false))
+      << "Debug section seen despite ProcessAllSections being false";
+  EXPECT_TRUE(testSetProcessAllSections(std::move(Obj), true))
+      << "Expected to see debug section when ProcessAllSections is true";
 }
 
-TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
-  if (!SupportsJIT)
-    return;
+TEST(RTDyldObjectLinkingLayerTest, TestOverrideObjectFlags) {
 
-  ExecutionSession ES;
+  OrcNativeTarget::initialize();
 
-  auto MM = std::make_shared<SectionMemoryManagerWrapper>();
+  std::unique_ptr<TargetMachine> TM(
+      EngineBuilder().selectTarget(Triple("x86_64-unknown-linux-gnu"), "", "",
+                                   SmallVector<std::string, 1>()));
 
-  std::map<orc::VModuleKey, std::shared_ptr<orc::SymbolResolver>> Resolvers;
+  if (!TM)
+    return;
 
-  RTDyldObjectLinkingLayer ObjLayer(ES, [&](VModuleKey K) {
-    auto I = Resolvers.find(K);
-    assert(I != Resolvers.end() && "Missing resolver");
-    auto R = std::move(I->second);
-    Resolvers.erase(I);
-    return RTDyldObjectLinkingLayer::Resources{MM, std::move(R)};
-  });
-  SimpleCompiler Compile(*TM);
+  // Our compiler is going to modify symbol visibility settings without telling
+  // ORC. This will test our ability to override the flags later.
+  class FunkySimpleCompiler : public SimpleCompiler {
+  public:
+    FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {}
 
-  // Create a pair of modules that will trigger recursive finalization:
-  // Module 1:
-  //   int bar() { return 42; }
-  // Module 2:
-  //   int bar();
-  //   int foo() { return bar(); }
-  //
-  // Verify that the memory manager is only finalized once (for Module 2).
-  // Failure suggests that finalize is being called on the inner RTDyld
-  // instance (for Module 1) which is unsafe, as it will prevent relocation of
-  // Module 2.
+    CompileResult operator()(Module &M) {
+      auto *Foo = M.getFunction("foo");
+      assert(Foo && "Expected function Foo not found");
+      Foo->setVisibility(GlobalValue::HiddenVisibility);
+      return SimpleCompiler::operator()(M);
+    }
+  };
 
-  ModuleBuilder MB1(Context, "", "dummy");
+  // Create a module with two void() functions: foo and bar.
+  ThreadSafeContext TSCtx(llvm::make_unique<LLVMContext>());
+  ThreadSafeModule M;
   {
-    MB1.getModule()->setDataLayout(TM->createDataLayout());
-    Function *BarImpl = MB1.createFunctionDecl<int32_t(void)>("bar");
-    BasicBlock *BarEntry = BasicBlock::Create(Context, "entry", BarImpl);
-    IRBuilder<> Builder(BarEntry);
-    IntegerType *Int32Ty = IntegerType::get(Context, 32);
-    Value *FourtyTwo = ConstantInt::getSigned(Int32Ty, 42);
-    Builder.CreateRet(FourtyTwo);
-  }
+    ModuleBuilder MB(*TSCtx.getContext(), TM->getTargetTriple().str(), "dummy");
+    MB.getModule()->setDataLayout(TM->createDataLayout());
 
-  auto Obj1 = Compile(*MB1.getModule());
+    Function *FooImpl = MB.createFunctionDecl<void()>("foo");
+    BasicBlock *FooEntry =
+        BasicBlock::Create(*TSCtx.getContext(), "entry", FooImpl);
+    IRBuilder<> B1(FooEntry);
+    B1.CreateRetVoid();
 
-  ModuleBuilder MB2(Context, "", "dummy");
-  {
-    MB2.getModule()->setDataLayout(TM->createDataLayout());
-    Function *BarDecl = MB2.createFunctionDecl<int32_t(void)>("bar");
-    Function *FooImpl = MB2.createFunctionDecl<int32_t(void)>("foo");
-    BasicBlock *FooEntry = BasicBlock::Create(Context, "entry", FooImpl);
-    IRBuilder<> Builder(FooEntry);
-    Builder.CreateRet(Builder.CreateCall(BarDecl));
+    Function *BarImpl = MB.createFunctionDecl<void()>("bar");
+    BasicBlock *BarEntry =
+        BasicBlock::Create(*TSCtx.getContext(), "entry", BarImpl);
+    IRBuilder<> B2(BarEntry);
+    B2.CreateRetVoid();
+
+    M = ThreadSafeModule(MB.takeModule(), std::move(TSCtx));
   }
-  auto Obj2 = Compile(*MB2.getModule());
 
-  auto K1 = ES.allocateVModule();
-  Resolvers[K1] = std::make_shared<NullResolver>();
-  cantFail(ObjLayer.addObject(K1, std::move(Obj1)));
-
-  auto K2 = ES.allocateVModule();
-  auto LegacyLookup = [&](const std::string &Name) {
-    return ObjLayer.findSymbol(Name, true);
-  };
+  // Create a simple stack and set the override flags option.
+  ExecutionSession ES;
+  auto &JD = ES.createJITDylib("main");
+  auto Foo = ES.intern("foo");
+  RTDyldObjectLinkingLayer ObjLayer(
+      ES, [](VModuleKey) { return llvm::make_unique<SectionMemoryManager>(); });
+  IRCompileLayer CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM));
+
+  ObjLayer.setOverrideObjectFlagsWithResponsibilityFlags(true);
 
-  Resolvers[K2] = createSymbolResolver(
-      [&](const SymbolNameSet &Symbols) {
-        return cantFail(
-            getResponsibilitySetWithLegacyFn(Symbols, LegacyLookup));
-      },
-      [&](std::shared_ptr<AsynchronousSymbolQuery> Query,
-          const SymbolNameSet &Symbols) {
-        return lookupWithLegacyFn(ES, *Query, Symbols, LegacyLookup);
-      });
-
-  cantFail(ObjLayer.addObject(K2, std::move(Obj2)));
-  cantFail(ObjLayer.emitAndFinalize(K2));
-  cantFail(ObjLayer.removeObject(K2));
-
-  // Finalization of module 2 should trigger finalization of module 1.
-  // Verify that finalize on SMMW is only called once.
-  EXPECT_EQ(MM->FinalizationCount, 1)
-      << "Extra call to finalize";
+  cantFail(CompileLayer.add(JD, ES.allocateVModule(), std::move(M)));
+  ES.lookup({&JD}, {Foo}, [](Expected<SymbolMap> R) { cantFail(std::move(R)); },
+            [](Error Err) { cantFail(std::move(Err)); },
+            NoDependenciesToRegister);
 }
 
-TEST_F(RTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
-  if (!SupportsJIT)
-    return;
+TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) {
 
-  ExecutionSession ES;
+  OrcNativeTarget::initialize();
 
-  auto MM = std::make_shared<SectionMemoryManagerWrapper>();
+  std::unique_ptr<TargetMachine> TM(
+      EngineBuilder().selectTarget(Triple("x86_64-unknown-linux-gnu"), "", "",
+                                   SmallVector<std::string, 1>()));
 
-  RTDyldObjectLinkingLayer ObjLayer(ES, [&MM](VModuleKey K) {
-    return RTDyldObjectLinkingLayer::Resources{
-        MM, std::make_shared<NullResolver>()};
-  });
-  SimpleCompiler Compile(*TM);
+  if (!TM)
+    return;
 
-  // Create a pair of unrelated modules:
-  //
-  // Module 1:
-  //   int foo() { return 42; }
-  // Module 2:
-  //   int bar() { return 7; }
-  //
-  // Both modules will share a memory manager. We want to verify that the
-  // second object is not loaded before the first one is finalized. To do this
-  // in a portable way, we abuse the
-  // RuntimeDyld::MemoryManager::needsToReserveAllocationSpace hook, which is
-  // called once per object before any sections are allocated.
+  // Our compiler is going to add a new symbol without telling ORC.
+  // This will test our ability to auto-claim responsibility later.
+  class FunkySimpleCompiler : public SimpleCompiler {
+  public:
+    FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {}
 
-  ModuleBuilder MB1(Context, "", "dummy");
-  {
-    MB1.getModule()->setDataLayout(TM->createDataLayout());
-    Function *BarImpl = MB1.createFunctionDecl<int32_t(void)>("foo");
-    BasicBlock *BarEntry = BasicBlock::Create(Context, "entry", BarImpl);
-    IRBuilder<> Builder(BarEntry);
-    IntegerType *Int32Ty = IntegerType::get(Context, 32);
-    Value *FourtyTwo = ConstantInt::getSigned(Int32Ty, 42);
-    Builder.CreateRet(FourtyTwo);
-  }
+    CompileResult operator()(Module &M) {
+      Function *BarImpl =
+          Function::Create(TypeBuilder<void(), false>::get(M.getContext()),
+                           GlobalValue::ExternalLinkage, "bar", &M);
+      BasicBlock *BarEntry =
+          BasicBlock::Create(M.getContext(), "entry", BarImpl);
+      IRBuilder<> B(BarEntry);
+      B.CreateRetVoid();
 
-  auto Obj1 = Compile(*MB1.getModule());
+      return SimpleCompiler::operator()(M);
+    }
+  };
 
-  ModuleBuilder MB2(Context, "", "dummy");
+  // Create a module with two void() functions: foo and bar.
+  ThreadSafeContext TSCtx(llvm::make_unique<LLVMContext>());
+  ThreadSafeModule M;
   {
-    MB2.getModule()->setDataLayout(TM->createDataLayout());
-    Function *BarImpl = MB2.createFunctionDecl<int32_t(void)>("bar");
-    BasicBlock *BarEntry = BasicBlock::Create(Context, "entry", BarImpl);
-    IRBuilder<> Builder(BarEntry);
-    IntegerType *Int32Ty = IntegerType::get(Context, 32);
-    Value *Seven = ConstantInt::getSigned(Int32Ty, 7);
-    Builder.CreateRet(Seven);
-  }
-  auto Obj2 = Compile(*MB2.getModule());
+    ModuleBuilder MB(*TSCtx.getContext(), TM->getTargetTriple().str(), "dummy");
+    MB.getModule()->setDataLayout(TM->createDataLayout());
 
-  auto K = ES.allocateVModule();
-  cantFail(ObjLayer.addObject(K, std::move(Obj1)));
-  cantFail(ObjLayer.addObject(ES.allocateVModule(), std::move(Obj2)));
-  cantFail(ObjLayer.emitAndFinalize(K));
-  cantFail(ObjLayer.removeObject(K));
-
-  // Only one call to needsToReserveAllocationSpace should have been made.
-  EXPECT_EQ(MM->NeedsToReserveAllocationSpaceCount, 1)
-      << "More than one call to needsToReserveAllocationSpace "
-         "(multiple unrelated objects loaded prior to finalization)";
-}
+    Function *FooImpl = MB.createFunctionDecl<void()>("foo");
+    BasicBlock *FooEntry =
+        BasicBlock::Create(*TSCtx.getContext(), "entry", FooImpl);
+    IRBuilder<> B(FooEntry);
+    B.CreateRetVoid();
 
-TEST_F(RTDyldObjectLinkingLayerExecutionTest, TestNotifyLoadedSignature) {
+    M = ThreadSafeModule(MB.takeModule(), std::move(TSCtx));
+  }
+
+  // Create a simple stack and set the override flags option.
   ExecutionSession ES;
+  auto &JD = ES.createJITDylib("main");
+  auto Foo = ES.intern("foo");
   RTDyldObjectLinkingLayer ObjLayer(
-      ES,
-      [](VModuleKey) {
-        return RTDyldObjectLinkingLayer::Resources{
-            nullptr, std::make_shared<NullResolver>()};
-      },
-      [](VModuleKey, const object::ObjectFile &obj,
-         const RuntimeDyld::LoadedObjectInfo &info) {});
+      ES, [](VModuleKey) { return llvm::make_unique<SectionMemoryManager>(); });
+  IRCompileLayer CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM));
+
+  ObjLayer.setAutoClaimResponsibilityForObjectSymbols(true);
+
+  cantFail(CompileLayer.add(JD, ES.allocateVModule(), std::move(M)));
+  ES.lookup({&JD}, {Foo}, [](Expected<SymbolMap> R) { cantFail(std::move(R)); },
+            [](Error Err) { cantFail(std::move(Err)); },
+            NoDependenciesToRegister);
 }
 
 } // end anonymous namespace




More information about the llvm-commits mailing list