Go to the documentation of this file.
13 #ifndef LLVM_EXECUTIONENGINE_ORC_EXECUTIONUTILS_H
14 #define LLVM_EXECUTIONENGINE_ORC_EXECUTIONUTILS_H
102 : I(
M.global_values().
begin()), E(
M.global_values().
end()),
103 ObjFmt(
Triple(
M.getTargetTriple()).getObjectFormat()) {
105 if (!isStaticInitGlobal(*I))
106 moveToNextStaticInitGlobal();
115 assert(I != E &&
"Increment past end of range");
116 moveToNextStaticInitGlobal();
124 void moveToNextStaticInitGlobal() {
126 while (I != E && !isStaticInitGlobal(*I))
149 using CtorDtorList = std::vector<SymbolStringPtr>;
150 using CtorDtorPriorityMap = std::map<unsigned, CtorDtorList>;
153 CtorDtorPriorityMap CtorDtorsByPriority;
207 std::mutex AtExitsMutex;
233 Load(
const char *FileName,
char GlobalPrefix,
296 std::unique_ptr<MemoryBuffer> ArchiveBuffer,
302 std::unique_ptr<MemoryBuffer> ArchiveBuffer;
303 std::unique_ptr<object::Archive> Archive;
309 #endif // LLVM_EXECUTIONENGINE_ORC_EXECUTIONUTILS_H
This is an optimization pass for GlobalISel generic memory operations.
Represents a JIT'd dynamic library.
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
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
void add(iterator_range< CtorDtorIterator > CtorDtors)
iterator_range< CtorDtorIterator > getConstructors(const Module &M)
Create an iterator range over the entries of the llvm.global_ctors array.
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
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Pointer to a pooled string representing a symbol name.
Triple - Helper class for working with autoconf configuration names.
StaticInitGVIterator(Module &M)
const_iterator end(StringRef path)
Get end iterator over path.
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Tagged union holding either a T or a Error.
CXXDestructorDataPairList DSOHandleOverride
LookupKind
Describes the kind of lookup being performed.
bool operator==(const CtorDtorIterator &Other) const
Test iterators for equality.
This class provides a portable interface to dynamic libraries which also might be known as shared lib...
This iterator provides a convenient way to iterate over the elements of an llvm.global_ctors/llvm....
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
DynamicLibrarySearchGenerator(sys::DynamicLibrary Dylib, char GlobalPrefix, SymbolPredicate Allow=SymbolPredicate())
Create a DynamicLibrarySearchGenerator that searches for symbols in the given sys::DynamicLibrary.
This iterator provides a convenient way to iterate over GlobalValues that have initialization effects...
Error enable(JITDylib &JD, MangleAndInterner &Mangler)
A utility class to expose symbols found via dlsym to the JIT.
ConstantArray - Constant Array Declarations.
StaticInitGVIterator()=default
Interface for Layers that accept object files.
An interface for Itanium __cxa_atexit interposer implementations.
iterator_range< StaticInitGVIterator > getStaticInitGVs(Module &M)
Create an iterator range over the GlobalValues that contribute to static initialization.
void runDestructors()
Run any destructors recorded by the overriden __cxa_atexit function (CXAAtExitOverride).
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.
std::vector< CXXDestructorDataPair > CXXDestructorDataPairList
void(*)(void *) DestructorPtr
iterator_range< CtorDtorIterator > getDestructors(const Module &M)
Create an iterator range over the entries of the llvm.global_ctors array.
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
static int CXAAtExitOverride(DestructorPtr Destructor, void *Arg, void *DSOHandle)
unique_function< Expected< MaterializationUnit::Interface >(ExecutionSession &ES, MemoryBufferRef ObjBuffer)> GetObjectFileInterface
Accessor for an element of the global_ctors/global_dtors array.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool operator!=(const CtorDtorIterator &Other) const
Test iterators for inequality.
A utility class to expose symbols from a static library.
print Print MemDeps of function
Definition generators can be attached to JITDylibs to generate new definitions for otherwise unresolv...
A Module instance is used to store all the information related to an LLVM module.
bool operator==(const StaticInitGVIterator &O) const
CtorDtorIterator & operator++()
Pre-increment iterator.
bool operator!=(const StaticInitGVIterator &O) const
Machine Check Debug Module
Wraps state for a lookup-in-progress.
static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Load(ObjectLayer &L, const char *FileName, GetObjectFileInterface GetObjFileInterface=GetObjectFileInterface())
Try to create a StaticLibraryDefinitionGenerator from the given path.
void runAtExits(void *DSOHandle)
void registerAtExit(void(*F)(void *), void *Ctx, void *DSOHandle)
Mangles symbol names then uniques them in the context of an ExecutionSession.
static Expected< std::unique_ptr< DynamicLibrarySearchGenerator > > GetForCurrentProcess(char GlobalPrefix, SymbolPredicate Allow=SymbolPredicate())
Creates a DynamicLibrarySearchGenerator that searches for symbols in the current process.
GlobalValue & operator*()
Lightweight error class with error context and mandatory checking.
An ExecutionSession represents a running JIT program.
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.
Element(unsigned Priority, Function *Func, Value *Data)
Support class for static dtor execution.
StaticInitGVIterator & operator++()
CtorDtorIterator(const GlobalVariable *GV, bool End)
Construct an iterator instance.
Element operator*() const
Dereference iterator.
std::function< bool(const SymbolStringPtr &)> SymbolPredicate
std::pair< DestructorPtr, void * > CXXDestructorDataPair
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...
A range adaptor for a pair of iterators.
JITTargetAddress toTargetAddress(PtrTy *P)
static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Create(ObjectLayer &L, std::unique_ptr< MemoryBuffer > ArchiveBuffer, GetObjectFileInterface GetObjFileInterface=GetObjectFileInterface())
Try to create a StaticLibrarySearchGenerator from the given memory buffer.
JITDylibLookupFlags
Lookup flags that apply to each dylib in the search order for a lookup.
concat_iterator< GlobalValue, iterator, global_iterator, alias_iterator, ifunc_iterator > global_value_iterator
LLVM Value Representation.
CtorDtorRunner(JITDylib &JD)