LLVM  14.0.0git
CompileOnDemandLayer.cpp
Go to the documentation of this file.
1 //===----- CompileOnDemandLayer.cpp - Lazily emit IR on first call --------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "llvm/ADT/Hashing.h"
12 #include "llvm/IR/Mangler.h"
13 #include "llvm/IR/Module.h"
15 #include <string>
16 
17 using namespace llvm;
18 using namespace llvm::orc;
19 
21  StringRef Suffix,
22  GVPredicate ShouldExtract) {
23 
24  auto DeleteExtractedDefs = [](GlobalValue &GV) {
25  // Bump the linkage: this global will be provided by the external module.
26  GV.setLinkage(GlobalValue::ExternalLinkage);
27 
28  // Delete the definition in the source module.
29  if (isa<Function>(GV)) {
30  auto &F = cast<Function>(GV);
31  F.deleteBody();
32  F.setPersonalityFn(nullptr);
33  } else if (isa<GlobalVariable>(GV)) {
34  cast<GlobalVariable>(GV).setInitializer(nullptr);
35  } else if (isa<GlobalAlias>(GV)) {
36  // We need to turn deleted aliases into function or variable decls based
37  // on the type of their aliasee.
38  auto &A = cast<GlobalAlias>(GV);
39  Constant *Aliasee = A.getAliasee();
40  assert(A.hasName() && "Anonymous alias?");
41  assert(Aliasee->hasName() && "Anonymous aliasee");
42  std::string AliasName = std::string(A.getName());
43 
44  if (isa<Function>(Aliasee)) {
45  auto *F = cloneFunctionDecl(*A.getParent(), *cast<Function>(Aliasee));
46  A.replaceAllUsesWith(F);
47  A.eraseFromParent();
48  F->setName(AliasName);
49  } else if (isa<GlobalVariable>(Aliasee)) {
50  auto *G = cloneGlobalVariableDecl(*A.getParent(),
51  *cast<GlobalVariable>(Aliasee));
52  A.replaceAllUsesWith(G);
53  A.eraseFromParent();
54  G->setName(AliasName);
55  } else
56  llvm_unreachable("Alias to unsupported type");
57  } else
58  llvm_unreachable("Unsupported global type");
59  };
60 
61  auto NewTSM = cloneToNewContext(TSM, ShouldExtract, DeleteExtractedDefs);
62  NewTSM.withModuleDo([&](Module &M) {
63  M.setModuleIdentifier((M.getModuleIdentifier() + Suffix).str());
64  });
65 
66  return NewTSM;
67 }
68 
69 namespace llvm {
70 namespace orc {
71 
73 public:
76  ThreadSafeModule TSM,
77  CompileOnDemandLayer &Parent)
78  : IRMaterializationUnit(ES, MO, std::move(TSM)), Parent(Parent) {}
79 
82  SymbolStringPtr InitSymbol, SymbolNameToDefinitionMap SymbolToDefinition,
83  CompileOnDemandLayer &Parent)
85  std::move(InitSymbol),
86  std::move(SymbolToDefinition)),
87  Parent(Parent) {}
88 
89 private:
90  void materialize(std::unique_ptr<MaterializationResponsibility> R) override {
91  Parent.emitPartition(std::move(R), std::move(TSM),
92  std::move(SymbolToDefinition));
93  }
94 
95  void discard(const JITDylib &V, const SymbolStringPtr &Name) override {
96  // All original symbols were materialized by the CODLayer and should be
97  // final. The function bodies provided by M should never be overridden.
98  llvm_unreachable("Discard should never be called on an "
99  "ExtractingIRMaterializationUnit");
100  }
101 
102  mutable std::mutex SourceModuleMutex;
103  CompileOnDemandLayer &Parent;
104 };
105 
108  return std::move(Requested);
109 }
110 
113  return None;
114 }
115 
117  ExecutionSession &ES, IRLayer &BaseLayer, LazyCallThroughManager &LCTMgr,
118  IndirectStubsManagerBuilder BuildIndirectStubsManager)
119  : IRLayer(ES, BaseLayer.getManglingOptions()), BaseLayer(BaseLayer),
120  LCTMgr(LCTMgr),
121  BuildIndirectStubsManager(std::move(BuildIndirectStubsManager)) {}
122 
124  this->Partition = std::move(Partition);
125 }
126 
128  this->AliaseeImpls = Imp;
129 }
131  std::unique_ptr<MaterializationResponsibility> R, ThreadSafeModule TSM) {
132  assert(TSM && "Null module");
133 
134  auto &ES = getExecutionSession();
135 
136  // Sort the callables and non-callables, build re-exports and lodge the
137  // actual module with the implementation dylib.
138  auto &PDR = getPerDylibResources(R->getTargetJITDylib());
139 
140  SymbolAliasMap NonCallables;
141  SymbolAliasMap Callables;
142  TSM.withModuleDo([&](Module &M) {
143  // First, do some cleanup on the module:
144  cleanUpModule(M);
145  });
146 
147  for (auto &KV : R->getSymbols()) {
148  auto &Name = KV.first;
149  auto &Flags = KV.second;
150  if (Flags.isCallable())
151  Callables[Name] = SymbolAliasMapEntry(Name, Flags);
152  else
153  NonCallables[Name] = SymbolAliasMapEntry(Name, Flags);
154  }
155 
156  // Create a partitioning materialization unit and lodge it with the
157  // implementation dylib.
158  if (auto Err = PDR.getImplDylib().define(
159  std::make_unique<PartitioningIRMaterializationUnit>(
160  ES, *getManglingOptions(), std::move(TSM), *this))) {
161  ES.reportError(std::move(Err));
162  R->failMaterialization();
163  return;
164  }
165 
166  if (!NonCallables.empty())
167  if (auto Err =
168  R->replace(reexports(PDR.getImplDylib(), std::move(NonCallables),
171  R->failMaterialization();
172  return;
173  }
174  if (!Callables.empty()) {
175  if (auto Err = R->replace(
176  lazyReexports(LCTMgr, PDR.getISManager(), PDR.getImplDylib(),
177  std::move(Callables), AliaseeImpls))) {
179  R->failMaterialization();
180  return;
181  }
182  }
183 }
184 
185 CompileOnDemandLayer::PerDylibResources &
186 CompileOnDemandLayer::getPerDylibResources(JITDylib &TargetD) {
187  auto I = DylibResources.find(&TargetD);
188  if (I == DylibResources.end()) {
189  auto &ImplD =
190  getExecutionSession().createBareJITDylib(TargetD.getName() + ".impl");
191  JITDylibSearchOrder NewLinkOrder;
192  TargetD.withLinkOrderDo([&](const JITDylibSearchOrder &TargetLinkOrder) {
193  NewLinkOrder = TargetLinkOrder;
194  });
195 
196  assert(!NewLinkOrder.empty() && NewLinkOrder.front().first == &TargetD &&
197  NewLinkOrder.front().second ==
199  "TargetD must be at the front of its own search order and match "
200  "non-exported symbol");
201  NewLinkOrder.insert(std::next(NewLinkOrder.begin()),
202  {&ImplD, JITDylibLookupFlags::MatchAllSymbols});
203  ImplD.setLinkOrder(NewLinkOrder, false);
204  TargetD.setLinkOrder(std::move(NewLinkOrder), false);
205 
206  PerDylibResources PDR(ImplD, BuildIndirectStubsManager());
207  I = DylibResources.insert(std::make_pair(&TargetD, std::move(PDR))).first;
208  }
209 
210  return I->second;
211 }
212 
213 void CompileOnDemandLayer::cleanUpModule(Module &M) {
214  for (auto &F : M.functions()) {
215  if (F.isDeclaration())
216  continue;
217 
218  if (F.hasAvailableExternallyLinkage()) {
219  F.deleteBody();
220  F.setPersonalityFn(nullptr);
221  continue;
222  }
223  }
224 }
225 
226 void CompileOnDemandLayer::expandPartition(GlobalValueSet &Partition) {
227  // Expands the partition to ensure the following rules hold:
228  // (1) If any alias is in the partition, its aliasee is also in the partition.
229  // (2) If any aliasee is in the partition, its aliases are also in the
230  // partiton.
231  // (3) If any global variable is in the partition then all global variables
232  // are in the partition.
233  assert(!Partition.empty() && "Unexpected empty partition");
234 
235  const Module &M = *(*Partition.begin())->getParent();
236  bool ContainsGlobalVariables = false;
237  std::vector<const GlobalValue *> GVsToAdd;
238 
239  for (auto *GV : Partition)
240  if (isa<GlobalAlias>(GV))
241  GVsToAdd.push_back(
242  cast<GlobalValue>(cast<GlobalAlias>(GV)->getAliasee()));
243  else if (isa<GlobalVariable>(GV))
244  ContainsGlobalVariables = true;
245 
246  for (auto &A : M.aliases())
247  if (Partition.count(cast<GlobalValue>(A.getAliasee())))
248  GVsToAdd.push_back(&A);
249 
250  if (ContainsGlobalVariables)
251  for (auto &G : M.globals())
252  GVsToAdd.push_back(&G);
253 
254  for (auto *GV : GVsToAdd)
255  Partition.insert(GV);
256 }
257 
258 void CompileOnDemandLayer::emitPartition(
259  std::unique_ptr<MaterializationResponsibility> R, ThreadSafeModule TSM,
261 
262  // FIXME: Need a 'notify lazy-extracting/emitting' callback to tie the
263  // extracted module key, extracted module, and source module key
264  // together. This could be used, for example, to provide a specific
265  // memory manager instance to the linking layer.
266 
267  auto &ES = getExecutionSession();
268  GlobalValueSet RequestedGVs;
269  for (auto &Name : R->getRequestedSymbols()) {
270  if (Name == R->getInitializerSymbol())
271  TSM.withModuleDo([&](Module &M) {
272  for (auto &GV : getStaticInitGVs(M))
273  RequestedGVs.insert(&GV);
274  });
275  else {
276  assert(Defs.count(Name) && "No definition for symbol");
277  RequestedGVs.insert(Defs[Name]);
278  }
279  }
280 
281  /// Perform partitioning with the context lock held, since the partition
282  /// function is allowed to access the globals to compute the partition.
283  auto GVsToExtract =
284  TSM.withModuleDo([&](Module &M) { return Partition(RequestedGVs); });
285 
286  // Take a 'None' partition to mean the whole module (as opposed to an empty
287  // partition, which means "materialize nothing"). Emit the whole module
288  // unmodified to the base layer.
289  if (GVsToExtract == None) {
290  Defs.clear();
291  BaseLayer.emit(std::move(R), std::move(TSM));
292  return;
293  }
294 
295  // If the partition is empty, return the whole module to the symbol table.
296  if (GVsToExtract->empty()) {
297  if (auto Err =
298  R->replace(std::make_unique<PartitioningIRMaterializationUnit>(
299  std::move(TSM), R->getSymbols(), R->getInitializerSymbol(),
300  std::move(Defs), *this))) {
302  R->failMaterialization();
303  return;
304  }
305  return;
306  }
307 
308  // Ok -- we actually need to partition the symbols. Promote the symbol
309  // linkages/names, expand the partition to include any required symbols
310  // (i.e. symbols that can't be separated from our partition), and
311  // then extract the partition.
312  //
313  // FIXME: We apply this promotion once per partitioning. It's safe, but
314  // overkill.
315  auto ExtractedTSM =
317  auto PromotedGlobals = PromoteSymbols(M);
318  if (!PromotedGlobals.empty()) {
319 
320  MangleAndInterner Mangle(ES, M.getDataLayout());
323  PromotedGlobals, SymbolFlags);
324 
325  if (auto Err = R->defineMaterializing(SymbolFlags))
326  return std::move(Err);
327  }
328 
329  expandPartition(*GVsToExtract);
330 
331  // Submodule name is given by hashing the names of the globals.
332  std::string SubModuleName;
333  {
334  std::vector<const GlobalValue*> HashGVs;
335  HashGVs.reserve(GVsToExtract->size());
336  for (auto *GV : *GVsToExtract)
337  HashGVs.push_back(GV);
338  llvm::sort(HashGVs, [](const GlobalValue *LHS, const GlobalValue *RHS) {
339  return LHS->getName() < RHS->getName();
340  });
341  hash_code HC(0);
342  for (auto *GV : HashGVs) {
343  assert(GV->hasName() && "All GVs to extract should be named by now");
344  auto GVName = GV->getName();
345  HC = hash_combine(HC, hash_combine_range(GVName.begin(), GVName.end()));
346  }
347  raw_string_ostream(SubModuleName)
348  << ".submodule."
349  << formatv(sizeof(size_t) == 8 ? "{0:x16}" : "{0:x8}",
350  static_cast<size_t>(HC))
351  << ".ll";
352  }
353 
354  // Extract the requested partiton (plus any necessary aliases) and
355  // put the rest back into the impl dylib.
356  auto ShouldExtract = [&](const GlobalValue &GV) -> bool {
357  return GVsToExtract->count(&GV);
358  };
359 
360  return extractSubModule(TSM, SubModuleName , ShouldExtract);
361  });
362 
363  if (!ExtractedTSM) {
364  ES.reportError(ExtractedTSM.takeError());
365  R->failMaterialization();
366  return;
367  }
368 
369  if (auto Err = R->replace(std::make_unique<PartitioningIRMaterializationUnit>(
370  ES, *getManglingOptions(), std::move(TSM), *this))) {
371  ES.reportError(std::move(Err));
372  R->failMaterialization();
373  return;
374  }
375  BaseLayer.emit(std::move(R), std::move(*ExtractedTSM));
376 }
377 
378 } // end namespace orc
379 } // end namespace llvm
llvm::orc::IRSymbolMapper::add
static void add(ExecutionSession &ES, const ManglingOptions &MO, ArrayRef< GlobalValue * > GVs, SymbolFlagsMap &SymbolFlags, SymbolNameToDefinitionMap *SymbolToDefinition=nullptr)
Add mangled symbols for the given GlobalValues to SymbolFlags.
Definition: Mangling.cpp:36
llvm::orc::JITDylib::withLinkOrderDo
auto withLinkOrderDo(Func &&F) -> decltype(F(std::declval< const JITDylibSearchOrder & >()))
Do something with the link order (run under the session lock).
Definition: Core.h:1686
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::orc::JITDylib
A symbol table that supports asynchoronous symbol queries.
Definition: Core.h:907
llvm::orc::CompileOnDemandLayer::setImplMap
void setImplMap(ImplSymbolMap *Imp)
Sets the ImplSymbolMap.
Definition: CompileOnDemandLayer.cpp:127
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::orc::JITDylib::setLinkOrder
void setLinkOrder(JITDylibSearchOrder NewSearchOrder, bool LinkAgainstThisJITDylibFirst=true)
Set the link order to be used when fixing up definitions in JITDylib.
Definition: Core.cpp:1264
llvm::orc::ImplSymbolMap
Definition: Speculation.h:35
llvm::orc::IRMaterializationUnit
IRMaterializationUnit is a convenient base class for MaterializationUnits wrapping LLVM IR.
Definition: Layer.h:31
llvm::orc::ExecutionSession::reportError
void reportError(Error Err)
Report a error for this execution session.
Definition: Core.h:1371
llvm::orc::CompileOnDemandLayer::CompileOnDemandLayer
CompileOnDemandLayer(ExecutionSession &ES, IRLayer &BaseLayer, LazyCallThroughManager &LCTMgr, IndirectStubsManagerBuilder BuildIndirectStubsManager)
Construct a CompileOnDemandLayer.
Definition: CompileOnDemandLayer.cpp:116
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:625
llvm::orc::CompileOnDemandLayer::setPartitionFunction
void setPartitionFunction(PartitionFunction Partition)
Sets the partition function.
Definition: CompileOnDemandLayer.cpp:123
llvm::orc::SymbolStringPtr
Pointer to a pooled string representing a symbol name.
Definition: SymbolStringPool.h:50
llvm::Value::hasName
bool hasName() const
Definition: Value.h:262
llvm::orc::LazyCallThroughManager
Manages a set of 'lazy call-through' trampolines.
Definition: LazyReexports.h:38
Module.h
llvm::orc::CompileOnDemandLayer::compileRequested
static Optional< GlobalValueSet > compileRequested(GlobalValueSet Requested)
Off-the-shelf partitioning which compiles all requested symbols (usually a single function at a time)...
Definition: CompileOnDemandLayer.cpp:107
llvm::Optional
Definition: APInt.h:33
llvm::orc::IRLayer::getManglingOptions
const IRSymbolMapper::ManglingOptions *& getManglingOptions() const
Get the mangling options for this layer.
Definition: Layer.h:79
Hashing.h
llvm::orc::lazyReexports
std::unique_ptr< LazyReexportsMaterializationUnit > lazyReexports(LazyCallThroughManager &LCTManager, IndirectStubsManager &ISManager, JITDylib &SourceJD, SymbolAliasMap CallableAliases, ImplSymbolMap *SrcJDLoc=nullptr)
Define lazy-reexports based on the given SymbolAliasMap.
Definition: LazyReexports.h:167
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::MachO::SymbolFlags
SymbolFlags
Symbol flags.
Definition: Symbol.h:25
ExecutionUtils.h
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::RISCVFenceField::R
@ R
Definition: RISCVBaseInfo.h:193
llvm::formatv
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
Definition: FormatVariadic.h:250
llvm::orc::CompileOnDemandLayer::PartitionFunction
std::function< Optional< GlobalValueSet >(GlobalValueSet Requested)> PartitionFunction
Partitioning function.
Definition: CompileOnDemandLayer.h:73
llvm::ARM_PROC::A
@ A
Definition: ARMBaseInfo.h:34
llvm::orc
Definition: CompileOnDemandLayer.h:57
llvm::orc::cloneGlobalVariableDecl
GlobalVariable * cloneGlobalVariableDecl(Module &Dst, const GlobalVariable &GV, ValueToValueMapTy *VMap=nullptr)
Clone a global variable declaration into a new module.
Definition: IndirectionUtils.cpp:325
extractSubModule
static ThreadSafeModule extractSubModule(ThreadSafeModule &TSM, StringRef Suffix, GVPredicate ShouldExtract)
Definition: CompileOnDemandLayer.cpp:20
llvm::orc::PartitioningIRMaterializationUnit::PartitioningIRMaterializationUnit
PartitioningIRMaterializationUnit(ThreadSafeModule TSM, SymbolFlagsMap SymbolFlags, SymbolStringPtr InitSymbol, SymbolNameToDefinitionMap SymbolToDefinition, CompileOnDemandLayer &Parent)
Definition: CompileOnDemandLayer.cpp:80
FormatVariadic.h
llvm::None
const NoneType None
Definition: None.h:23
llvm::orc::getStaticInitGVs
iterator_range< StaticInitGVIterator > getStaticInitGVs(Module &M)
Create an iterator range over the GlobalValues that contribute to static initialization.
Definition: ExecutionUtils.h:139
llvm::orc::ExecutionSession::createBareJITDylib
JITDylib & createBareJITDylib(std::string Name)
Add a new bare JITDylib to this ExecutionSession.
Definition: Core.cpp:1856
llvm::orc::IRLayer::emit
virtual void emit(std::unique_ptr< MaterializationResponsibility > R, ThreadSafeModule TSM)=0
Emit should materialize the given IR.
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:202
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::DenseMap< SymbolStringPtr, JITSymbolFlags >
I
#define I(x, y, z)
Definition: MD5.cpp:59
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1605
llvm::orc::JITDylibSearchOrder
std::vector< std::pair< JITDylib *, JITDylibLookupFlags > > JITDylibSearchOrder
A list of (JITDylib*, JITDylibLookupFlags) pairs to be used as a search order during symbol lookup.
Definition: Core.h:153
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::orc::IRLayer::getExecutionSession
ExecutionSession & getExecutionSession()
Returns the ExecutionSession for this layer.
Definition: Layer.h:76
llvm::orc::PartitioningIRMaterializationUnit
Definition: CompileOnDemandLayer.cpp:72
llvm::orc::CompileOnDemandLayer::GlobalValueSet
std::set< const GlobalValue * > GlobalValueSet
Definition: CompileOnDemandLayer.h:69
llvm::orc::reexports
std::unique_ptr< ReExportsMaterializationUnit > reexports(JITDylib &SourceJD, SymbolAliasMap Aliases, JITDylibLookupFlags SourceJDLookupFlags=JITDylibLookupFlags::MatchExportedSymbolsOnly)
Create a materialization unit for re-exporting symbols from another JITDylib with alternative names/f...
Definition: Core.h:786
Mangler.h
llvm::orc::ThreadSafeModule::withModuleDo
decltype(auto) withModuleDo(Func &&F)
Locks the associated ThreadSafeContext and calls the given function on the contained Module.
Definition: ThreadSafeModule.h:133
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
A
* A
Definition: README_ALTIVEC.txt:89
getParent
static const Function * getParent(const Value *V)
Definition: BasicAliasAnalysis.cpp:776
llvm::orc::cloneFunctionDecl
Function * cloneFunctionDecl(Module &Dst, const Function &F, ValueToValueMapTy *VMap=nullptr)
Clone a function declaration into a new module.
Definition: IndirectionUtils.cpp:287
llvm::orc::SymbolAliasMapEntry
Definition: Core.h:381
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:297
llvm::orc::MangleAndInterner
Mangles symbol names then uniques them in the context of an ExecutionSession.
Definition: Mangling.h:26
llvm::DenseMapBase::empty
LLVM_NODISCARD bool empty() const
Definition: DenseMap.h:97
llvm::orc::IRSymbolMapper::ManglingOptions
Definition: Mangling.h:41
llvm::orc::GVPredicate
std::function< bool(const GlobalValue &)> GVPredicate
Definition: ThreadSafeModule.h:160
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
std
Definition: BitVector.h:838
llvm::ms_demangle::QualifierMangleMode::Mangle
@ Mangle
llvm::orc::CompileOnDemandLayer::IndirectStubsManagerBuilder
std::function< std::unique_ptr< IndirectStubsManager >()> IndirectStubsManagerBuilder
Builder for IndirectStubsManagers.
Definition: CompileOnDemandLayer.h:67
llvm::orc::ExecutionSession
An ExecutionSession represents a running JIT program.
Definition: Core.h:1275
llvm::orc::CompileOnDemandLayer::compileWholeModule
static Optional< GlobalValueSet > compileWholeModule(GlobalValueSet Requested)
Off-the-shelf partitioning which compiles whole modules whenever any symbol in them is requested.
Definition: CompileOnDemandLayer.cpp:112
llvm::sort
void sort(IteratorTy Start, IteratorTy End)
Definition: STLExtras.h:1488
llvm::orc::CompileOnDemandLayer::emit
void emit(std::unique_ptr< MaterializationResponsibility > R, ThreadSafeModule TSM) override
Emits the given module.
Definition: CompileOnDemandLayer.cpp:130
llvm::GlobalValue::ExternalLinkage
@ ExternalLinkage
Externally visible function.
Definition: GlobalValue.h:48
llvm::orc::JITDylib::getName
const std::string & getName() const
Get the name for this JITDylib.
Definition: Core.h:924
llvm::hash_combine
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
Definition: Hashing.h:604
llvm::hash_combine_range
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
Definition: Hashing.h:482
llvm::orc::ThreadSafeModule
An LLVM Module together with a shared ThreadSafeContext.
Definition: ThreadSafeModule.h:77
CompileOnDemandLayer.h
llvm::orc::IRMaterializationUnit::SymbolNameToDefinitionMap
std::map< SymbolStringPtr, GlobalValue * > SymbolNameToDefinitionMap
Definition: Layer.h:33
llvm::orc::JITDylibLookupFlags::MatchAllSymbols
@ MatchAllSymbols
llvm::orc::IRLayer
Interface for layers that accept LLVM IR.
Definition: Layer.h:68
llvm::orc::CompileOnDemandLayer
Definition: CompileOnDemandLayer.h:61
llvm::orc::PartitioningIRMaterializationUnit::PartitioningIRMaterializationUnit
PartitioningIRMaterializationUnit(ExecutionSession &ES, const IRSymbolMapper::ManglingOptions &MO, ThreadSafeModule TSM, CompileOnDemandLayer &Parent)
Definition: CompileOnDemandLayer.cpp:74
llvm::hash_code
An opaque object representing a hash code.
Definition: Hashing.h:72
llvm::orc::cloneToNewContext
ThreadSafeModule cloneToNewContext(const ThreadSafeModule &TSMW, GVPredicate ShouldCloneDef=GVPredicate(), GVModifier UpdateClonedDefSource=GVModifier())
Clones the given module on to a new context.
Definition: ThreadSafeModule.cpp:18