LLVM  13.0.0git
ExecutionUtils.cpp
Go to the documentation of this file.
1 //===---- ExecutionUtils.cpp - Utilities for executing functions in Orc ---===//
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 
12 #include "llvm/IR/Constants.h"
13 #include "llvm/IR/Function.h"
14 #include "llvm/IR/GlobalVariable.h"
15 #include "llvm/IR/Module.h"
20 
21 namespace llvm {
22 namespace orc {
23 
25  : InitList(
26  GV ? dyn_cast_or_null<ConstantArray>(GV->getInitializer()) : nullptr),
27  I((InitList && End) ? InitList->getNumOperands() : 0) {
28 }
29 
31  assert(InitList == Other.InitList && "Incomparable iterators.");
32  return I == Other.I;
33 }
34 
36  return !(*this == Other);
37 }
38 
40  ++I;
41  return *this;
42 }
43 
45  CtorDtorIterator Temp = *this;
46  ++I;
47  return Temp;
48 }
49 
51  ConstantStruct *CS = dyn_cast<ConstantStruct>(InitList->getOperand(I));
52  assert(CS && "Unrecognized type in llvm.global_ctors/llvm.global_dtors");
53 
54  Constant *FuncC = CS->getOperand(1);
55  Function *Func = nullptr;
56 
57  // Extract function pointer, pulling off any casts.
58  while (FuncC) {
59  if (Function *F = dyn_cast_or_null<Function>(FuncC)) {
60  Func = F;
61  break;
62  } else if (ConstantExpr *CE = dyn_cast_or_null<ConstantExpr>(FuncC)) {
63  if (CE->isCast())
64  FuncC = dyn_cast_or_null<ConstantExpr>(CE->getOperand(0));
65  else
66  break;
67  } else {
68  // This isn't anything we recognize. Bail out with Func left set to null.
69  break;
70  }
71  }
72 
73  auto *Priority = cast<ConstantInt>(CS->getOperand(0));
74  Value *Data = CS->getNumOperands() == 3 ? CS->getOperand(2) : nullptr;
75  if (Data && !isa<GlobalValue>(Data))
76  Data = nullptr;
77  return Element(Priority->getZExtValue(), Func, Data);
78 }
79 
81  const GlobalVariable *CtorsList = M.getNamedGlobal("llvm.global_ctors");
82  return make_range(CtorDtorIterator(CtorsList, false),
83  CtorDtorIterator(CtorsList, true));
84 }
85 
87  const GlobalVariable *DtorsList = M.getNamedGlobal("llvm.global_dtors");
88  return make_range(CtorDtorIterator(DtorsList, false),
89  CtorDtorIterator(DtorsList, true));
90 }
91 
92 bool StaticInitGVIterator::isStaticInitGlobal(GlobalValue &GV) {
93  if (GV.isDeclaration())
94  return false;
95 
96  if (GV.hasName() && (GV.getName() == "llvm.global_ctors" ||
97  GV.getName() == "llvm.global_dtors"))
98  return true;
99 
100  if (ObjFmt == Triple::MachO) {
101  // FIXME: These section checks are too strict: We should match first and
102  // second word split by comma.
103  if (GV.hasSection() &&
104  (GV.getSection().startswith("__DATA,__objc_classlist") ||
105  GV.getSection().startswith("__DATA,__objc_selrefs")))
106  return true;
107  }
108 
109  return false;
110 }
111 
113  if (CtorDtors.empty())
114  return;
115 
116  MangleAndInterner Mangle(
117  JD.getExecutionSession(),
118  (*CtorDtors.begin()).Func->getParent()->getDataLayout());
119 
120  for (auto CtorDtor : CtorDtors) {
121  assert(CtorDtor.Func && CtorDtor.Func->hasName() &&
122  "Ctor/Dtor function must be named to be runnable under the JIT");
123 
124  // FIXME: Maybe use a symbol promoter here instead.
125  if (CtorDtor.Func->hasLocalLinkage()) {
126  CtorDtor.Func->setLinkage(GlobalValue::ExternalLinkage);
127  CtorDtor.Func->setVisibility(GlobalValue::HiddenVisibility);
128  }
129 
130  if (CtorDtor.Data && cast<GlobalValue>(CtorDtor.Data)->isDeclaration()) {
131  dbgs() << " Skipping because why now?\n";
132  continue;
133  }
134 
135  CtorDtorsByPriority[CtorDtor.Priority].push_back(
136  Mangle(CtorDtor.Func->getName()));
137  }
138 }
139 
141  using CtorDtorTy = void (*)();
142 
143  SymbolLookupSet LookupSet;
144  for (auto &KV : CtorDtorsByPriority)
145  for (auto &Name : KV.second)
146  LookupSet.add(Name);
147  assert(!LookupSet.containsDuplicates() &&
148  "Ctor/Dtor list contains duplicates");
149 
150  auto &ES = JD.getExecutionSession();
151  if (auto CtorDtorMap = ES.lookup(
153  std::move(LookupSet))) {
154  for (auto &KV : CtorDtorsByPriority) {
155  for (auto &Name : KV.second) {
156  assert(CtorDtorMap->count(Name) && "No entry for Name");
157  auto CtorDtor = reinterpret_cast<CtorDtorTy>(
158  static_cast<uintptr_t>((*CtorDtorMap)[Name].getAddress()));
159  CtorDtor();
160  }
161  }
162  CtorDtorsByPriority.clear();
163  return Error::success();
164  } else
165  return CtorDtorMap.takeError();
166 }
167 
169  auto& CXXDestructorDataPairs = DSOHandleOverride;
170  for (auto &P : CXXDestructorDataPairs)
171  P.first(P.second);
172  CXXDestructorDataPairs.clear();
173 }
174 
176  void *Arg,
177  void *DSOHandle) {
178  auto& CXXDestructorDataPairs =
179  *reinterpret_cast<CXXDestructorDataPairList*>(DSOHandle);
180  CXXDestructorDataPairs.push_back(std::make_pair(Destructor, Arg));
181  return 0;
182 }
183 
185  MangleAndInterner &Mangle) {
186  SymbolMap RuntimeInterposes;
187  RuntimeInterposes[Mangle("__dso_handle")] =
190  RuntimeInterposes[Mangle("__cxa_atexit")] =
193 
194  return JD.define(absoluteSymbols(std::move(RuntimeInterposes)));
195 }
196 
197 void ItaniumCXAAtExitSupport::registerAtExit(void (*F)(void *), void *Ctx,
198  void *DSOHandle) {
199  std::lock_guard<std::mutex> Lock(AtExitsMutex);
200  AtExitRecords[DSOHandle].push_back({F, Ctx});
201 }
202 
203 void ItaniumCXAAtExitSupport::runAtExits(void *DSOHandle) {
204  std::vector<AtExitRecord> AtExitsToRun;
205 
206  {
207  std::lock_guard<std::mutex> Lock(AtExitsMutex);
208  auto I = AtExitRecords.find(DSOHandle);
209  if (I != AtExitRecords.end()) {
210  AtExitsToRun = std::move(I->second);
211  AtExitRecords.erase(I);
212  }
213  }
214 
215  while (!AtExitsToRun.empty()) {
216  AtExitsToRun.back().F(AtExitsToRun.back().Ctx);
217  AtExitsToRun.pop_back();
218  }
219 }
220 
223  : Dylib(std::move(Dylib)), Allow(std::move(Allow)),
225 
228  SymbolPredicate Allow) {
229  std::string ErrMsg;
230  auto Lib = sys::DynamicLibrary::getPermanentLibrary(FileName, &ErrMsg);
231  if (!Lib.isValid())
232  return make_error<StringError>(std::move(ErrMsg), inconvertibleErrorCode());
233  return std::make_unique<DynamicLibrarySearchGenerator>(
234  std::move(Lib), GlobalPrefix, std::move(Allow));
235 }
236 
239  JITDylibLookupFlags JDLookupFlags, const SymbolLookupSet &Symbols) {
240  orc::SymbolMap NewSymbols;
241 
242  bool HasGlobalPrefix = (GlobalPrefix != '\0');
243 
244  for (auto &KV : Symbols) {
245  auto &Name = KV.first;
246 
247  if ((*Name).empty())
248  continue;
249 
250  if (Allow && !Allow(Name))
251  continue;
252 
253  if (HasGlobalPrefix && (*Name).front() != GlobalPrefix)
254  continue;
255 
256  std::string Tmp((*Name).data() + HasGlobalPrefix,
257  (*Name).size() - HasGlobalPrefix);
258  if (void *Addr = Dylib.getAddressOfSymbol(Tmp.c_str())) {
259  NewSymbols[Name] = JITEvaluatedSymbol(
260  static_cast<JITTargetAddress>(reinterpret_cast<uintptr_t>(Addr)),
262  }
263  }
264 
265  if (NewSymbols.empty())
266  return Error::success();
267 
268  return JD.define(absoluteSymbols(std::move(NewSymbols)));
269 }
270 
273  auto ArchiveBuffer = errorOrToExpected(MemoryBuffer::getFile(FileName));
274 
275  if (!ArchiveBuffer)
276  return ArchiveBuffer.takeError();
277 
278  return Create(L, std::move(*ArchiveBuffer));
279 }
280 
283  const Triple &TT) {
284  auto B = object::createBinary(FileName);
285  if (!B)
286  return B.takeError();
287 
288  // If this is a regular archive then create an instance from it.
289  if (isa<object::Archive>(B->getBinary()))
290  return Create(L, std::move(B->takeBinary().second));
291 
292  // If this is a universal binary then search for a slice matching the given
293  // Triple.
294  if (auto *UB = cast<object::MachOUniversalBinary>(B->getBinary())) {
295  for (const auto &Obj : UB->objects()) {
296  auto ObjTT = Obj.getTriple();
297  if (ObjTT.getArch() == TT.getArch() &&
298  ObjTT.getSubArch() == TT.getSubArch() &&
299  (TT.getVendor() == Triple::UnknownVendor ||
300  ObjTT.getVendor() == TT.getVendor())) {
301  // We found a match. Create an instance from a buffer covering this
302  // slice.
303  auto SliceBuffer = MemoryBuffer::getFileSlice(FileName, Obj.getSize(),
304  Obj.getOffset());
305  if (!SliceBuffer)
306  return make_error<StringError>(
307  Twine("Could not create buffer for ") + TT.str() + " slice of " +
308  FileName + ": [ " + formatv("{0:x}", Obj.getOffset()) +
309  " .. " + formatv("{0:x}", Obj.getOffset() + Obj.getSize()) +
310  ": " + SliceBuffer.getError().message(),
311  SliceBuffer.getError());
312  return Create(L, std::move(*SliceBuffer));
313  }
314  }
315 
316  return make_error<StringError>(Twine("Universal binary ") + FileName +
317  " does not contain a slice for " +
318  TT.str(),
320  }
321 
322  return make_error<StringError>(Twine("Unrecognized file type for ") +
323  FileName,
325 }
326 
329  ObjectLayer &L, std::unique_ptr<MemoryBuffer> ArchiveBuffer) {
330  Error Err = Error::success();
331 
332  std::unique_ptr<StaticLibraryDefinitionGenerator> ADG(
333  new StaticLibraryDefinitionGenerator(L, std::move(ArchiveBuffer), Err));
334 
335  if (Err)
336  return std::move(Err);
337 
338  return std::move(ADG);
339 }
340 
343  JITDylibLookupFlags JDLookupFlags, const SymbolLookupSet &Symbols) {
344 
345  // Don't materialize symbols from static archives unless this is a static
346  // lookup.
347  if (K != LookupKind::Static)
348  return Error::success();
349 
350  // Bail out early if we've already freed the archive.
351  if (!Archive)
352  return Error::success();
353 
355 
356  for (const auto &KV : Symbols) {
357  const auto &Name = KV.first;
358  auto Child = Archive->findSym(*Name);
359  if (!Child)
360  return Child.takeError();
361  if (*Child == None)
362  continue;
363  auto ChildBuffer = (*Child)->getMemoryBufferRef();
364  if (!ChildBuffer)
365  return ChildBuffer.takeError();
366  ChildBufferInfos.insert(
367  {ChildBuffer->getBuffer(), ChildBuffer->getBufferIdentifier()});
368  }
369 
370  for (auto ChildBufferInfo : ChildBufferInfos) {
371  MemoryBufferRef ChildBufferRef(ChildBufferInfo.first,
372  ChildBufferInfo.second);
373 
374  if (auto Err = L.add(JD, MemoryBuffer::getMemBuffer(ChildBufferRef, false)))
375  return Err;
376  }
377 
378  return Error::success();
379 }
380 
381 StaticLibraryDefinitionGenerator::StaticLibraryDefinitionGenerator(
382  ObjectLayer &L, std::unique_ptr<MemoryBuffer> ArchiveBuffer, Error &Err)
383  : L(L), ArchiveBuffer(std::move(ArchiveBuffer)),
384  Archive(std::make_unique<object::Archive>(*this->ArchiveBuffer, Err)) {}
385 
386 } // End namespace orc.
387 } // End namespace llvm.
llvm::StringRef::startswith
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:289
llvm
This class represents lattice values for constants.
Definition: AllocatorList.h:23
llvm::orc::JITDylib
A symbol table that supports asynchoronous symbol queries.
Definition: Core.h:894
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::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
llvm::orc::CtorDtorRunner::add
void add(iterator_range< CtorDtorIterator > CtorDtors)
Definition: ExecutionUtils.cpp:112
llvm::sys::DynamicLibrary::getAddressOfSymbol
void * getAddressOfSymbol(const char *symbolName)
Searches through the library for the symbol symbolName.
Definition: DynamicLibrary.cpp:171
llvm::orc::getConstructors
iterator_range< CtorDtorIterator > getConstructors(const Module &M)
Create an iterator range over the entries of the llvm.global_ctors array.
Definition: ExecutionUtils.cpp:80
llvm::GlobalValue::HiddenVisibility
@ HiddenVisibility
The GV is hidden.
Definition: GlobalValue.h:64
llvm::Function
Definition: Function.h:61
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
llvm::orc::SymbolLookupSet
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Definition: Core.h:172
llvm::orc::LookupKind::Static
@ Static
llvm::Value::hasName
bool hasName() const
Definition: Value.h:252
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:332
llvm::GlobalVariable
Definition: GlobalVariable.h:40
llvm::orc::StaticLibraryDefinitionGenerator::Load
static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Load(ObjectLayer &L, const char *FileName)
Try to create a StaticLibraryDefinitionGenerator from the given path.
Definition: ExecutionUtils.cpp:272
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
GlobalPrefix
@ GlobalPrefix
Definition: AsmWriter.cpp:407
Module.h
llvm::GlobalValue::hasSection
bool hasSection() const
Definition: GlobalValue.h:267
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::orc::LocalCXXRuntimeOverridesBase::DSOHandleOverride
CXXDestructorDataPairList DSOHandleOverride
Definition: ExecutionUtils.h:187
llvm::orc::LookupKind
LookupKind
Describes the kind of lookup being performed.
Definition: Core.h:146
llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, DenseMapInfo< ValueT >, detail::DenseSetPair< ValueT > >, DenseMapInfo< ValueT > >::insert
std::pair< iterator, bool > insert(const ValueT &V)
Definition: DenseSet.h:206
Layer.h
llvm::Data
@ Data
Definition: SIMachineScheduler.h:56
llvm::MemoryBufferRef
Definition: MemoryBufferRef.h:22
llvm::orc::CtorDtorIterator::operator==
bool operator==(const CtorDtorIterator &Other) const
Test iterators for equality.
Definition: ExecutionUtils.cpp:30
llvm::JITEvaluatedSymbol
Represents a symbol that has been evaluated to an address already.
Definition: JITSymbol.h:229
llvm::sys::DynamicLibrary
This class provides a portable interface to dynamic libraries which also might be known as shared lib...
Definition: DynamicLibrary.h:36
ExecutionUtils.h
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::orc::CtorDtorIterator
This iterator provides a convenient way to iterate over the elements of an llvm.global_ctors/llvm....
Definition: ExecutionUtils.h:49
llvm::GlobalValue::getSection
StringRef getSection() const
Definition: Globals.cpp:162
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
llvm::Lock
static sys::Mutex Lock
Definition: NVPTXUtilities.cpp:39
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:205
llvm::orc::DynamicLibrarySearchGenerator::DynamicLibrarySearchGenerator
DynamicLibrarySearchGenerator(sys::DynamicLibrary Dylib, char GlobalPrefix, SymbolPredicate Allow=SymbolPredicate())
Create a DynamicLibrarySearchGenerator that searches for symbols in the given sys::DynamicLibrary.
Definition: ExecutionUtils.cpp:221
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::MemoryBuffer::getMemBuffer
static std::unique_ptr< MemoryBuffer > getMemBuffer(StringRef InputData, StringRef BufferName="", bool RequiresNullTerminator=true)
Open the specified memory range as a MemoryBuffer.
Definition: MemoryBuffer.cpp:112
TargetMachine.h
llvm::GlobalValue::isDeclaration
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
Definition: Globals.cpp:228
Constants.h
llvm::orc::SymbolLookupSet::containsDuplicates
bool containsDuplicates()
Returns true if this set contains any duplicates.
Definition: Core.h:352
llvm::sys::DynamicLibrary::getPermanentLibrary
static DynamicLibrary getPermanentLibrary(const char *filename, std::string *errMsg=nullptr)
This function permanently loads the dynamic library at the given path.
Definition: DynamicLibrary.cpp:146
llvm::orc::LocalCXXRuntimeOverrides::enable
Error enable(JITDylib &JD, MangleAndInterner &Mangler)
Definition: ExecutionUtils.cpp:184
MachOUniversal.h
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::ConstantArray
ConstantArray - Constant Array Declarations.
Definition: Constants.h:424
llvm::orc::ObjectLayer
Interface for Layers that accept object files.
Definition: Layer.h:134
llvm::orc::SymbolLookupSet::add
SymbolLookupSet & add(SymbolStringPtr Name, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)
Add an element to the set.
Definition: Core.h:221
llvm::iterator_range::empty
bool empty() const
Definition: iterator_range.h:46
FormatVariadic.h
llvm::None
const NoneType None
Definition: None.h:23
llvm::orc::LocalCXXRuntimeOverridesBase::runDestructors
void runDestructors()
Run any destructors recorded by the overriden __cxa_atexit function (CXAAtExitOverride).
Definition: ExecutionUtils.cpp:168
llvm::orc::DynamicLibrarySearchGenerator::tryToGenerate
Error tryToGenerate(LookupState &LS, LookupKind K, JITDylib &JD, JITDylibLookupFlags JDLookupFlags, const SymbolLookupSet &Symbols) override
DefinitionGenerators should override this method to insert new definitions into the parent JITDylib.
Definition: ExecutionUtils.cpp:237
llvm::orc::LocalCXXRuntimeOverridesBase::CXXDestructorDataPairList
std::vector< CXXDestructorDataPair > CXXDestructorDataPairList
Definition: ExecutionUtils.h:186
llvm::DenseSet
Implements a dense probed hash-table based set.
Definition: DenseSet.h:268
llvm::orc::LocalCXXRuntimeOverridesBase::DestructorPtr
void(*)(void *) DestructorPtr
Definition: ExecutionUtils.h:184
llvm::GlobalValue
Definition: GlobalValue.h:44
object
bar al al movzbl eax ret Missed when stored in a memory object
Definition: README.txt:1411
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::orc::getDestructors
iterator_range< CtorDtorIterator > getDestructors(const Module &M)
Create an iterator range over the entries of the llvm.global_ctors array.
Definition: ExecutionUtils.cpp:86
Addr
uint64_t Addr
Definition: ELFObjHandler.cpp:80
llvm::MemoryBuffer::getFileSlice
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileSlice(const Twine &Filename, uint64_t MapSize, uint64_t Offset, bool IsVolatile=false)
Map a subrange of the specified file as a MemoryBuffer.
Definition: MemoryBuffer.cpp:154
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, JITEvaluatedSymbol >
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::orc::LocalCXXRuntimeOverridesBase::CXAAtExitOverride
static int CXAAtExitOverride(DestructorPtr Destructor, void *Arg, void *DSOHandle)
Definition: ExecutionUtils.cpp:175
llvm::orc::CtorDtorIterator::Element
Accessor for an element of the global_ctors/global_dtors array.
Definition: ExecutionUtils.h:55
llvm::orc::ObjectLayer::add
virtual Error add(ResourceTrackerSP RT, std::unique_ptr< MemoryBuffer > O)
Adds a MaterializationUnit representing the given IR to the given JITDylib.
Definition: Layer.cpp:164
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:1556
llvm::orc::CtorDtorIterator::operator!=
bool operator!=(const CtorDtorIterator &Other) const
Test iterators for inequality.
Definition: ExecutionUtils.cpp:35
getInitializer
static Constant * getInitializer(Constant *C)
Definition: Evaluator.cpp:203
llvm::orc::StaticLibraryDefinitionGenerator
A utility class to expose symbols from a static library.
Definition: ExecutionUtils.h:261
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::orc::StaticLibraryDefinitionGenerator::Create
static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Create(ObjectLayer &L, std::unique_ptr< MemoryBuffer > ArchiveBuffer)
Try to create a StaticLibrarySearchGenerator from the given memory buffer.
Definition: ExecutionUtils.cpp:328
llvm::ConstantStruct
Definition: Constants.h:456
llvm::orc::CtorDtorIterator::operator++
CtorDtorIterator & operator++()
Pre-increment iterator.
Definition: ExecutionUtils.cpp:39
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
llvm::orc::LookupState
Wraps state for a lookup-in-progress.
Definition: Core.h:848
llvm::Triple::UnknownVendor
@ UnknownVendor
Definition: Triple.h:145
llvm::orc::ItaniumCXAAtExitSupport::runAtExits
void runAtExits(void *DSOHandle)
Definition: ExecutionUtils.cpp:203
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:295
llvm::orc::ItaniumCXAAtExitSupport::registerAtExit
void registerAtExit(void(*F)(void *), void *Ctx, void *DSOHandle)
Definition: ExecutionUtils.cpp:197
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::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:80
llvm::ConstantExpr
A constant value that is initialized with an expression using other constant values.
Definition: Constants.h:936
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
std
Definition: BitVector.h:941
llvm::inconvertibleErrorCode
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Definition: Error.cpp:77
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
GlobalVariable.h
llvm::AArch64CC::LS
@ LS
Definition: AArch64BaseInfo.h:245
llvm::Triple::MachO
@ MachO
Definition: Triple.h:235
Function.h
llvm::orc::StaticLibraryDefinitionGenerator::tryToGenerate
Error tryToGenerate(LookupState &LS, LookupKind K, JITDylib &JD, JITDylibLookupFlags JDLookupFlags, const SymbolLookupSet &Symbols) override
DefinitionGenerators should override this method to insert new definitions into the parent JITDylib.
Definition: ExecutionUtils.cpp:341
llvm::orc::absoluteSymbols
std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols)
Create an AbsoluteSymbolsMaterializationUnit with the given symbols.
Definition: Core.h:716
llvm::JITTargetAddress
uint64_t JITTargetAddress
Represents an address in the target process's address space.
Definition: JITSymbol.h:42
llvm::orc::CtorDtorIterator::CtorDtorIterator
CtorDtorIterator(const GlobalVariable *GV, bool End)
Construct an iterator instance.
Definition: ExecutionUtils.cpp:24
llvm::GlobalValue::ExternalLinkage
@ ExternalLinkage
Externally visible function.
Definition: GlobalValue.h:48
llvm::orc::CtorDtorIterator::operator*
Element operator*() const
Dereference iterator.
Definition: ExecutionUtils.cpp:50
llvm::errorOrToExpected
Expected< T > errorOrToExpected(ErrorOr< T > &&EO)
Convert an ErrorOr<T> to an Expected<T>.
Definition: Error.h:1142
llvm::User::getNumOperands
unsigned getNumOperands() const
Definition: User.h:191
llvm::orc::JITDylib::define
Error define(std::unique_ptr< MaterializationUnitType > &&MU, ResourceTrackerSP RT=nullptr)
Define all symbols provided by the materialization unit to be part of this JITDylib.
Definition: Core.h:1531
llvm::orc::DynamicLibrarySearchGenerator::SymbolPredicate
std::function< bool(const SymbolStringPtr &)> SymbolPredicate
Definition: ExecutionUtils.h:220
llvm::orc::DynamicLibrarySearchGenerator::Load
static Expected< std::unique_ptr< DynamicLibrarySearchGenerator > > Load(const char *FileName, char GlobalPrefix, SymbolPredicate Allow=SymbolPredicate())
Permanently loads the library at the given path and, on success, returns a DynamicLibrarySearchGenera...
Definition: ExecutionUtils.cpp:227
llvm::orc::JITDylib::getExecutionSession
ExecutionSession & getExecutionSession() const
Get a reference to the ExecutionSession for this JITDylib.
Definition: Core.h:914
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::orc::LocalCXXRuntimeOverridesBase::toTargetAddress
JITTargetAddress toTargetAddress(PtrTy *P)
Definition: ExecutionUtils.h:180
llvm::object::createBinary
Expected< std::unique_ptr< Binary > > createBinary(MemoryBufferRef Source, LLVMContext *Context=nullptr, bool InitContent=true)
Create a Binary from Source, autodetecting the file type.
Definition: Binary.cpp:46
llvm::dyn_cast_or_null
LLVM_NODISCARD std::enable_if_t< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > dyn_cast_or_null(const Y &Val)
Definition: Casting.h:354
llvm::orc::JITDylibLookupFlags
JITDylibLookupFlags
Lookup flags that apply to each dylib in the search order for a lookup.
Definition: Core.h:124
llvm::MemoryBuffer::getFile
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, int64_t FileSize=-1, bool RequiresNullTerminator=true, bool IsVolatile=false)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
Definition: MemoryBuffer.cpp:245
llvm::User::getOperand
Value * getOperand(unsigned i) const
Definition: User.h:169
llvm::orc::CtorDtorRunner::run
Error run()
Definition: ExecutionUtils.cpp:140
llvm::orc::JITDylibLookupFlags::MatchAllSymbols
@ MatchAllSymbols
TargetRegistry.h
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::orc::makeJITDylibSearchOrder
JITDylibSearchOrder makeJITDylibSearchOrder(ArrayRef< JITDylib * > JDs, JITDylibLookupFlags Flags=JITDylibLookupFlags::MatchExportedSymbolsOnly)
Convenience function for creating a search order from an ArrayRef of JITDylib*, all with the same fla...
Definition: Core.h:155
llvm::iterator_range::begin
IteratorT begin() const
Definition: iterator_range.h:44
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1131
llvm::JITSymbolFlags::Exported
@ Exported
Definition: JITSymbol.h:85