LLVM 20.0.0git
Classes | Public Types | Public Member Functions | List of all members
llvm::jitlink::LinkGraph Class Reference

#include "llvm/ExecutionEngine/JITLink/JITLink.h"

Classes

class  nested_collection_iterator
 

Public Types

using external_symbol_iterator = mapped_iterator< ExternalSymbolMap::iterator, GetExternalSymbolMapEntryValue >
 
using absolute_symbol_iterator = AbsoluteSymbolSet::iterator
 
using section_iterator = mapped_iterator< SectionMap::iterator, GetSectionMapEntryValue >
 
using const_section_iterator = mapped_iterator< SectionMap::const_iterator, GetSectionMapEntryConstValue >
 
using defined_symbol_iterator = nested_collection_iterator< section_iterator, Section::symbol_iterator, Symbol *, getSectionSymbols >
 
using const_defined_symbol_iterator = nested_collection_iterator< const_section_iterator, Section::const_symbol_iterator, const Symbol *, getSectionConstSymbols >
 
using block_iterator = nested_collection_iterator< section_iterator, Section::block_iterator, Block *, getSectionBlocks >
 
using const_block_iterator = nested_collection_iterator< const_section_iterator, Section::const_block_iterator, const Block *, getSectionConstBlocks >
 
using GetEdgeKindNameFunction = const char *(*)(Edge::Kind)
 
using SplitBlockCache = std::optional< SmallVector< Symbol *, 8 > >
 Cache type for the splitBlock function.
 

Public Member Functions

 LinkGraph (std::string Name, std::shared_ptr< orc::SymbolStringPool > SSP, const Triple &TT, SubtargetFeatures Features, unsigned PointerSize, llvm::endianness Endianness, GetEdgeKindNameFunction GetEdgeKindName)
 
 LinkGraph (std::string Name, std::shared_ptr< orc::SymbolStringPool > SSP, const Triple &TT, unsigned PointerSize, llvm::endianness Endianness, GetEdgeKindNameFunction GetEdgeKindName)
 
 LinkGraph (std::string Name, std::shared_ptr< orc::SymbolStringPool > SSP, const Triple &TT, GetEdgeKindNameFunction GetEdgeKindName)
 
 LinkGraph (const LinkGraph &)=delete
 
LinkGraphoperator= (const LinkGraph &)=delete
 
 LinkGraph (LinkGraph &&)=delete
 
LinkGraphoperator= (LinkGraph &&)=delete
 
 ~LinkGraph ()
 
const std::string & getName () const
 Returns the name of this graph (usually the name of the original underlying MemoryBuffer).
 
const TriplegetTargetTriple () const
 Returns the target triple for this Graph.
 
const SubtargetFeaturesgetFeatures () const
 Return the subtarget features for this Graph.
 
unsigned getPointerSize () const
 Returns the pointer size for use in this graph.
 
llvm::endianness getEndianness () const
 Returns the endianness of content in this graph.
 
const chargetEdgeKindName (Edge::Kind K) const
 
std::shared_ptr< orc::SymbolStringPoolgetSymbolStringPool ()
 
MutableArrayRef< charallocateBuffer (size_t Size)
 Allocate a mutable buffer of the given size using the LinkGraph's allocator.
 
MutableArrayRef< charallocateContent (ArrayRef< char > Source)
 Allocate a copy of the given string using the LinkGraph's allocator.
 
MutableArrayRef< charallocateContent (Twine Source)
 Allocate a copy of the given string using the LinkGraph's allocator.
 
StringRef allocateName (Twine Source)
 Allocate a copy of the given string using the LinkGraph's allocator and return it as a StringRef.
 
MutableArrayRef< charallocateCString (StringRef Source)
 Allocate a copy of the given string using the LinkGraph's allocator.
 
MutableArrayRef< charallocateCString (Twine Source)
 Allocate a copy of the given string using the LinkGraph's allocator.
 
SectioncreateSection (StringRef Name, orc::MemProt Prot)
 Create a section with the given name, protection flags, and alignment.
 
BlockcreateContentBlock (Section &Parent, ArrayRef< char > Content, orc::ExecutorAddr Address, uint64_t Alignment, uint64_t AlignmentOffset)
 Create a content block.
 
BlockcreateMutableContentBlock (Section &Parent, MutableArrayRef< char > MutableContent, orc::ExecutorAddr Address, uint64_t Alignment, uint64_t AlignmentOffset)
 Create a content block with initially mutable data.
 
BlockcreateMutableContentBlock (Section &Parent, size_t ContentSize, orc::ExecutorAddr Address, uint64_t Alignment, uint64_t AlignmentOffset, bool ZeroInitialize=true)
 Create a content block with initially mutable data of the given size.
 
BlockcreateZeroFillBlock (Section &Parent, orc::ExecutorAddrDiff Size, orc::ExecutorAddr Address, uint64_t Alignment, uint64_t AlignmentOffset)
 Create a zero-fill block.
 
BinaryStreamReader getBlockContentReader (Block &B)
 Returns a BinaryStreamReader for the given block.
 
BinaryStreamWriter getBlockContentWriter (Block &B)
 Returns a BinaryStreamWriter for the given block.
 
template<typename SplitOffsetRange >
std::vector< Block * > splitBlock (Block &B, SplitOffsetRange &&SplitOffsets, LinkGraph::SplitBlockCache *Cache=nullptr)
 Splits block B into a sequence of smaller blocks.
 
orc::SymbolStringPtr intern (StringRef SymbolName)
 
SymboladdExternalSymbol (orc::SymbolStringPtr Name, orc::ExecutorAddrDiff Size, bool IsWeaklyReferenced)
 Add an external symbol.
 
SymboladdExternalSymbol (StringRef Name, orc::ExecutorAddrDiff Size, bool IsWeaklyReferenced)
 
SymboladdAbsoluteSymbol (orc::SymbolStringPtr Name, orc::ExecutorAddr Address, orc::ExecutorAddrDiff Size, Linkage L, Scope S, bool IsLive)
 Add an absolute symbol.
 
SymboladdAbsoluteSymbol (StringRef Name, orc::ExecutorAddr Address, orc::ExecutorAddrDiff Size, Linkage L, Scope S, bool IsLive)
 
SymboladdAnonymousSymbol (Block &Content, orc::ExecutorAddrDiff Offset, orc::ExecutorAddrDiff Size, bool IsCallable, bool IsLive)
 Add an anonymous symbol.
 
SymboladdDefinedSymbol (Block &Content, orc::ExecutorAddrDiff Offset, StringRef Name, orc::ExecutorAddrDiff Size, Linkage L, Scope S, bool IsCallable, bool IsLive)
 Add a named symbol.
 
SymboladdDefinedSymbol (Block &Content, orc::ExecutorAddrDiff Offset, orc::SymbolStringPtr Name, orc::ExecutorAddrDiff Size, Linkage L, Scope S, bool IsCallable, bool IsLive)
 
iterator_range< section_iteratorsections ()
 
iterator_range< const_section_iteratorsections () const
 
size_t sections_size () const
 
SectionfindSectionByName (StringRef Name)
 Returns the section with the given name if it exists, otherwise returns null.
 
iterator_range< block_iteratorblocks ()
 
iterator_range< const_block_iteratorblocks () const
 
iterator_range< external_symbol_iteratorexternal_symbols ()
 
iterator_range< absolute_symbol_iteratorabsolute_symbols ()
 
iterator_range< defined_symbol_iteratordefined_symbols ()
 
iterator_range< const_defined_symbol_iteratordefined_symbols () const
 
void makeExternal (Symbol &Sym)
 Make the given symbol external (must not already be external).
 
void makeAbsolute (Symbol &Sym, orc::ExecutorAddr Address)
 Make the given symbol an absolute with the given address (must not already be absolute).
 
void makeDefined (Symbol &Sym, Block &Content, orc::ExecutorAddrDiff Offset, orc::ExecutorAddrDiff Size, Linkage L, Scope S, bool IsLive)
 Turn an absolute or external symbol into a defined one by attaching it to a block.
 
void transferDefinedSymbol (Symbol &Sym, Block &DestBlock, orc::ExecutorAddrDiff NewOffset, std::optional< orc::ExecutorAddrDiff > ExplicitNewSize)
 Transfer a defined symbol from one block to another.
 
void transferBlock (Block &B, Section &NewSection)
 Transfers the given Block and all Symbols pointing to it to the given Section.
 
void mergeSections (Section &DstSection, Section &SrcSection, bool PreserveSrcSection=false)
 Move all blocks and symbols from the source section to the destination section.
 
void removeExternalSymbol (Symbol &Sym)
 Removes an external symbol. Also removes the underlying Addressable.
 
void removeAbsoluteSymbol (Symbol &Sym)
 Remove an absolute symbol. Also removes the underlying Addressable.
 
void removeDefinedSymbol (Symbol &Sym)
 Removes defined symbols. Does not remove the underlying block.
 
void removeBlock (Block &B)
 Remove a block.
 
void removeSection (Section &Sec)
 Remove a section.
 
orc::shared::AllocActionsallocActions ()
 Accessor for the AllocActions object for this graph.
 
void dump (raw_ostream &OS)
 Dump the graph.
 

Detailed Description

Definition at line 859 of file JITLink.h.

Member Typedef Documentation

◆ absolute_symbol_iterator

Definition at line 935 of file JITLink.h.

◆ block_iterator

Definition at line 998 of file JITLink.h.

◆ const_block_iterator

Definition at line 1002 of file JITLink.h.

◆ const_defined_symbol_iterator

Definition at line 993 of file JITLink.h.

◆ const_section_iterator

Definition at line 939 of file JITLink.h.

◆ defined_symbol_iterator

Definition at line 989 of file JITLink.h.

◆ external_symbol_iterator

Definition at line 932 of file JITLink.h.

◆ GetEdgeKindNameFunction

Definition at line 1007 of file JITLink.h.

◆ section_iterator

Definition at line 937 of file JITLink.h.

◆ SplitBlockCache

Cache type for the splitBlock function.

Definition at line 1191 of file JITLink.h.

Constructor & Destructor Documentation

◆ LinkGraph() [1/5]

llvm::jitlink::LinkGraph::LinkGraph ( std::string  Name,
std::shared_ptr< orc::SymbolStringPool SSP,
const Triple TT,
SubtargetFeatures  Features,
unsigned  PointerSize,
llvm::endianness  Endianness,
GetEdgeKindNameFunction  GetEdgeKindName 
)
inline

Definition at line 1009 of file JITLink.h.

◆ LinkGraph() [2/5]

llvm::jitlink::LinkGraph::LinkGraph ( std::string  Name,
std::shared_ptr< orc::SymbolStringPool SSP,
const Triple TT,
unsigned  PointerSize,
llvm::endianness  Endianness,
GetEdgeKindNameFunction  GetEdgeKindName 
)
inline

Definition at line 1017 of file JITLink.h.

◆ LinkGraph() [3/5]

llvm::jitlink::LinkGraph::LinkGraph ( std::string  Name,
std::shared_ptr< orc::SymbolStringPool SSP,
const Triple TT,
GetEdgeKindNameFunction  GetEdgeKindName 
)
inline

Definition at line 1023 of file JITLink.h.

References assert(), and llvm::Triple::getArchPointerBitWidth().

◆ LinkGraph() [4/5]

llvm::jitlink::LinkGraph::LinkGraph ( const LinkGraph )
delete

◆ LinkGraph() [5/5]

llvm::jitlink::LinkGraph::LinkGraph ( LinkGraph &&  )
delete

◆ ~LinkGraph()

llvm::jitlink::LinkGraph::~LinkGraph ( )

Member Function Documentation

◆ absolute_symbols()

iterator_range< absolute_symbol_iterator > llvm::jitlink::LinkGraph::absolute_symbols ( )
inline

◆ addAbsoluteSymbol() [1/2]

Symbol & llvm::jitlink::LinkGraph::addAbsoluteSymbol ( orc::SymbolStringPtr  Name,
orc::ExecutorAddr  Address,
orc::ExecutorAddrDiff  Size,
Linkage  L,
Scope  S,
bool  IsLive 
)
inline

◆ addAbsoluteSymbol() [2/2]

Symbol & llvm::jitlink::LinkGraph::addAbsoluteSymbol ( StringRef  Name,
orc::ExecutorAddr  Address,
orc::ExecutorAddrDiff  Size,
Linkage  L,
Scope  S,
bool  IsLive 
)
inline

Definition at line 1316 of file JITLink.h.

References addAbsoluteSymbol(), llvm::Address, and Size.

◆ addAnonymousSymbol()

Symbol & llvm::jitlink::LinkGraph::addAnonymousSymbol ( Block Content,
orc::ExecutorAddrDiff  Offset,
orc::ExecutorAddrDiff  Size,
bool  IsCallable,
bool  IsLive 
)
inline

Add an anonymous symbol.

Definition at line 1324 of file JITLink.h.

References Allocator, Content, llvm::Offset, Size, and Sym.

◆ addDefinedSymbol() [1/2]

Symbol & llvm::jitlink::LinkGraph::addDefinedSymbol ( Block Content,
orc::ExecutorAddrDiff  Offset,
orc::SymbolStringPtr  Name,
orc::ExecutorAddrDiff  Size,
Linkage  L,
Scope  S,
bool  IsCallable,
bool  IsLive 
)
inline

◆ addDefinedSymbol() [2/2]

Symbol & llvm::jitlink::LinkGraph::addDefinedSymbol ( Block Content,
orc::ExecutorAddrDiff  Offset,
StringRef  Name,
orc::ExecutorAddrDiff  Size,
Linkage  L,
Scope  S,
bool  IsCallable,
bool  IsLive 
)
inline

Add a named symbol.

Definition at line 1334 of file JITLink.h.

References addDefinedSymbol(), Content, llvm::Offset, and Size.

Referenced by addDefinedSymbol().

◆ addExternalSymbol() [1/2]

Symbol & llvm::jitlink::LinkGraph::addExternalSymbol ( orc::SymbolStringPtr  Name,
orc::ExecutorAddrDiff  Size,
bool  IsWeaklyReferenced 
)
inline

Add an external symbol.

Some formats (e.g. ELF) allow Symbols to have sizes. For Symbols whose size is not known, you should substitute '0'. The IsWeaklyReferenced argument determines whether the symbol must be present during lookup: Externals that are strongly referenced must be found or an error will be emitted. Externals that are weakly referenced are permitted to be undefined, in which case they are assigned an address of 0.

Definition at line 1284 of file JITLink.h.

References Allocator, assert(), llvm::StringMap< ValueTy, AllocatorTy >::contains(), llvm::StringMap< ValueTy, AllocatorTy >::insert(), Size, llvm::jitlink::Strong, and Sym.

Referenced by addExternalSymbol().

◆ addExternalSymbol() [2/2]

Symbol & llvm::jitlink::LinkGraph::addExternalSymbol ( StringRef  Name,
orc::ExecutorAddrDiff  Size,
bool  IsWeaklyReferenced 
)
inline

Definition at line 1295 of file JITLink.h.

References addExternalSymbol(), and Size.

◆ allocActions()

orc::shared::AllocActions & llvm::jitlink::LinkGraph::allocActions ( )
inline

Accessor for the AllocActions object for this graph.

This can be used to register allocation action calls prior to finalization.

Accessing this object after finalization will result in undefined behavior.

Definition at line 1625 of file JITLink.h.

Referenced by llvm::orc::EPCGenericJITLinkMemoryManager::InFlightAlloc::finalize(), llvm::orc::MapperJITLinkMemoryManager::InFlightAlloc::finalize(), llvm::jitlink::InProcessMemoryManager::IPInFlightAlloc::finalize(), and llvm::jitlink::BasicLayout::graphAllocActions().

◆ allocateBuffer()

MutableArrayRef< char > llvm::jitlink::LinkGraph::allocateBuffer ( size_t  Size)
inline

Allocate a mutable buffer of the given size using the LinkGraph's allocator.

Definition at line 1061 of file JITLink.h.

References Allocator, and Size.

Referenced by createMutableContentBlock().

◆ allocateContent() [1/2]

MutableArrayRef< char > llvm::jitlink::LinkGraph::allocateContent ( ArrayRef< char Source)
inline

Allocate a copy of the given string using the LinkGraph's allocator.

This can be useful when renaming symbols or adding new content to the graph.

Definition at line 1068 of file JITLink.h.

References Allocator, and llvm::copy().

Referenced by allocateName().

◆ allocateContent() [2/2]

MutableArrayRef< char > llvm::jitlink::LinkGraph::allocateContent ( Twine  Source)
inline

Allocate a copy of the given string using the LinkGraph's allocator.

This can be useful when renaming symbols or adding new content to the graph.

Note: This Twine-based overload requires an extra string copy and an extra heap allocation for large strings. The ArrayRef<char> overload should be preferred where possible.

Definition at line 1081 of file JITLink.h.

References Allocator, and llvm::copy().

◆ allocateCString() [1/2]

MutableArrayRef< char > llvm::jitlink::LinkGraph::allocateCString ( StringRef  Source)
inline

Allocate a copy of the given string using the LinkGraph's allocator.

The allocated string will be terminated with a null character, and the returned MutableArrayRef will include this null character in the last position.

Definition at line 1104 of file JITLink.h.

References Allocator, and llvm::copy().

◆ allocateCString() [2/2]

MutableArrayRef< char > llvm::jitlink::LinkGraph::allocateCString ( Twine  Source)
inline

Allocate a copy of the given string using the LinkGraph's allocator.

The allocated string will be terminated with a null character, and the returned MutableArrayRef will include this null character in the last position.

Note: This Twine-based overload requires an extra string copy and an extra heap allocation for large strings. The ArrayRef<char> overload should be preferred where possible.

Definition at line 1120 of file JITLink.h.

References Allocator, and llvm::copy().

◆ allocateName()

StringRef llvm::jitlink::LinkGraph::allocateName ( Twine  Source)
inline

Allocate a copy of the given string using the LinkGraph's allocator and return it as a StringRef.

This is a convenience wrapper around allocateContent(Twine) that is handy when creating new symbol names within the graph.

Definition at line 1094 of file JITLink.h.

References allocateContent().

◆ blocks() [1/2]

iterator_range< block_iterator > llvm::jitlink::LinkGraph::blocks ( )
inline

◆ blocks() [2/2]

iterator_range< const_block_iterator > llvm::jitlink::LinkGraph::blocks ( ) const
inline

Definition at line 1387 of file JITLink.h.

References llvm::make_range(), and sections().

◆ createContentBlock()

Block & llvm::jitlink::LinkGraph::createContentBlock ( Section Parent,
ArrayRef< char Content,
orc::ExecutorAddr  Address,
uint64_t  Alignment,
uint64_t  AlignmentOffset 
)
inline

Create a content block.

Definition at line 1137 of file JITLink.h.

References llvm::Address, and Content.

Referenced by splitBlock().

◆ createMutableContentBlock() [1/2]

Block & llvm::jitlink::LinkGraph::createMutableContentBlock ( Section Parent,
MutableArrayRef< char MutableContent,
orc::ExecutorAddr  Address,
uint64_t  Alignment,
uint64_t  AlignmentOffset 
)
inline

Create a content block with initially mutable data.

Definition at line 1144 of file JITLink.h.

References llvm::Address.

◆ createMutableContentBlock() [2/2]

Block & llvm::jitlink::LinkGraph::createMutableContentBlock ( Section Parent,
size_t  ContentSize,
orc::ExecutorAddr  Address,
uint64_t  Alignment,
uint64_t  AlignmentOffset,
bool  ZeroInitialize = true 
)
inline

Create a content block with initially mutable data of the given size.

Content will be allocated via the LinkGraph's allocateBuffer method. By default the memory will be zero-initialized. Passing false for ZeroInitialize will prevent this.

Definition at line 1157 of file JITLink.h.

References llvm::Address, allocateBuffer(), and Content.

◆ createSection()

Section & llvm::jitlink::LinkGraph::createSection ( StringRef  Name,
orc::MemProt  Prot 
)
inline

Create a section with the given name, protection flags, and alignment.

Definition at line 1130 of file JITLink.h.

References assert().

◆ createZeroFillBlock()

Block & llvm::jitlink::LinkGraph::createZeroFillBlock ( Section Parent,
orc::ExecutorAddrDiff  Size,
orc::ExecutorAddr  Address,
uint64_t  Alignment,
uint64_t  AlignmentOffset 
)
inline

Create a zero-fill block.

Definition at line 1168 of file JITLink.h.

References llvm::Address, and Size.

Referenced by splitBlock().

◆ defined_symbols() [1/2]

iterator_range< defined_symbol_iterator > llvm::jitlink::LinkGraph::defined_symbols ( )
inline

Definition at line 1405 of file JITLink.h.

References llvm::make_range(), and sections().

Referenced by addDefinedSymbol(), and dump().

◆ defined_symbols() [2/2]

iterator_range< const_defined_symbol_iterator > llvm::jitlink::LinkGraph::defined_symbols ( ) const
inline

Definition at line 1411 of file JITLink.h.

References llvm::make_range(), and sections().

◆ dump()

void llvm::jitlink::LinkGraph::dump ( raw_ostream OS)

Dump the graph.

Definition at line 279 of file JITLink.cpp.

References defined_symbols(), LHS, RHS, llvm::sort(), and Sym.

◆ external_symbols()

iterator_range< external_symbol_iterator > llvm::jitlink::LinkGraph::external_symbols ( )
inline

◆ findSectionByName()

Section * llvm::jitlink::LinkGraph::findSectionByName ( StringRef  Name)
inline

Returns the section with the given name if it exists, otherwise returns null.

Definition at line 1374 of file JITLink.h.

References I.

◆ getBlockContentReader()

BinaryStreamReader llvm::jitlink::LinkGraph::getBlockContentReader ( Block B)
inline

Returns a BinaryStreamReader for the given block.

Definition at line 1175 of file JITLink.h.

References B, llvm::CallingConv::C, and getEndianness().

◆ getBlockContentWriter()

BinaryStreamWriter llvm::jitlink::LinkGraph::getBlockContentWriter ( Block B)
inline

Returns a BinaryStreamWriter for the given block.

This will call getMutableContent to obtain mutable content for the block.

Definition at line 1183 of file JITLink.h.

References B, llvm::CallingConv::C, and getEndianness().

◆ getEdgeKindName()

const char * llvm::jitlink::LinkGraph::getEdgeKindName ( Edge::Kind  K) const
inline

◆ getEndianness()

llvm::endianness llvm::jitlink::LinkGraph::getEndianness ( ) const
inline

Returns the endianness of content in this graph.

Definition at line 1053 of file JITLink.h.

Referenced by getBlockContentReader(), and getBlockContentWriter().

◆ getFeatures()

const SubtargetFeatures & llvm::jitlink::LinkGraph::getFeatures ( ) const
inline

Return the subtarget features for this Graph.

Definition at line 1047 of file JITLink.h.

◆ getName()

const std::string & llvm::jitlink::LinkGraph::getName ( ) const
inline

Returns the name of this graph (usually the name of the original underlying MemoryBuffer).

Definition at line 1041 of file JITLink.h.

Referenced by llvm::orc::GDBJITDebugInfoRegistrationPlugin::modifyPassConfig().

◆ getPointerSize()

unsigned llvm::jitlink::LinkGraph::getPointerSize ( ) const
inline

Returns the pointer size for use in this graph.

Definition at line 1050 of file JITLink.h.

◆ getSymbolStringPool()

std::shared_ptr< orc::SymbolStringPool > llvm::jitlink::LinkGraph::getSymbolStringPool ( )
inline

Definition at line 1057 of file JITLink.h.

◆ getTargetTriple()

const Triple & llvm::jitlink::LinkGraph::getTargetTriple ( ) const
inline

Returns the target triple for this Graph.

Definition at line 1044 of file JITLink.h.

Referenced by llvm::orc::GDBJITDebugInfoRegistrationPlugin::modifyPassConfig().

◆ intern()

orc::SymbolStringPtr llvm::jitlink::LinkGraph::intern ( StringRef  SymbolName)
inline

Definition at line 1273 of file JITLink.h.

◆ makeAbsolute()

void llvm::jitlink::LinkGraph::makeAbsolute ( Symbol Sym,
orc::ExecutorAddr  Address 
)
inline

Make the given symbol an absolute with the given address (must not already be absolute).

The symbol's size, linkage, and callability, and liveness will be left unchanged, and its offset will be reset to 0.

If the symbol was external then its scope will be set to local, otherwise it will be left unchanged.

Definition at line 1448 of file JITLink.h.

References A, llvm::Address, assert(), llvm::StringMap< ValueTy, AllocatorTy >::contains(), llvm::StringMap< ValueTy, AllocatorTy >::erase(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::jitlink::Local, and Sym.

◆ makeDefined()

void llvm::jitlink::LinkGraph::makeDefined ( Symbol Sym,
Block Content,
orc::ExecutorAddrDiff  Offset,
orc::ExecutorAddrDiff  Size,
Linkage  L,
Scope  S,
bool  IsLive 
)
inline

◆ makeExternal()

void llvm::jitlink::LinkGraph::makeExternal ( Symbol Sym)
inline

Make the given symbol external (must not already be external).

Symbol size, linkage and callability will be left unchanged. Symbol scope will be set to Default, and offset will be reset to 0.

Definition at line 1421 of file JITLink.h.

References A, assert(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::count(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::erase(), llvm::StringMap< ValueTy, AllocatorTy >::insert(), and Sym.

◆ mergeSections()

void llvm::jitlink::LinkGraph::mergeSections ( Section DstSection,
Section SrcSection,
bool  PreserveSrcSection = false 
)
inline

Move all blocks and symbols from the source section to the destination section.

If PreserveSrcSection is true (or SrcSection and DstSection are the same) then SrcSection is preserved, otherwise it is removed (the default).

Definition at line 1551 of file JITLink.h.

References B, llvm::jitlink::Section::blocks(), and removeSection().

◆ operator=() [1/2]

LinkGraph & llvm::jitlink::LinkGraph::operator= ( const LinkGraph )
delete

◆ operator=() [2/2]

LinkGraph & llvm::jitlink::LinkGraph::operator= ( LinkGraph &&  )
delete

◆ removeAbsoluteSymbol()

void llvm::jitlink::LinkGraph::removeAbsoluteSymbol ( Symbol Sym)
inline

◆ removeBlock()

void llvm::jitlink::LinkGraph::removeBlock ( Block B)
inline

Remove a block.

The block reference is defunct after calling this function and should no longer be used.

Definition at line 1601 of file JITLink.h.

References assert(), B, llvm::none_of(), and Sym.

◆ removeDefinedSymbol()

void llvm::jitlink::LinkGraph::removeDefinedSymbol ( Symbol Sym)
inline

Removes defined symbols. Does not remove the underlying block.

Definition at line 1593 of file JITLink.h.

References assert(), and Sym.

◆ removeExternalSymbol()

void llvm::jitlink::LinkGraph::removeExternalSymbol ( Symbol Sym)
inline

◆ removeSection()

void llvm::jitlink::LinkGraph::removeSection ( Section Sec)
inline

Remove a section.

The section reference is defunct after calling this function and should no longer be used.

Definition at line 1613 of file JITLink.h.

References assert(), and llvm::jitlink::Section::getName().

Referenced by mergeSections().

◆ sections() [1/2]

iterator_range< section_iterator > llvm::jitlink::LinkGraph::sections ( )
inline

◆ sections() [2/2]

iterator_range< const_section_iterator > llvm::jitlink::LinkGraph::sections ( ) const
inline

Definition at line 1363 of file JITLink.h.

References llvm::make_range().

◆ sections_size()

size_t llvm::jitlink::LinkGraph::sections_size ( ) const
inline

Definition at line 1370 of file JITLink.h.

◆ splitBlock()

template<typename SplitOffsetRange >
std::vector< Block * > llvm::jitlink::LinkGraph::splitBlock ( Block B,
SplitOffsetRange &&  SplitOffsets,
LinkGraph::SplitBlockCache Cache = nullptr 
)
inline

Splits block B into a sequence of smaller blocks.

SplitOffsets should be a sequence of ascending offsets in B. The starting offset should be greater than zero, and the final offset less than B.getSize() - 1.

The resulting seqeunce of blocks will start with the original block B (truncated to end at the first split offset) followed by newly introduced blocks starting at the subsequent split points.

The optional Cache parameter can be used to speed up repeated calls to splitBlock for blocks within a single Section. If the value is None then the cache will be treated as uninitialized and splitBlock will populate it. Otherwise it is assumed to contain the list of Symbols pointing at B, sorted in descending order of offset.

Notes:

  1. splitBlock must be used with care. Splitting a block may cause incoming edges to become invalid if the edge target subexpression points outside the bounds of the newly split target block (E.g. an edge 'S + 10 : Pointer64' where S points to a newly split block whose size is less than 10). No attempt is made to detect invalidation of incoming edges, as in general this requires context that the LinkGraph does not have. Clients are responsible for ensuring that splitBlock is not used in a way that invalidates edges.
  2. The newly introduced blocks will have new ordinals that will be higher than any other ordinals in the section. Clients are responsible for re-assigning block ordinals to restore a compatible order if needed.
  3. The cache is not automatically updated if new symbols are introduced between calls to splitBlock. Any newly introduced symbols may be added to the cache manually (descending offset order must be preserved), or the cache can be set to None and rebuilt by splitBlock on the next call.

Definition at line 1231 of file JITLink.h.

References assert(), B, Blocks, createContentBlock(), createZeroFillBlock(), and llvm::Offset.

◆ transferBlock()

void llvm::jitlink::LinkGraph::transferBlock ( Block B,
Section NewSection 
)
inline

Transfers the given Block and all Symbols pointing to it to the given Section.

No attempt is made to check compatibility of the source and destination sections. Blocks may be moved between sections with incompatible permissions (e.g. from data to text). The client is responsible for ensuring that this is safe.

Definition at line 1530 of file JITLink.h.

References B, llvm::jitlink::Symbol::getBlock(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().

◆ transferDefinedSymbol()

void llvm::jitlink::LinkGraph::transferDefinedSymbol ( Symbol Sym,
Block DestBlock,
orc::ExecutorAddrDiff  NewOffset,
std::optional< orc::ExecutorAddrDiff ExplicitNewSize 
)
inline

Transfer a defined symbol from one block to another.

The symbol's offset within DestBlock is set to NewOffset.

If ExplicitNewSize is given as None then the size of the symbol will be checked and auto-truncated to at most the size of the remainder (from the given offset) of the size of the new block.

All other symbol attributes are unchanged.

Definition at line 1504 of file JITLink.h.

References llvm::jitlink::Block::getSection(), llvm::jitlink::Block::getSize(), and Sym.


The documentation for this class was generated from the following files: