LLVM  13.0.0git
Public Types | Public Member Functions | Friends | List of all members
llvm::jitlink::Block Class Reference

An Addressable with content and edges. More...

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

Inheritance diagram for llvm::jitlink::Block:
Inheritance graph
[legend]
Collaboration diagram for llvm::jitlink::Block:
Collaboration graph
[legend]

Public Types

using EdgeVector = std::vector< Edge >
 
using edge_iterator = EdgeVector::iterator
 
using const_edge_iterator = EdgeVector::const_iterator
 

Public Member Functions

 Block (const Block &)=delete
 
Blockoperator= (const Block &)=delete
 
 Block (Block &&)=delete
 
Blockoperator= (Block &&)=delete
 
SectiongetSection () const
 Return the parent section for this block. More...
 
bool isZeroFill () const
 Returns true if this is a zero-fill block. More...
 
size_t getSize () const
 Returns the size of this defined addressable. More...
 
ArrayRef< char > getContent () const
 Get the content for this block. Block must not be a zero-fill block. More...
 
void setContent (ArrayRef< char > Content)
 Set the content for this block. More...
 
MutableArrayRef< char > getMutableContent (LinkGraph &G)
 Get mutable content for this block. More...
 
MutableArrayRef< char > getAlreadyMutableContent ()
 Get mutable content for this block. More...
 
void setMutableContent (MutableArrayRef< char > MutableContent)
 Set mutable content for this block. More...
 
bool isContentMutable () const
 Returns true if this block's content is mutable. More...
 
uint64_t getAlignment () const
 Get the alignment for this content. More...
 
void setAlignment (uint64_t Alignment)
 Set the alignment for this content. More...
 
uint64_t getAlignmentOffset () const
 Get the alignment offset for this content. More...
 
void setAlignmentOffset (uint64_t AlignmentOffset)
 Set the alignment offset for this content. More...
 
void addEdge (Edge::Kind K, Edge::OffsetT Offset, Symbol &Target, Edge::AddendT Addend)
 Add an edge to this block. More...
 
void addEdge (const Edge &E)
 Add an edge by copying an existing one. More...
 
iterator_range< edge_iteratoredges ()
 Return the list of edges attached to this content. More...
 
iterator_range< const_edge_iteratoredges () const
 Returns the list of edges attached to this content. More...
 
size_t edges_size () const
 Return the size of the edges list. More...
 
bool edges_empty () const
 Returns true if the list of edges is empty. More...
 
edge_iterator removeEdge (edge_iterator I)
 Remove the edge pointed to by the given iterator. More...
 
JITTargetAddress getFixupAddress (const Edge &E) const
 Returns the address of the fixup for the given edge, which is equal to this block's address plus the edge's offset. More...
 

Friends

class LinkGraph
 

Additional Inherited Members

Detailed Description

An Addressable with content and edges.

Definition at line 150 of file JITLink.h.

Member Typedef Documentation

◆ const_edge_iterator

using llvm::jitlink::Block::const_edge_iterator = EdgeVector::const_iterator

Definition at line 207 of file JITLink.h.

◆ edge_iterator

using llvm::jitlink::Block::edge_iterator = EdgeVector::iterator

Definition at line 206 of file JITLink.h.

◆ EdgeVector

using llvm::jitlink::Block::EdgeVector = std::vector<Edge>

Definition at line 205 of file JITLink.h.

Constructor & Destructor Documentation

◆ Block() [1/2]

llvm::jitlink::Block::Block ( const Block )
delete

◆ Block() [2/2]

llvm::jitlink::Block::Block ( Block &&  )
delete

Member Function Documentation

◆ addEdge() [1/2]

void llvm::jitlink::Block::addEdge ( const Edge E)
inline

Add an edge by copying an existing one.

This is typically used when moving edges between blocks.

Definition at line 303 of file JITLink.h.

References E.

◆ addEdge() [2/2]

void llvm::jitlink::Block::addEdge ( Edge::Kind  K,
Edge::OffsetT  Offset,
Symbol Target,
Edge::AddendT  Addend 
)
inline

Add an edge to this block.

Definition at line 296 of file JITLink.h.

References Offset.

◆ edges() [1/2]

iterator_range<edge_iterator> llvm::jitlink::Block::edges ( )
inline

Return the list of edges attached to this content.

Definition at line 306 of file JITLink.h.

References llvm::make_range().

◆ edges() [2/2]

iterator_range<const_edge_iterator> llvm::jitlink::Block::edges ( ) const
inline

Returns the list of edges attached to this content.

Definition at line 311 of file JITLink.h.

References llvm::make_range().

◆ edges_empty()

bool llvm::jitlink::Block::edges_empty ( ) const
inline

Returns true if the list of edges is empty.

Definition at line 319 of file JITLink.h.

◆ edges_size()

size_t llvm::jitlink::Block::edges_size ( ) const
inline

Return the size of the edges list.

Definition at line 316 of file JITLink.h.

◆ getAlignment()

uint64_t llvm::jitlink::Block::getAlignment ( ) const
inline

Get the alignment for this content.

Definition at line 277 of file JITLink.h.

References llvm::jitlink::Addressable::P2Align.

◆ getAlignmentOffset()

uint64_t llvm::jitlink::Block::getAlignmentOffset ( ) const
inline

Get the alignment offset for this content.

Definition at line 286 of file JITLink.h.

References llvm::jitlink::Addressable::AlignmentOffset.

◆ getAlreadyMutableContent()

MutableArrayRef<char> llvm::jitlink::Block::getAlreadyMutableContent ( )
inline

Get mutable content for this block.

This block's content must already be mutable. It is a programmatic error to call this on a block with immutable content – consider using getMutableContent instead.

Definition at line 253 of file JITLink.h.

References assert(), llvm::jitlink::Addressable::ContentMutable, llvm::Data, and llvm::Check::Size.

◆ getContent()

ArrayRef<char> llvm::jitlink::Block::getContent ( ) const
inline

Get the content for this block. Block must not be a zero-fill block.

Definition at line 227 of file JITLink.h.

References assert(), llvm::Data, and llvm::Check::Size.

Referenced by llvm::jitlink::Symbol::getSymbolContent().

◆ getFixupAddress()

JITTargetAddress llvm::jitlink::Block::getFixupAddress ( const Edge E) const
inline

Returns the address of the fixup for the given edge, which is equal to this block's address plus the edge's offset.

Definition at line 327 of file JITLink.h.

References E, and llvm::jitlink::Addressable::getAddress().

◆ getMutableContent()

MutableArrayRef< char > llvm::jitlink::Block::getMutableContent ( LinkGraph G)
inline

Get mutable content for this block.

If this Block's content is not already mutable this will trigger a copy of the existing immutable content to a new, mutable buffer allocated using LinkGraph::allocateContent.

Definition at line 1295 of file JITLink.h.

References llvm::jitlink::Addressable::ContentMutable, G, and setMutableContent().

◆ getSection()

Section& llvm::jitlink::Block::getSection ( ) const
inline

Return the parent section for this block.

Definition at line 215 of file JITLink.h.

Referenced by llvm::jitlink::LinkGraph::makeAbsolute(), llvm::jitlink::LinkGraph::makeExternal(), and llvm::jitlink::LinkGraph::removeDefinedSymbol().

◆ getSize()

size_t llvm::jitlink::Block::getSize ( ) const
inline

Returns the size of this defined addressable.

Definition at line 224 of file JITLink.h.

References llvm::Check::Size.

Referenced by llvm::jitlink::SectionRange::getEnd(), llvm::jitlink::Symbol::setSize(), and llvm::jitlink::LinkGraph::transferDefinedSymbol().

◆ isContentMutable()

bool llvm::jitlink::Block::isContentMutable ( ) const
inline

Returns true if this block's content is mutable.

This is primarily useful for asserting that a block is already in a mutable state prior to modifying the content. E.g. when applying fixups we expect the block to already be mutable as it should have been copied to working memory.

Definition at line 274 of file JITLink.h.

References llvm::jitlink::Addressable::ContentMutable.

◆ isZeroFill()

bool llvm::jitlink::Block::isZeroFill ( ) const
inline

Returns true if this is a zero-fill block.

If true, getSize is callable but getContent is not (the content is defined to be a sequence of zero bytes of length Size).

Definition at line 221 of file JITLink.h.

References llvm::Data.

Referenced by llvm::jitlink::Symbol::isSymbolZeroFill().

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ removeEdge()

edge_iterator llvm::jitlink::Block::removeEdge ( edge_iterator  I)
inline

Remove the edge pointed to by the given iterator.

Returns an iterator to the new next element.

Definition at line 323 of file JITLink.h.

References I.

◆ setAlignment()

void llvm::jitlink::Block::setAlignment ( uint64_t  Alignment)
inline

Set the alignment for this content.

Definition at line 280 of file JITLink.h.

References assert(), llvm::countTrailingZeros(), llvm::isPowerOf2_64(), and llvm::jitlink::Addressable::P2Align.

◆ setAlignmentOffset()

void llvm::jitlink::Block::setAlignmentOffset ( uint64_t  AlignmentOffset)
inline

Set the alignment offset for this content.

Definition at line 289 of file JITLink.h.

References llvm::jitlink::Addressable::AlignmentOffset, assert(), and llvm::jitlink::Addressable::P2Align.

◆ setContent()

void llvm::jitlink::Block::setContent ( ArrayRef< char >  Content)
inline

Set the content for this block.

Caller is responsible for ensuring the underlying bytes are not deallocated while pointed to by this block.

Definition at line 235 of file JITLink.h.

References Content, llvm::jitlink::Addressable::ContentMutable, llvm::Data, and llvm::Check::Size.

◆ setMutableContent()

void llvm::jitlink::Block::setMutableContent ( MutableArrayRef< char >  MutableContent)
inline

Set mutable content for this block.

The caller is responsible for ensuring that the memory pointed to by MutableContent is not deallocated while pointed to by this block.

Definition at line 262 of file JITLink.h.

References llvm::jitlink::Addressable::ContentMutable, llvm::Data, llvm::MutableArrayRef< T >::data(), llvm::Check::Size, and llvm::ArrayRef< T >::size().

Referenced by getMutableContent().

Friends And Related Function Documentation

◆ LinkGraph

friend class LinkGraph
friend

Definition at line 151 of file JITLink.h.


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