LLVM  14.0.0git
Public Member Functions | Friends | List of all members
llvm::jitlink::Symbol Class Reference

Symbol representation. More...

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

Public Member Functions

 Symbol ()=default
 Create a null Symbol. More...
 
 Symbol (const Symbol &)=delete
 
Symboloperator= (const Symbol &)=delete
 
 Symbol (Symbol &&)=delete
 
Symboloperator= (Symbol &&)=delete
 
bool hasName () const
 Returns true if this symbol has a name. More...
 
StringRef getName () const
 Returns the name of this symbol (empty if the symbol is anonymous). More...
 
void setName (StringRef Name)
 Rename this symbol. More...
 
bool isDefined () const
 Returns true if this Symbol has content (potentially) defined within this object file (i.e. More...
 
bool isLive () const
 Returns true if this symbol is live (i.e. More...
 
void setLive (bool IsLive)
 Set this symbol's live bit. More...
 
bool isCallable () const
 Returns true is this symbol is callable. More...
 
void setCallable (bool IsCallable)
 Set this symbol's callable bit. More...
 
bool isExternal () const
 Returns true if the underlying addressable is an unresolved external. More...
 
bool isAbsolute () const
 Returns true if the underlying addressable is an absolute symbol. More...
 
AddressablegetAddressable ()
 Return the addressable that this symbol points to. More...
 
const AddressablegetAddressable () const
 Return the addressable that thsi symbol points to. More...
 
BlockgetBlock ()
 Return the Block for this Symbol (Symbol must be defined). More...
 
const BlockgetBlock () const
 Return the Block for this Symbol (Symbol must be defined). More...
 
JITTargetAddress getOffset () const
 Returns the offset for this symbol within the underlying addressable. More...
 
JITTargetAddress getAddress () const
 Returns the address of this symbol. More...
 
JITTargetAddress getSize () const
 Returns the size of this symbol. More...
 
void setSize (JITTargetAddress Size)
 Set the size of this symbol. More...
 
bool isSymbolZeroFill () const
 Returns true if this symbol is backed by a zero-fill block. More...
 
ArrayRef< char > getSymbolContent () const
 Returns the content in the underlying block covered by this symbol. More...
 
Linkage getLinkage () const
 Get the linkage for this Symbol. More...
 
void setLinkage (Linkage L)
 Set the linkage for this Symbol. More...
 
Scope getScope () const
 Get the visibility for this Symbol. More...
 
void setScope (Scope S)
 Set the visibility for this Symbol. More...
 

Friends

class LinkGraph
 

Detailed Description

Symbol representation.

Symbols represent locations within Addressable objects. They can be either Named or Anonymous. Anonymous symbols have neither linkage nor visibility, and must point at ContentBlocks. Named symbols may be in one of four states:

Definition at line 390 of file JITLink.h.

Constructor & Destructor Documentation

◆ Symbol() [1/3]

llvm::jitlink::Symbol::Symbol ( )
default

Create a null Symbol.

This allows Symbols to be default initialized for use in containers (e.g. as map values). Null symbols are only useful for assigning to.

◆ Symbol() [2/3]

llvm::jitlink::Symbol::Symbol ( const Symbol )
delete

◆ Symbol() [3/3]

llvm::jitlink::Symbol::Symbol ( Symbol &&  )
delete

Member Function Documentation

◆ getAddress()

JITTargetAddress llvm::jitlink::Symbol::getAddress ( ) const
inline

◆ getAddressable() [1/2]

Addressable& llvm::jitlink::Symbol::getAddressable ( )
inline

Return the addressable that this symbol points to.

Definition at line 529 of file JITLink.h.

References assert(), and llvm::sampleprof::Base.

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

◆ getAddressable() [2/2]

const Addressable& llvm::jitlink::Symbol::getAddressable ( ) const
inline

Return the addressable that thsi symbol points to.

Definition at line 535 of file JITLink.h.

References assert(), and llvm::sampleprof::Base.

◆ getBlock() [1/2]

Block& llvm::jitlink::Symbol::getBlock ( )
inline

◆ getBlock() [2/2]

const Block& llvm::jitlink::Symbol::getBlock ( ) const
inline

Return the Block for this Symbol (Symbol must be defined).

Definition at line 548 of file JITLink.h.

References assert(), and llvm::sampleprof::Base.

◆ getLinkage()

Linkage llvm::jitlink::Symbol::getLinkage ( ) const
inline

Get the linkage for this Symbol.

Definition at line 584 of file JITLink.h.

Referenced by llvm::jitlink::makeTargetOutOfRangeError(), and llvm::jitlink::operator<<().

◆ getName()

StringRef llvm::jitlink::Symbol::getName ( ) const
inline

◆ getOffset()

JITTargetAddress llvm::jitlink::Symbol::getOffset ( ) const
inline

◆ getScope()

Scope llvm::jitlink::Symbol::getScope ( ) const
inline

Get the visibility for this Symbol.

Definition at line 594 of file JITLink.h.

References S.

Referenced by getName(), llvm::jitlink::makeTargetOutOfRangeError(), and llvm::jitlink::operator<<().

◆ getSize()

JITTargetAddress llvm::jitlink::Symbol::getSize ( ) const
inline

◆ getSymbolContent()

ArrayRef<char> llvm::jitlink::Symbol::getSymbolContent ( ) const
inline

Returns the content in the underlying block covered by this symbol.

This method may only be called on defined non-zero-fill symbols.

Definition at line 579 of file JITLink.h.

References getBlock(), llvm::jitlink::Block::getContent(), Offset, llvm::Check::Size, and llvm::ArrayRef< T >::slice().

◆ hasName()

bool llvm::jitlink::Symbol::hasName ( ) const
inline

Returns true if this symbol has a name.

Definition at line 480 of file JITLink.h.

Referenced by llvm::jitlink::operator<<().

◆ isAbsolute()

bool llvm::jitlink::Symbol::isAbsolute ( ) const
inline

◆ isCallable()

bool llvm::jitlink::Symbol::isCallable ( ) const
inline

Returns true is this symbol is callable.

Definition at line 511 of file JITLink.h.

◆ isDefined()

bool llvm::jitlink::Symbol::isDefined ( ) const
inline

◆ isExternal()

bool llvm::jitlink::Symbol::isExternal ( ) const
inline

Returns true if the underlying addressable is an unresolved external.

Definition at line 517 of file JITLink.h.

References assert(), and llvm::sampleprof::Base.

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

◆ isLive()

bool llvm::jitlink::Symbol::isLive ( ) const
inline

Returns true if this symbol is live (i.e.

should be treated as a root for dead stripping).

Definition at line 502 of file JITLink.h.

References assert(), and llvm::sampleprof::Base.

Referenced by llvm::jitlink::operator<<().

◆ isSymbolZeroFill()

bool llvm::jitlink::Symbol::isSymbolZeroFill ( ) const
inline

Returns true if this symbol is backed by a zero-fill block.

This method may only be called on defined symbols.

Definition at line 575 of file JITLink.h.

References getBlock(), and llvm::jitlink::Block::isZeroFill().

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ setCallable()

void llvm::jitlink::Symbol::setCallable ( bool  IsCallable)
inline

Set this symbol's callable bit.

Definition at line 514 of file JITLink.h.

◆ setLinkage()

void llvm::jitlink::Symbol::setLinkage ( Linkage  L)
inline

Set the linkage for this Symbol.

Definition at line 587 of file JITLink.h.

References assert(), llvm::sampleprof::Base, and llvm::jitlink::Strong.

Referenced by llvm::jitlink::LinkGraph::makeDefined().

◆ setLive()

void llvm::jitlink::Symbol::setLive ( bool  IsLive)
inline

Set this symbol's live bit.

Definition at line 508 of file JITLink.h.

Referenced by llvm::jitlink::LinkGraph::makeDefined().

◆ setName()

void llvm::jitlink::Symbol::setName ( StringRef  Name)
inline

Rename this symbol.

The client is responsible for updating scope and linkage if this name-change requires it.

Definition at line 491 of file JITLink.h.

◆ setScope()

void llvm::jitlink::Symbol::setScope ( Scope  S)
inline

Set the visibility for this Symbol.

Definition at line 597 of file JITLink.h.

References assert(), llvm::sampleprof::Base, llvm::jitlink::Default, llvm::jitlink::Local, and S.

Referenced by llvm::jitlink::LinkGraph::makeDefined().

◆ setSize()

void llvm::jitlink::Symbol::setSize ( JITTargetAddress  Size)
inline

Friends And Related Function Documentation

◆ LinkGraph

friend class LinkGraph
friend

Definition at line 391 of file JITLink.h.


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