File indexing completed on 2026-05-10 08:43:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_EXECUTIONENGINE_JITLINK_TABLEMANAGER_H
0014 #define LLVM_EXECUTIONENGINE_JITLINK_TABLEMANAGER_H
0015
0016 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
0017 #include "llvm/Support/Debug.h"
0018
0019 namespace llvm {
0020 namespace jitlink {
0021
0022
0023
0024
0025
0026
0027 template <typename TableManagerImplT> class TableManager {
0028 public:
0029
0030
0031
0032 Symbol &getEntryForTarget(LinkGraph &G, Symbol &Target) {
0033 assert(Target.hasName() && "Edge cannot point to anonymous target");
0034
0035 auto EntryI = Entries.find(Target.getName());
0036
0037
0038 if (EntryI == Entries.end()) {
0039 auto &Entry = impl().createEntry(G, Target);
0040 DEBUG_WITH_TYPE("jitlink", {
0041 dbgs() << " Created " << impl().getSectionName() << " entry for "
0042 << Target.getName() << ": " << Entry << "\n";
0043 });
0044 EntryI = Entries.insert(std::make_pair(Target.getName(), &Entry)).first;
0045 }
0046
0047 assert(EntryI != Entries.end() && "Could not get entry symbol");
0048 DEBUG_WITH_TYPE("jitlink", {
0049 dbgs() << " Using " << impl().getSectionName() << " entry "
0050 << *EntryI->second << "\n";
0051 });
0052 return *EntryI->second;
0053 }
0054
0055
0056
0057
0058
0059
0060
0061 bool registerPreExistingEntry(Symbol &Target, Symbol &Entry) {
0062 assert(Target.hasName() && "Edge cannot point to anonymous target");
0063 auto Res = Entries.insert({
0064 Target.getName(),
0065 &Entry,
0066 });
0067 return Res.second;
0068 }
0069
0070 private:
0071 TableManagerImplT &impl() { return static_cast<TableManagerImplT &>(*this); }
0072 DenseMap<orc::SymbolStringPtr, Symbol *> Entries;
0073 };
0074
0075 }
0076 }
0077
0078 #endif