[llvm] 74f2a76 - [JITLink] Rename TableManager::appendEntry, add comment.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 10 10:13:45 PDT 2023
Author: Lang Hames
Date: 2023-07-10T17:13:40Z
New Revision: 74f2a76904d7059d4b74d508f962c3efa7775b28
URL: https://github.com/llvm/llvm-project/commit/74f2a76904d7059d4b74d508f962c3efa7775b28
DIFF: https://github.com/llvm/llvm-project/commit/74f2a76904d7059d4b74d508f962c3efa7775b28.diff
LOG: [JITLink] Rename TableManager::appendEntry, add comment.
Renames TableManager's appendEntry method to registerPreExistingEntry and adds
a comment to explain its purpose. (TableManager subclasses are required to
implement a createEntry method which also appends entries to the map: this
rename aims to avoid any confusion between these methods)
Added:
Modified:
llvm/include/llvm/ExecutionEngine/JITLink/TableManager.h
llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/TableManager.h b/llvm/include/llvm/ExecutionEngine/JITLink/TableManager.h
index 65a1aa84cbb091..7ab8ae3e53cec2 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/TableManager.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/TableManager.h
@@ -52,7 +52,13 @@ template <typename TableManagerImplT> class TableManager {
return *EntryI->second;
}
- bool appendEntry(Symbol &Target, Symbol &Entry) {
+ /// Register a pre-existing entry.
+ ///
+ /// Objects may include pre-existing table entries (e.g. for GOTs).
+ /// This method can be used to register those entries so that they will not
+ /// be duplicated by createEntry the first time that getEntryForTarget is
+ /// called.
+ bool registerPreExistingEntry(Symbol &Target, Symbol &Entry) {
assert(Target.hasName() && "Edge cannot point to anonymous target");
auto Res = Entries.insert({
Target.getName(),
diff --git a/llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp b/llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp
index 307928953ae918..f6f965b7063869 100644
--- a/llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/ELF_ppc64.cpp
@@ -69,9 +69,10 @@ registerExistingGOTEntries(LinkGraph &G,
for (Block *B : dotTOCSection->blocks())
for (Edge &E : B->edges())
if (isGOTEntry(E))
- TOC.appendEntry(E.getTarget(), G.addAnonymousSymbol(
- *B, E.getOffset(),
- G.getPointerSize(), false, false));
+ TOC.registerPreExistingEntry(E.getTarget(),
+ G.addAnonymousSymbol(*B, E.getOffset(),
+ G.getPointerSize(),
+ false, false));
}
}
More information about the llvm-commits
mailing list