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

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

Classes

class  defined_symbol_iterator_impl
 

Public Types

using external_symbol_iterator = ExternalSymbolSet::iterator
 
using block_iterator = BlockSet::iterator
 
using section_iterator = pointee_iterator< SectionList::iterator >
 
using const_section_iterator = pointee_iterator< SectionList::const_iterator >
 
using defined_symbol_iterator = defined_symbol_iterator_impl< const_section_iterator, Section::symbol_iterator, Symbol * >
 
using const_defined_symbol_iterator = defined_symbol_iterator_impl< const_section_iterator, Section::const_symbol_iterator, const Symbol * >
 

Public Member Functions

 LinkGraph (std::string Name, unsigned PointerSize, support::endianness Endianness)
 
 ~LinkGraph ()
 
const std::string & getName ()
 Returns the name of this graph (usually the name of the original underlying MemoryBuffer). More...
 
unsigned getPointerSize () const
 Returns the pointer size for use in this graph. More...
 
support::endianness getEndianness () const
 Returns the endianness of content in this graph. More...
 
SectioncreateSection (StringRef Name, sys::Memory::ProtectionFlags Prot)
 Create a section with the given name, protection flags, and alignment. More...
 
BlockcreateContentBlock (Section &Parent, StringRef Content, uint64_t Address, uint64_t Alignment, uint64_t AlignmentOffset)
 Create a content block. More...
 
BlockcreateZeroFillBlock (Section &Parent, uint64_t Size, uint64_t Address, uint64_t Alignment, uint64_t AlignmentOffset)
 Create a zero-fill block. More...
 
SymboladdExternalSymbol (StringRef Name, uint64_t Size)
 Add an external symbol. More...
 
SymboladdAbsoluteSymbol (StringRef Name, JITTargetAddress Address, uint64_t Size, Linkage L, Scope S, bool IsLive)
 Add an absolute symbol. More...
 
SymboladdCommonSymbol (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. More...
 
SymboladdAnonymousSymbol (Block &Content, JITTargetAddress Offset, JITTargetAddress Size, bool IsCallable, bool IsLive)
 Add an anonymous symbol. More...
 
SymboladdDefinedSymbol (Block &Content, JITTargetAddress Offset, StringRef Name, JITTargetAddress Size, Linkage L, Scope S, bool IsCallable, bool IsLive)
 Add a named symbol. More...
 
iterator_range< section_iteratorsections ()
 
SectionfindSectionByName (StringRef Name)
 Returns the section with the given name if it exists, otherwise returns null. More...
 
iterator_range< external_symbol_iteratorexternal_symbols ()
 
iterator_range< external_symbol_iteratorabsolute_symbols ()
 
iterator_range< defined_symbol_iteratordefined_symbols ()
 
iterator_range< const_defined_symbol_iteratordefined_symbols () const
 
iterator_range< block_iteratorblocks ()
 
void makeExternal (Symbol &Sym)
 Turn a defined symbol into an external one. More...
 
void removeExternalSymbol (Symbol &Sym)
 Removes an external symbol. Also removes the underlying Addressable. More...
 
void removeAbsoluteSymbol (Symbol &Sym)
 Remove an absolute symbol. Also removes the underlying Addressable. More...
 
void removeDefinedSymbol (Symbol &Sym)
 Removes defined symbols. Does not remove the underlying block. More...
 
void removeBlock (Block &B)
 Remove a block. More...
 
void dump (raw_ostream &OS, std::function< StringRef(Edge::Kind)> EdegKindToName=std::function< StringRef(Edge::Kind)>())
 Dump the graph. More...
 

Detailed Description

Definition at line 614 of file JITLink.h.

Member Typedef Documentation

◆ block_iterator

Definition at line 654 of file JITLink.h.

◆ const_defined_symbol_iterator

Definition at line 705 of file JITLink.h.

◆ const_section_iterator

Definition at line 657 of file JITLink.h.

◆ defined_symbol_iterator

Definition at line 702 of file JITLink.h.

◆ external_symbol_iterator

Definition at line 652 of file JITLink.h.

◆ section_iterator

Definition at line 656 of file JITLink.h.

Constructor & Destructor Documentation

◆ LinkGraph()

llvm::jitlink::LinkGraph::LinkGraph ( std::string  Name,
unsigned  PointerSize,
support::endianness  Endianness 
)
inline

Definition at line 707 of file JITLink.h.

◆ ~LinkGraph()

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

Definition at line 150 of file JITLink.cpp.

References B.

Member Function Documentation

◆ absolute_symbols()

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

◆ addAbsoluteSymbol()

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

Add an absolute symbol.

Definition at line 757 of file JITLink.h.

References Allocator.

◆ addAnonymousSymbol()

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

Add an anonymous symbol.

Definition at line 780 of file JITLink.h.

References Allocator, and llvm::jitlink::Block::getSection().

◆ addCommonSymbol()

Symbol& llvm::jitlink::LinkGraph::addCommonSymbol ( StringRef  Name,
Scope  S,
Section Section,
JITTargetAddress  Address,
uint64_t  Size,
uint64_t  Alignment,
bool  IsLive 
)
inline

Convenience method for adding a weak zero-fill symbol.

Definition at line 767 of file JITLink.h.

References Allocator, llvm::jitlink::Section::getNextBlockOrdinal(), and Size.

◆ addDefinedSymbol()

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

Add a named symbol.

Definition at line 790 of file JITLink.h.

References Allocator, and llvm::jitlink::Block::getSection().

◆ addExternalSymbol()

Symbol& llvm::jitlink::LinkGraph::addExternalSymbol ( StringRef  Name,
uint64_t  Size 
)
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'.

Definition at line 749 of file JITLink.h.

References Allocator.

◆ blocks()

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

◆ createContentBlock()

Block& llvm::jitlink::LinkGraph::createContentBlock ( Section Parent,
StringRef  Content,
uint64_t  Address,
uint64_t  Alignment,
uint64_t  AlignmentOffset 
)
inline

Create a content block.

Definition at line 732 of file JITLink.h.

References llvm::jitlink::Section::getNextBlockOrdinal().

◆ createSection()

Section& llvm::jitlink::LinkGraph::createSection ( StringRef  Name,
sys::Memory::ProtectionFlags  Prot 
)
inline

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

Definition at line 725 of file JITLink.h.

References llvm::ARMBuildAttrs::Section, and llvm::StringRef::size().

◆ createZeroFillBlock()

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

Create a zero-fill block.

Definition at line 740 of file JITLink.h.

References llvm::jitlink::Section::getNextBlockOrdinal(), and Size.

◆ defined_symbols() [1/2]

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

◆ defined_symbols() [2/2]

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

Definition at line 827 of file JITLink.h.

References llvm::make_range().

◆ dump()

void llvm::jitlink::LinkGraph::dump ( raw_ostream OS,
std::function< StringRef(Edge::Kind)>  EdegKindToName = std::function<StringRef(Edge::Kind)>() 
)

Dump the graph.

If supplied, the EdgeKindToName function will be used to name edge kinds in the debug output. Otherwise raw edge kind numbers will be displayed.

Definition at line 156 of file JITLink.cpp.

References E, llvm::StringRef::empty(), llvm::format(), llvm::jitlink::getGenericEdgeKindName(), llvm::jitlink::printEdge(), and llvm::to_string().

◆ external_symbols()

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

Definition at line 814 of file JITLink.h.

References llvm::make_range().

◆ 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 807 of file JITLink.h.

References llvm::jitlink::Symbol::getName(), and Name.

◆ getEndianness()

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

Returns the endianness of content in this graph.

Definition at line 722 of file JITLink.h.

References llvm::msgpack::Endianness.

◆ getName()

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

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

Definition at line 716 of file JITLink.h.

References Name.

◆ getPointerSize()

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

Returns the pointer size for use in this graph.

Definition at line 719 of file JITLink.h.

◆ makeExternal()

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

◆ removeAbsoluteSymbol()

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

Remove an absolute symbol. Also removes the underlying Addressable.

Definition at line 864 of file JITLink.h.

References assert(), llvm::jitlink::Symbol::isAbsolute(), and llvm::jitlink::Symbol::isDefined().

◆ removeBlock()

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

Remove a block.

Definition at line 883 of file JITLink.h.

References Allocator, llvm::dump(), llvm::msgpack::Endianness, function, and Name.

Referenced by llvm::jitlink::prune().

◆ removeDefinedSymbol()

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

Removes defined symbols. Does not remove the underlying block.

Definition at line 876 of file JITLink.h.

References assert(), llvm::jitlink::Symbol::getBlock(), llvm::jitlink::Block::getSection(), and llvm::jitlink::Symbol::isDefined().

Referenced by llvm::jitlink::prune().

◆ removeExternalSymbol()

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

Removes an external symbol. Also removes the underlying Addressable.

Definition at line 853 of file JITLink.h.

References assert(), llvm::jitlink::Symbol::isAbsolute(), and llvm::jitlink::Symbol::isDefined().

◆ sections()

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

Definition at line 800 of file JITLink.h.

References llvm::make_range().


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