summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2018-10-09 20:44:32 +0000
committerLang Hames <lhames@gmail.com>2018-10-09 20:44:32 +0000
commitbf6603e9181e1a1e2c88f148b487c8cc7f655a51 (patch)
tree1b8e51fb73438f251145a6fceea260efc43fcd6c /llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
parent87873d04c3401ecd91bbdd38b2b84b1f6bc0b1e4 (diff)
downloadbcm5719-llvm-bf6603e9181e1a1e2c88f148b487c8cc7f655a51.tar.gz
bcm5719-llvm-bf6603e9181e1a1e2c88f148b487c8cc7f655a51.zip
[ORC] Promote and rename private symbols inside the CompileOnDemand layer,
rather than require them to have been promoted before being passed in. Dropping this precondition is better for layer composition (CompileOnDemandLayer was the only one that placed pre-conditions on the modules that could be added). It also means that the promoted private symbols do not show up in the target JITDylib's symbol table. Instead, they are confined to the hidden implementation dylib that contains the actual definitions. For the 403.gcc testcase this cut down the public symbol table size from ~15,000 symbols to ~4000, substantially reducing symbol dependence tracking costs. llvm-svn: 344078
Diffstat (limited to 'llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
index 0acc5db76f4..d7fd57b6e53 100644
--- a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
@@ -248,8 +248,11 @@ void makeStub(Function &F, Value &ImplPointer) {
Builder.CreateRet(Call);
}
-void SymbolLinkagePromoter::operator()(Module &M) {
+std::vector<GlobalValue *> SymbolLinkagePromoter::operator()(Module &M) {
+ std::vector<GlobalValue *> PromotedGlobals;
+
for (auto &GV : M.global_values()) {
+ bool Promoted = true;
// Rename if necessary.
if (!GV.hasName())
@@ -258,13 +261,21 @@ void SymbolLinkagePromoter::operator()(Module &M) {
GV.setName("__" + GV.getName().substr(1) + "." + Twine(NextId++));
else if (GV.hasLocalLinkage())
GV.setName("__orc_lcl." + GV.getName() + "." + Twine(NextId++));
+ else
+ Promoted = false;
if (GV.hasLocalLinkage()) {
GV.setLinkage(GlobalValue::ExternalLinkage);
GV.setVisibility(GlobalValue::HiddenVisibility);
+ Promoted = true;
}
GV.setUnnamedAddr(GlobalValue::UnnamedAddr::None);
+
+ if (Promoted)
+ PromotedGlobals.push_back(&GV);
}
+
+ return PromotedGlobals;
}
Function* cloneFunctionDecl(Module &Dst, const Function &F,
OpenPOWER on IntegriCloud