PseudoSourceValue: Introduce a 'PSVKind' enumerator.
[oota-llvm.git] / include / llvm / ExecutionEngine / RuntimeDyld.h
index 2b6e98287b16e41abef1c60f343c2a6640fc0e65..7aaee1505665a695995460b78a1909c0600d35f6 100644 (file)
 #include "JITSymbolFlags.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Object/ObjectFile.h"
 #include "llvm/Support/Memory.h"
 #include "llvm/DebugInfo/DIContext.h"
+#include <map>
 #include <memory>
 
 namespace llvm {
@@ -59,26 +61,32 @@ public:
   class LoadedObjectInfo : public llvm::LoadedObjectInfo {
     friend class RuntimeDyldImpl;
   public:
-    LoadedObjectInfo(RuntimeDyldImpl &RTDyld, unsigned BeginIdx,
-                     unsigned EndIdx)
-      : RTDyld(RTDyld), BeginIdx(BeginIdx), EndIdx(EndIdx) { }
+    typedef std::map<object::SectionRef, unsigned> ObjSectionToIDMap;
+
+    LoadedObjectInfo(RuntimeDyldImpl &RTDyld, ObjSectionToIDMap ObjSecToIDMap)
+      : RTDyld(RTDyld), ObjSecToIDMap(ObjSecToIDMap) { }
 
     virtual object::OwningBinary<object::ObjectFile>
     getObjectForDebug(const object::ObjectFile &Obj) const = 0;
 
-    uint64_t getSectionLoadAddress(StringRef Name) const;
+    uint64_t getSectionLoadAddress(const object::SectionRef &Sec) const;
 
   protected:
     virtual void anchor();
 
     RuntimeDyldImpl &RTDyld;
-    unsigned BeginIdx, EndIdx;
+    ObjSectionToIDMap ObjSecToIDMap;
   };
 
   template <typename Derived> struct LoadedObjectInfoHelper : LoadedObjectInfo {
-    LoadedObjectInfoHelper(RuntimeDyldImpl &RTDyld, unsigned BeginIdx,
-                           unsigned EndIdx)
-        : LoadedObjectInfo(RTDyld, BeginIdx, EndIdx) {}
+  protected:
+    LoadedObjectInfoHelper(const LoadedObjectInfoHelper &) = default;
+    LoadedObjectInfoHelper() = default;
+
+  public:
+    LoadedObjectInfoHelper(RuntimeDyldImpl &RTDyld,
+                           LoadedObjectInfo::ObjSectionToIDMap ObjSecToIDMap)
+        : LoadedObjectInfo(RTDyld, std::move(ObjSecToIDMap)) {}
     std::unique_ptr<llvm::LoadedObjectInfo> clone() const override {
       return llvm::make_unique<Derived>(static_cast<const Derived &>(*this));
     }