forked from OSchip/llvm-project
[ORC] Add a constructor to create an IRMaterializationUnit from a module and
pre-existing SymbolFlags and SymbolToDefinition maps. This constructor is useful when delegating work from an existing IRMaterialiaztionUnit to a new one, as it avoids the cost of re-computing these maps. llvm-svn: 333852
This commit is contained in:
parent
f886b44693
commit
d6155ff002
|
@ -59,11 +59,23 @@ private:
|
|||
/// their linkage is changed to available-externally.
|
||||
class IRMaterializationUnit : public MaterializationUnit {
|
||||
public:
|
||||
using SymbolNameToDefinitionMap = std::map<SymbolStringPtr, GlobalValue *>;
|
||||
|
||||
/// Create an IRMaterializationLayer. Scans the module to build the
|
||||
/// SymbolFlags and SymbolToDefinition maps.
|
||||
IRMaterializationUnit(ExecutionSession &ES, std::unique_ptr<Module> M);
|
||||
|
||||
/// Create an IRMaterializationLayer from a module, and pre-existing
|
||||
/// SymbolFlags and SymbolToDefinition maps. The maps must provide
|
||||
/// entries for each definition in M.
|
||||
/// This constructor is useful for delegating work from one
|
||||
/// IRMaterializationUnit to another.
|
||||
IRMaterializationUnit(std::unique_ptr<Module> M, SymbolFlagsMap SymbolFlags,
|
||||
SymbolNameToDefinitionMap SymbolToDefinition);
|
||||
|
||||
protected:
|
||||
std::unique_ptr<Module> M;
|
||||
std::map<SymbolStringPtr, GlobalValue *> SymbolToDefinition;
|
||||
SymbolNameToDefinitionMap SymbolToDefinition;
|
||||
|
||||
private:
|
||||
void discard(const VSO &V, SymbolStringPtr Name) override;
|
||||
|
|
|
@ -51,6 +51,12 @@ IRMaterializationUnit::IRMaterializationUnit(ExecutionSession &ES,
|
|||
}
|
||||
}
|
||||
|
||||
IRMaterializationUnit::IRMaterializationUnit(
|
||||
std::unique_ptr<Module> M, SymbolFlagsMap SymbolFlags,
|
||||
SymbolNameToDefinitionMap SymbolToDefinition)
|
||||
: MaterializationUnit(std::move(SymbolFlags)), M(std::move(M)),
|
||||
SymbolToDefinition(std::move(SymbolToDefinition)) {}
|
||||
|
||||
void IRMaterializationUnit::discard(const VSO &V, SymbolStringPtr Name) {
|
||||
auto I = SymbolToDefinition.find(Name);
|
||||
assert(I != SymbolToDefinition.end() &&
|
||||
|
|
Loading…
Reference in New Issue