[llvm] r333028 - [ORC] Add some comments to Layer.h.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue May 22 13:50:36 PDT 2018


Author: lhames
Date: Tue May 22 13:50:36 2018
New Revision: 333028

URL: http://llvm.org/viewvc/llvm-project?rev=333028&view=rev
Log:
[ORC] Add some comments to Layer.h.

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Orc/Layer.h

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/Layer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/Layer.h?rev=333028&r1=333027&r2=333028&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/Layer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/Layer.h Tue May 22 13:50:36 2018
@@ -20,25 +20,32 @@
 namespace llvm {
 namespace orc {
 
+/// Mangles symbol names then uniques them in the context of an
+/// ExecutionSession.
+//
+// FIXME: This may be more at home in Core.h.
 class MangleAndInterner {
 public:
   MangleAndInterner(ExecutionSession &ES, const DataLayout &DL);
   SymbolStringPtr operator()(StringRef Name);
-
 private:
   ExecutionSession &ES;
   const DataLayout &DL;
 };
 
-/// Layer interface.
+/// Interface for layers that accept LLVM IR.
 class IRLayer {
 public:
   IRLayer(ExecutionSession &ES);
   virtual ~IRLayer();
 
+  /// Returns the ExecutionSession for this layer.
   ExecutionSession &getExecutionSession() { return ES; }
 
+  /// Adds a MaterializationUnit representing the given IR to the given VSO.
   virtual Error add(VSO &V, VModuleKey K, std::unique_ptr<Module> M);
+
+  /// Emit should materialize the given IR.
   virtual void emit(MaterializationResponsibility R, VModuleKey K,
                     std::unique_ptr<Module> M) = 0;
 
@@ -46,6 +53,10 @@ private:
   ExecutionSession &ES;
 };
 
+/// IRMaterializationUnit is a convenient base class for MaterializationUnits
+/// wrapping LLVM IR. Represents materialization responsibility for all symbols
+/// in the given module. If symbols are overridden by other definitions, then
+/// their linkage is changed to available-externally.
 class IRMaterializationUnit : public MaterializationUnit {
 public:
   IRMaterializationUnit(ExecutionSession &ES, std::unique_ptr<Module> M);
@@ -59,6 +70,8 @@ private:
   std::map<SymbolStringPtr, GlobalValue *> Discardable;
 };
 
+/// MaterializationUnit that materializes modules by calling the 'emit' method
+/// on the given IRLayer.
 class BasicIRLayerMaterializationUnit : public IRMaterializationUnit {
 public:
   BasicIRLayerMaterializationUnit(IRLayer &L, VModuleKey K,
@@ -71,14 +84,19 @@ private:
   VModuleKey K;
 };
 
+/// Interface for Layers that accept object files.
 class ObjectLayer {
 public:
   ObjectLayer(ExecutionSession &ES);
   virtual ~ObjectLayer();
 
+  /// Returns the execution session for this layer.
   ExecutionSession &getExecutionSession() { return ES; }
 
+  /// Adds a MaterializationUnit representing the given IR to the given VSO.
   virtual Error add(VSO &V, VModuleKey K, std::unique_ptr<MemoryBuffer> O);
+
+  /// Emit should materialize the given IR.
   virtual void emit(MaterializationResponsibility R, VModuleKey K,
                     std::unique_ptr<MemoryBuffer> O) = 0;
 
@@ -86,11 +104,15 @@ private:
   ExecutionSession &ES;
 };
 
-/// The MemoryBuffer should represent a valid object file.
-/// If there is any chance that the file is invalid it should be validated
-/// prior to constructing a BasicObjectLayerMaterializationUnit.
+/// Materializes the given object file (represented by a MemoryBuffer
+/// instance) by calling 'emit' on the given ObjectLayer.
 class BasicObjectLayerMaterializationUnit : public MaterializationUnit {
 public:
+
+
+  /// The MemoryBuffer should represent a valid object file.
+  /// If there is any chance that the file is invalid it should be validated
+  /// prior to constructing a BasicObjectLayerMaterializationUnit.
   BasicObjectLayerMaterializationUnit(ObjectLayer &L, VModuleKey K,
                                       std::unique_ptr<MemoryBuffer> O);
 




More information about the llvm-commits mailing list