13 #ifndef LLVM_EXECUTIONENGINE_JITLINK_JITLINK_H 14 #define LLVM_EXECUTIONENGINE_JITLINK_JITLINK_H 32 #include <system_error> 64 KeepAlive = FirstKeepAlive,
72 : Target(&Target), Offset(Offset), Addend(Addend), K(K) {}
80 assert(isRelocation() &&
"Not a relocation edge");
81 return K - FirstRelocation;
106 : Address(Address), IsDefined(IsDefined), IsAbsolute(
false) {}
109 : Address(Address), IsDefined(
false), IsAbsolute(
true) {
110 assert(!(IsDefined && IsAbsolute) &&
111 "Block cannot be both defined and absolute");
125 bool isDefined()
const {
return static_cast<bool>(IsDefined); }
126 bool isAbsolute()
const {
return static_cast<bool>(IsAbsolute); }
130 uint64_t IsDefined : 1;
131 uint64_t IsAbsolute : 1;
143 uint64_t Alignment, uint64_t AlignmentOffset)
146 assert(AlignmentOffset < Alignment &&
147 "Alignment offset cannot exceed alignment");
148 assert(AlignmentOffset <= MaxAlignmentOffset &&
149 "Alignment offset exceeds maximum");
151 this->AlignmentOffset = AlignmentOffset;
156 uint64_t Alignment, uint64_t AlignmentOffset)
158 Size(Content.
size()) {
160 assert(AlignmentOffset < Alignment &&
161 "Alignment offset cannot exceed alignment");
162 assert(AlignmentOffset <= MaxAlignmentOffset &&
163 "Alignment offset exceeds maximum");
165 this->AlignmentOffset = AlignmentOffset;
192 assert(
Data &&
"Section does not contain content");
201 Size = Content.
size();
218 assert(AlignmentOffset < (1ull << P2Align) &&
219 "Alignment offset can't exceed alignment");
220 this->AlignmentOffset = AlignmentOffset;
226 Edges.push_back(
Edge(K, Offset, Target, Addend));
235 return make_range(Edges.begin(), Edges.end());
240 return make_range(Edges.begin(), Edges.end());
254 static constexpr uint64_t MaxAlignmentOffset = (1ULL << 57) - 1;
256 uint64_t P2Align : 5;
257 uint64_t AlignmentOffset : 57;
259 const char *
Data =
nullptr;
261 std::vector<Edge> Edges;
305 : Name(Name), Base(&Base), Offset(Offset), Size(Size) {
306 assert(Offset <= MaxOffset &&
"Offset out of range");
310 setCallable(IsCallable);
315 assert(SymStorage &&
"Storage cannot be null");
316 assert(!Name.
empty() &&
"Common symbol name cannot be empty");
318 "Cannot create common symbol from undefined block");
319 assert(static_cast<Block &>(Base).getSize() == Size &&
320 "Common symbol size should match underlying block size");
321 auto *Sym =
reinterpret_cast<Symbol *
>(SymStorage);
329 assert(SymStorage &&
"Storage cannot be null");
331 "Cannot create external symbol from defined block");
332 assert(!Name.
empty() &&
"External symbol name cannot be empty");
333 auto *Sym =
reinterpret_cast<Symbol *
>(SymStorage);
341 assert(SymStorage &&
"Storage cannot be null");
343 "Cannot create absolute symbol from a defined block");
344 auto *Sym =
reinterpret_cast<Symbol *
>(SymStorage);
345 new (Sym)
Symbol(Base, 0, Name, Size, L, S, IsLive,
false);
349 static Symbol &constructAnonDef(
void *SymStorage,
Block &Base,
353 assert(SymStorage &&
"Storage cannot be null");
354 assert(Offset < Base.
getSize() &&
"Symbol offset is outside block");
355 auto *Sym =
reinterpret_cast<Symbol *
>(SymStorage);
361 static Symbol &constructNamedDef(
void *SymStorage,
Block &Base,
364 bool IsLive,
bool IsCallable) {
365 assert(SymStorage &&
"Storage cannot be null");
366 assert(Offset < Base.
getSize() &&
"Symbol offset is outside block");
368 auto *Sym =
reinterpret_cast<Symbol *
>(SymStorage);
369 new (Sym)
Symbol(Base, Offset, Name, Size, L, S, IsLive, IsCallable);
391 "Anonymous symbol has non-local scope");
398 assert(Base &&
"Attempt to access null symbol");
405 assert(Base &&
"Attempting to access null symbol");
410 void setLive(
bool IsLive) { this->IsLive = IsLive; }
416 void setCallable(
bool IsCallable) { this->IsCallable = IsCallable; }
420 assert(Base &&
"Attempt to access null symbol");
426 assert(Base &&
"Attempt to access null symbol");
432 assert(Base &&
"Cannot get underlying addressable for null symbol");
438 assert(Base &&
"Cannot get underlying addressable for null symbol");
444 assert(Base &&
"Cannot get block for null symbol");
446 return static_cast<Block &
>(*Base);
451 assert(Base &&
"Cannot get block for null symbol");
453 return static_cast<const Block &
>(*Base);
472 return getBlock().getContent().
substr(Offset, Size);
481 "Linkage can only be applied to defined named symbols");
482 this->L =
static_cast<uint8_t
>(L);
491 "Invalid visibility for symbol type");
492 this->S =
static_cast<uint8_t
>(S);
497 assert(!A.
isDefined() &&
"Attempting to make external with defined block");
506 void setBlock(
Block &B) { Base = &
B; }
508 void setOffset(uint64_t NewOffset) {
509 assert(NewOffset <= MaxOffset &&
"Offset out of range");
513 static constexpr uint64_t MaxOffset = (1ULL << 59) - 1;
522 uint64_t IsCallable : 1;
538 : Name(Name), Prot(Prot), SecOrdinal(SecOrdinal) {}
563 return make_range(Blocks.begin(), Blocks.end());
568 return make_range(Blocks.begin(), Blocks.end());
573 return make_range(Symbols.begin(), Symbols.end());
578 return make_range(Symbols.begin(), Symbols.end());
585 void addSymbol(
Symbol &Sym) {
586 assert(!Symbols.count(&Sym) &&
"Symbol is already in this section");
587 Symbols.insert(&Sym);
590 void removeSymbol(
Symbol &Sym) {
591 assert(Symbols.count(&Sym) &&
"symbol is not in this section");
595 void addBlock(
Block &B) {
596 assert(!Blocks.count(&B) &&
"Block is already in this section");
600 void removeBlock(
Block &B) {
601 assert(Blocks.count(&B) &&
"Block is not in this section");
620 First = Last = *Sec.
blocks().begin();
621 for (
auto *B : Sec.
blocks()) {
629 assert((!Last || First) &&
"First can not be null if end is non-null");
633 assert((First || !Last) &&
"Last can not be null if start is non-null");
637 assert((First || !Last) &&
"Last can not be null if start is non-null");
641 return First ? First->getAddress() : 0;
644 return Last ? Last->getAddress() + Last->getSize() : 0;
646 uint64_t
getSize()
const {
return getEnd() - getStart(); }
649 Block *First =
nullptr;
650 Block *Last =
nullptr;
655 using SectionList = std::vector<std::unique_ptr<Section>>;
659 template <
typename... ArgTs>
672 template <
typename... ArgTs>
Block &createBlock(ArgTs &&...
Args) {
679 void destroyBlock(
Block &B) {
684 void destroySymbol(
Symbol &S) {
694 getSectionConstBlocks(
Section &S) {
699 getSectionSymbols(
Section &S) {
704 getSectionConstSymbols(
Section &S) {
714 template <
typename OuterItrT,
typename InnerItrT,
typename T,
716 typename OuterItrT::reference)>
719 nested_collection_iterator<OuterItrT, InnerItrT, T, getInnerRange>,
720 std::forward_iterator_tag, T> {
725 : OuterI(OuterI), OuterE(OuterE),
726 InnerI(getInnerBegin(OuterI, OuterE)) {
727 moveToNonEmptyInnerOrEnd();
731 return (OuterI == RHS.OuterI) && (InnerI == RHS.InnerI);
735 assert(InnerI != getInnerRange(*OuterI).end() &&
"Dereferencing end?");
741 moveToNonEmptyInnerOrEnd();
746 static InnerItrT getInnerBegin(OuterItrT OuterI, OuterItrT OuterE) {
747 return OuterI != OuterE ? getInnerRange(*OuterI).begin() : InnerItrT();
750 void moveToNonEmptyInnerOrEnd() {
751 while (OuterI != OuterE && InnerI == getInnerRange(*OuterI).end()) {
753 InnerI = getInnerBegin(OuterI, OuterE);
757 OuterItrT OuterI, OuterE;
769 getSectionConstSymbols>;
778 getSectionConstBlocks>;
782 : Name(
std::move(Name)), PointerSize(PointerSize),
783 Endianness(Endianness) {}
797 std::unique_ptr<Section> Sec(
new Section(Name, Prot, Sections.
size()));
798 Sections.push_back(std::move(Sec));
799 return *Sections.back();
804 uint64_t Address, uint64_t Alignment,
805 uint64_t AlignmentOffset) {
806 return createBlock(Parent, Content, Address, Alignment, AlignmentOffset);
811 uint64_t Alignment, uint64_t AlignmentOffset) {
812 return createBlock(Parent, Size, Address, Alignment, AlignmentOffset);
842 Block &
splitBlock(Block &B,
size_t SplitIndex,
854 Symbol::constructExternal(
Allocator.Allocate<Symbol>(),
855 createAddressable(0,
false), Name, Size, L);
856 ExternalSymbols.insert(&Sym);
863 auto &Sym = Symbol::constructAbsolute(
Allocator.Allocate<Symbol>(),
864 createAddressable(Address), Name,
866 AbsoluteSymbols.insert(&Sym);
873 uint64_t Alignment,
bool IsLive) {
874 auto &Sym = Symbol::constructCommon(
876 createBlock(Section, Size, Address, Alignment, 0), Name, Size, S,
878 Section.addSymbol(Sym);
886 auto &Sym = Symbol::constructAnonDef(
Allocator.Allocate<Symbol>(), Content,
887 Offset, Size, IsCallable, IsLive);
895 Scope S,
bool IsCallable,
bool IsLive) {
897 Symbol::constructNamedDef(
Allocator.Allocate<Symbol>(), Content, Offset,
898 Name, Size, L, S, IsLive, IsCallable);
911 for (
auto &S : sections())
928 return make_range(ExternalSymbols.begin(), ExternalSymbols.end());
932 return make_range(AbsoluteSymbols.begin(), AbsoluteSymbols.end());
949 assert(AbsoluteSymbols.count(&Sym) &&
950 "Sym is not in the absolute symbols set");
951 AbsoluteSymbols.erase(&Sym);
955 Sec.removeSymbol(Sym);
957 Sym.makeExternal(createAddressable(
false));
958 ExternalSymbols.insert(&Sym);
964 "Sym is not an external symbol");
965 assert(ExternalSymbols.count(&Sym) &&
"Symbol is not in the externals set");
966 ExternalSymbols.erase(&Sym);
969 destroyAddressable(Base);
975 "Sym is not an absolute symbol");
976 assert(AbsoluteSymbols.count(&Sym) &&
977 "Symbol is not in the absolute symbols set");
978 AbsoluteSymbols.erase(&Sym);
981 destroyAddressable(Base);
1012 unsigned PointerSize;
1014 SectionList Sections;
1035 template <
typename PredFn = decltype(includeAllBlocks)>
1044 if (
I != AddrToBlock.end()) {
1046 return overlapError(B, *
I->second);
1051 if (
I != AddrToBlock.begin()) {
1052 auto &PrevBlock = *std::prev(
I)->second;
1053 if (PrevBlock.getAddress() + PrevBlock.getSize() > B.
getAddress())
1054 return overlapError(B, PrevBlock);
1057 AddrToBlock.insert(
I, std::make_pair(B.
getAddress(), &
B));
1069 template <
typename BlockPtrRange,
1070 typename PredFn = decltype(includeAllBlocks)>
1072 for (
auto *B : Blocks)
1073 if (
auto Err = addBlock(*B, Pred))
1081 template <
typename BlockPtrRange>
1083 for (
auto *B : Blocks)
1084 addBlockWithoutChecking(*B);
1094 auto I = AddrToBlock.find(Addr);
1095 if (
I == AddrToBlock.end())
1103 auto I = AddrToBlock.upper_bound(Addr);
1104 if (
I == AddrToBlock.begin())
1106 auto *B = std::prev(
I)->second;
1107 if (Addr < B->getAddress() + B->
getSize())
1115 auto ExistingBlockEnd =
1117 return make_error<JITLinkError>(
1135 AddrToSymbols[Sym.
getAddress()].push_back(&Sym);
1139 template <
typename SymbolPtrCollection>
1141 for (
auto *Sym : Symbols)
1148 auto I = AddrToSymbols.find(Addr);
1149 if (
I == AddrToSymbols.end())
1155 std::map<JITTargetAddress, SymbolVector> AddrToSymbols;
1212 virtual void anchor();
1216 template <
typename Continuation>
1217 std::unique_ptr<JITLinkAsyncLookupContinuation>
1222 Impl(Continuation
C) :
C(std::move(C)) {}
1229 return std::make_unique<Impl>(std::move(Cont));
1249 virtual void notifyFailed(
Error Err) = 0;
1255 std::unique_ptr<JITLinkAsyncLookupContinuation> LC) = 0;
1261 virtual void notifyResolved(
LinkGraph &
G) = 0;
1268 notifyFinalized(std::unique_ptr<JITLinkMemoryManager::Allocation> A) = 0;
1274 virtual bool shouldAddDefaultTargetPasses(
const Triple &
TT)
const;
1296 void jitLink(std::unique_ptr<JITLinkContext> Ctx);
1301 #endif // LLVM_EXECUTIONENGINE_JITLINK_JITLINK_H Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface ...
Symbol & addDefinedSymbol(Block &Content, JITTargetAddress Offset, StringRef Name, JITTargetAddress Size, Linkage L, Scope S, bool IsCallable, bool IsLive)
Add a named symbol.
Block * getFirstBlock() const
void addSymbols(SymbolPtrCollection &&Symbols)
Add all symbols in a given range to the SymbolAddressMap.
EdgeVector::iterator edge_iterator
Base class for errors originating in JIT linker, e.g.
Linkage getLinkage() const
Get the linkage for this Symbol.
SymbolSet::iterator symbol_iterator
Error markAllSymbolsLive(LinkGraph &G)
Marks all symbols in a graph live.
This class represents lattice values for constants.
void setCallable(bool IsCallable)
Set this symbol's callable bit.
void addSymbol(Symbol &Sym)
Add a symbol to the SymbolAddressMap.
Block * getBlockCovering(JITTargetAddress Addr) const
Returns the block covering the given address, or nullptr if no such block exists. ...
const char * getGenericEdgeKindName(Edge::Kind K)
Returns the string name of the given generic edge kind, or "unknown" otherwise.
SectionRange(const Section &Sec)
Addressable(JITTargetAddress Address, bool IsDefined)
void setAlignment(uint64_t Alignment)
Set the alignment for this content.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
SymbolLookupFlags
Flags for symbol lookup.
ExternalSymbolSet::iterator external_symbol_iterator
Implements a dense probed hash-table based set.
std::unique_ptr< JITLinkAsyncLookupContinuation > createLookupContinuation(Continuation Cont)
Create a lookup continuation from a function object.
static bool lookup(const GsymReader &GR, DataExtractor &Data, uint64_t &Offset, uint64_t BaseAddr, uint64_t Addr, SourceLocations &SrcLocs, llvm::Error &Err)
A Lookup helper functions.
uint64_t getAlignment() const
Get the alignment for this content.
const Block & getBlock() const
Return the Block for this Symbol (Symbol must be defined).
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
constexpr support::endianness Endianness
The endianness of all multi-byte encoded values in MessagePack.
block Block Frequency true
OffsetT getOffset() const
AddrToBlockMap::const_iterator const_iterator
An Addressable with content and edges.
Block * getBlockAt(JITTargetAddress Addr) const
Returns the block starting at the given address, or nullptr if no such block exists.
void removeExternalSymbol(Symbol &Sym)
Removes an external symbol. Also removes the underlying Addressable.
void makeExternal(Symbol &Sym)
Turn a defined symbol into an external one.
void setLinkage(Linkage L)
Set the linkage for this Symbol.
void jitLink(std::unique_ptr< JITLinkContext > Ctx)
Basic JITLink implementation.
Symbol & addExternalSymbol(StringRef Name, uint64_t Size, Linkage L)
Add an external symbol.
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
Symbol & addAbsoluteSymbol(StringRef Name, JITTargetAddress Address, uint64_t Size, Linkage L, Scope S, bool IsLive)
Add an absolute symbol.
const Addressable & getAddressable() const
Return the addressable that thsi symbol points to.
StringRef getContent() const
Get the content for this block. Block must not be a zero-fill block.
unsigned countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1...
JITTargetAddress getAddress() const
bool isSymbolZeroFill() const
Returns true if this symbol is backed by a zero-fill block.
JITTargetAddress getStart() const
void setOffset(OffsetT Offset)
raw_ostream & operator<<(raw_ostream &OS, const Block &B)
JITLinkError(Twine ErrMsg)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Error addBlock(Block &B, PredFn Pred=includeAllBlocks)
Add a block to the map.
const_iterator end() const
Symbol & addAnonymousSymbol(Block &Content, JITTargetAddress Offset, JITTargetAddress Size, bool IsCallable, bool IsLive)
Add an anonymous symbol.
Block * getLastBlock() const
bool isAbsolute() const
Returns true if the underlying addressable is an absolute symbol.
Block & createZeroFillBlock(Section &Parent, uint64_t Size, uint64_t Address, uint64_t Alignment, uint64_t AlignmentOffset)
Create a zero-fill block.
unsigned getPointerSize() const
Returns the pointer size for use in this graph.
Tagged union holding either a T or a Error.
iterator_range< const_edge_iterator > edges() const
Returns the list of edges attached to this content.
void removeEdge(const_edge_iterator I)
Remove the edge pointed to by the given iterator.
LLVM_NODISCARD StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
BlockSet::const_iterator const_block_iterator
Symbol & getTarget() const
Symbol & addCommonSymbol(StringRef Name, Scope S, Section &Section, JITTargetAddress Address, uint64_t Size, uint64_t Alignment, bool IsLive)
Convenience method for adding a weak zero-fill symbol.
Manages allocations of JIT memory.
std::function< Error(LinkGraph &)> LinkGraphPassFunction
A function for mutating LinkGraphs.
bool isZeroFill() const
Returns true if this is a zero-fill block.
content_iterator< SectionRef > section_iterator
StringRef getName() const
Returns the name of this symbol (empty if the symbol is anonymous).
void addEdge(const Edge &E)
Add an edge by copying an existing one.
ConstIterator const_iterator
LLVM_NODISCARD size_t size() const
size - Get the string size.
bool isRelocation() const
nested_collection_iterator(OuterItrT OuterI, OuterItrT OuterE)
uint64_t JITTargetAddress
Represents an address in the target process's address space.
Addressable & getAddressable()
Return the addressable that this symbol points to.
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
bool isLive() const
Returns true if this symbol is live (i.e.
Represents a section address range via a pair of Block pointers to the first and last Blocks in the s...
SectionOrdinal getOrdinal() const
Returns the ordinal for this section.
A function object to call with a resolved symbol map (See AsyncLookupResult) or an error if resolutio...
iterator_range< section_iterator > sections()
iterator_range< symbol_iterator > symbols()
Returns an iterator over the symbols defined in this section.
iterator_range< block_iterator > blocks()
LinkGraphPassList PostFixupPasses
Post-fixup passes.
const std::string & getErrorMessage() const
Section * findSectionByName(StringRef Name)
Returns the section with the given name if it exists, otherwise returns null.
Represents an object file section.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
void setTarget(Symbol &Target)
Allocate memory in an ever growing pool, as if by bump-pointer.
const SymbolVector * getSymbolsAt(JITTargetAddress Addr) const
Returns the list of symbols that start at the given address, or nullptr if no such symbols exist...
Addressable(JITTargetAddress Address)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void setAddress(JITTargetAddress Address)
nested_collection_iterator operator++()
bool edges_empty() const
Returns true if the list of edges is empty.
bool isDefined() const
Returns true if this is a defined addressable, in which case you can downcast this to a ...
std::error_code convertToErrorCode() const override
Convert this error to a std::error_code.
void log(raw_ostream &OS) const override
Print an error message to an output stream.
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
StringRef getName() const
Returns the name of this section.
EdgeVector::const_iterator const_edge_iterator
Section & getSection() const
Return the parent section for this block.
static bool includeAllBlocks(const Block &B)
A block predicate that always adds all blocks.
iterator_range< block_iterator > blocks()
Returns an iterator over the blocks defined in this section.
support::endianness getEndianness() const
Returns the endianness of content in this graph.
LinkGraphPassList PostPrunePasses
Post-prune passes.
void removeBlock(Block &B)
Remove a block.
Section & createSection(StringRef Name, sys::Memory::ProtectionFlags Prot)
Create a section with the given name, protection flags, and alignment.
void setAlignmentOffset(uint64_t AlignmentOffset)
Set the alignment offset for this content.
void addBlockWithoutChecking(Block &B)
Add a block to the map without checking for overlap with existing blocks.
Triple - Helper class for working with autoconf configuration names.
iterator_range< const_symbol_iterator > symbols() const
Returns an iterator over the symbols defined in this section.
LinkGraphPassList PrePrunePasses
Pre-prune passes.
constexpr bool empty(const T &RangeOrContainer)
Test whether RangeOrContainer is empty. Similar to C++17 std::empty.
iterator_range< external_symbol_iterator > absolute_symbols()
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
static ErrorSuccess success()
Create a success value.
iterator_range< edge_iterator > edges()
Return the list of edges attached to this content.
JITTargetAddress getOffset() const
Returns the offset for this symbol within the underlying addressable.
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
JITTargetAddress getSize() const
Returns the size of this symbol.
bool isExternal() const
Returns true if the underlying addressable is an unresolved external.
void setScope(Scope S)
Set the visibility for this Symbol.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
A map of addresses to Symbols.
An iterator type that allows iterating over the pointees via some other iterator. ...
AddendT getAddend() const
JITTargetAddress getAddress() const
Returns the address of this symbol.
Kind getRelocation() const
BlockSet::iterator block_iterator
void setAddend(AddendT Addend)
SymbolSet::size_type symbols_size()
Return the number of symbols in this section.
sys::Memory::ProtectionFlags getProtectionFlags() const
Returns the protection flags for this section.
Enables easy lookup of blocks by addresses.
Block & getBlock()
Return the Block for this Symbol (Symbol must be defined).
A range adaptor for a pair of iterators.
JITTargetAddress getEnd() const
Target - Wrapper for Target specific information.
iterator_range< const_block_iterator > blocks() const
Base class for user error types.
Represents fixups and constraints in the LinkGraph.
Edge(Kind K, OffsetT Offset, Symbol &Target, AddendT Addend)
iterator_range< external_symbol_iterator > external_symbols()
void printEdge(raw_ostream &OS, const Block &B, const Edge &E, StringRef EdgeKindName)
static MachineBasicBlock & splitBlock(MachineBasicBlock &MBB, MachineInstr &SplitI, const X86InstrInfo &TII)
const_iterator begin() const
Iterates over (Address, Block*) pairs in ascending order of address.
Holds context for a single jitLink invocation.
void removeDefinedSymbol(Symbol &Sym)
Removes defined symbols. Does not remove the underlying block.
Block & createContentBlock(Section &Parent, StringRef Content, uint64_t Address, uint64_t Alignment, uint64_t AlignmentOffset)
Create a content block.
Linkage
Describes symbol linkage.
void setLive(bool IsLive)
Set this symbol's live bit.
bool isCallable() const
Returns true is this symbol is callable.
std::vector< Edge > EdgeVector
std::vector< LinkGraphPassFunction > LinkGraphPassList
A list of LinkGraph passes.
std::map< JITTargetAddress, Block * > AddrToBlockMap
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
void removeAbsoluteSymbol(Symbol &Sym)
Remove an absolute symbol. Also removes the underlying Addressable.
void setContent(StringRef Content)
Set the content for this block.
SymbolSet::const_iterator const_symbol_iterator
LinkGraph(std::string Name, unsigned PointerSize, support::endianness Endianness)
iterator_range< const_defined_symbol_iterator > defined_symbols() const
size_t edges_size() const
Return the size of the edges list.
Error addBlocks(BlockPtrRange &&Blocks, PredFn Pred=includeAllBlocks)
Add a range of blocks to the map.
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
An LinkGraph pass configuration, consisting of a list of pre-prune, post-prune, and post-fixup passes...
uint64_t getAlignmentOffset() const
Get the alignment offset for this content.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const std::string & getName()
Returns the name of this graph (usually the name of the original underlying MemoryBuffer).
const char * getScopeName(Scope S)
For debugging output.
bool operator==(const nested_collection_iterator &RHS) const
static bool includeNonNull(const Block &B)
A block predicate that always includes blocks with non-null addresses.
Lightweight error class with error context and mandatory checking.
This class implements an extremely fast bulk output stream that can only output to a stream...
Base class for Addressable entities (externals, absolutes, blocks).
size_t getSize() const
Returns the size of this defined addressable.
print Print MemDeps of function
bool isDefined() const
Returns true if this Symbol has content (potentially) defined within this object file (i...
StringRef - Represent a constant reference to a string, i.e.
iterator_range< defined_symbol_iterator > defined_symbols()
StringRef getSymbolContent() const
Returns the content in the underlying block covered by this symbol.
void addBlocksWithoutChecking(BlockPtrRange &&Blocks)
Add a range of blocks to the map without checking for overlap with existing blocks.
virtual ~JITLinkAsyncLookupContinuation()
const char * getLinkageName(Linkage L)
For errors and debugging output.
void addEdge(Edge::Kind K, Edge::OffsetT Offset, Symbol &Target, Edge::AddendT Addend)
Add an edge to this block.
bool hasName() const
Returns true if this symbol has a name.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Scope getScope() const
Get the visibility for this Symbol.
iterator_range< const_block_iterator > blocks() const
Returns an iterator over the blocks defined in this section.