1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[ORC] Rename IRMaterializationUnit's Discardable member to SymbolToDefinition,

and make it protected rather than private.

The new name reflects the actual information in the map, and this information
can be useful to derived classes (for example, to quickly look up the IR
definition of a requested symbol).

llvm-svn: 333683
This commit is contained in:
Lang Hames 2018-05-31 19:29:01 +00:00
parent 592b4f92eb
commit cf0da17e5c
2 changed files with 7 additions and 6 deletions

View File

@ -63,11 +63,10 @@ public:
protected:
std::unique_ptr<Module> M;
std::map<SymbolStringPtr, GlobalValue *> SymbolToDefinition;
private:
void discard(const VSO &V, SymbolStringPtr Name) override;
std::map<SymbolStringPtr, GlobalValue *> Discardable;
};
/// MaterializationUnit that materializes modules by calling the 'emit' method

View File

@ -46,17 +46,19 @@ IRMaterializationUnit::IRMaterializationUnit(ExecutionSession &ES,
!G.hasAvailableExternallyLinkage()) {
auto MangledName = Mangle(G.getName());
SymbolFlags[MangledName] = JITSymbolFlags::fromGlobalValue(G);
Discardable[MangledName] = &G;
SymbolToDefinition[MangledName] = &G;
}
}
}
void IRMaterializationUnit::discard(const VSO &V, SymbolStringPtr Name) {
auto I = Discardable.find(Name);
assert(I != Discardable.end() &&
auto I = SymbolToDefinition.find(Name);
assert(I != SymbolToDefinition.end() &&
"Symbol not provided by this MU, or previously discarded");
assert(!I->second->isDeclaration() &&
"Discard should only apply to definitions");
I->second->setLinkage(GlobalValue::AvailableExternallyLinkage);
Discardable.erase(I);
SymbolToDefinition.erase(I);
}
BasicIRLayerMaterializationUnit::BasicIRLayerMaterializationUnit(