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

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

Classes

class  defined_atom_iterator_impl
 

Public Types

using external_atom_iterator = ExternalAtomSet::iterator
 
using section_iterator = pointee_iterator< SectionList::iterator >
 
using const_section_iterator = pointee_iterator< SectionList::const_iterator >
 
using defined_atom_iterator = defined_atom_iterator_impl< section_iterator, Section::atom_iterator, DefinedAtom * >
 
using const_defined_atom_iterator = defined_atom_iterator_impl< const_section_iterator, Section::const_atom_iterator, const DefinedAtom * >
 

Public Member Functions

 AtomGraph (std::string Name, unsigned PointerSize, support::endianness Endianness)
 
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 atom-content in this graph. More...
 
SectioncreateSection (StringRef Name, uint32_t Alignment, sys::Memory::ProtectionFlags Prot, bool IsZeroFill)
 Create a section with the given name, protection flags, and alignment. More...
 
AtomaddExternalAtom (StringRef Name)
 Add an external atom representing an undefined symbol in this graph. More...
 
AtomaddAbsoluteAtom (StringRef Name, JITTargetAddress Addr)
 Add an external atom representing an absolute symbol. More...
 
DefinedAtomaddAnonymousAtom (Section &Parent, JITTargetAddress Address, uint32_t Alignment)
 Add an anonymous defined atom to the graph. More...
 
DefinedAtomaddDefinedAtom (Section &Parent, StringRef Name, JITTargetAddress Address, uint32_t Alignment)
 Add a defined atom to the graph. More...
 
DefinedAtomaddCommonAtom (Section &Parent, StringRef Name, JITTargetAddress Address, uint32_t Alignment, uint64_t Size)
 Add a common symbol atom to the graph. 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_atom_iteratorexternal_atoms ()
 
iterator_range< external_atom_iteratorabsolute_atoms ()
 
iterator_range< defined_atom_iteratordefined_atoms ()
 
iterator_range< const_defined_atom_iteratordefined_atoms () const
 
AtomgetAtomByName (StringRef Name)
 Returns the atom with the given name, which must exist in this graph. More...
 
DefinedAtomgetDefinedAtomByName (StringRef Name)
 Returns the atom with the given name, which must exist in this graph and be a DefinedAtom. More...
 
Expected< Atom & > findAtomByName (StringRef Name)
 Search for the given atom by name. More...
 
Expected< DefinedAtom & > findDefinedAtomByName (StringRef Name)
 Search for the given defined atom by name. More...
 
DefinedAtomgetAtomByAddress (JITTargetAddress Address)
 Returns the atom covering the given address, or an error if no such atom exists. More...
 
Expected< DefinedAtom & > findAtomByAddress (JITTargetAddress Address)
 Like getAtomByAddress, but returns an Error if the given address is not covered by an atom, rather than a null pointer. More...
 
void removeExternalAtom (Atom &A)
 
void removeAbsoluteAtom (Atom &A)
 Remove the given absolute atom from the graph. More...
 
void removeDefinedAtom (DefinedAtom &DA)
 Remove the given defined atom from the graph. More...
 
void invalidateAddrToAtomMap ()
 Invalidate the atom-to-address map. 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 469 of file JITLink.h.

Member Typedef Documentation

◆ const_defined_atom_iterator

Definition at line 533 of file JITLink.h.

◆ const_section_iterator

Definition at line 480 of file JITLink.h.

◆ defined_atom_iterator

Definition at line 528 of file JITLink.h.

◆ external_atom_iterator

Definition at line 477 of file JITLink.h.

◆ section_iterator

Definition at line 479 of file JITLink.h.

Constructor & Destructor Documentation

◆ AtomGraph()

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

Definition at line 535 of file JITLink.h.

Member Function Documentation

◆ absolute_atoms()

iterator_range<external_atom_iterator> llvm::jitlink::AtomGraph::absolute_atoms ( )
inline

◆ addAbsoluteAtom()

Atom& llvm::jitlink::AtomGraph::addAbsoluteAtom ( StringRef  Name,
JITTargetAddress  Addr 
)
inline

Add an external atom representing an absolute symbol.

Definition at line 571 of file JITLink.h.

References assert(), and Name.

◆ addAnonymousAtom()

DefinedAtom& llvm::jitlink::AtomGraph::addAnonymousAtom ( Section Parent,
JITTargetAddress  Address,
uint32_t  Alignment 
)
inline

Add an anonymous defined atom to the graph.

Anonymous atoms have content but no name. They must have an address.

Definition at line 584 of file JITLink.h.

References llvm::jitlink::Atom::getAddress().

◆ addCommonAtom()

DefinedAtom& llvm::jitlink::AtomGraph::addCommonAtom ( Section Parent,
StringRef  Name,
JITTargetAddress  Address,
uint32_t  Alignment,
uint64_t  Size 
)
inline

Add a common symbol atom to the graph.

Adds a common-symbol atom to the graph with the given parent, name, address, alignment and size.

Definition at line 614 of file JITLink.h.

References assert(), and Name.

◆ addDefinedAtom()

DefinedAtom& llvm::jitlink::AtomGraph::addDefinedAtom ( Section Parent,
StringRef  Name,
JITTargetAddress  Address,
uint32_t  Alignment 
)
inline

Add a defined atom to the graph.

Allocates and constructs a DefinedAtom instance with the given parent, name, address, and alignment.

Definition at line 598 of file JITLink.h.

References assert(), and Name.

◆ addExternalAtom()

Atom& llvm::jitlink::AtomGraph::addExternalAtom ( StringRef  Name)
inline

Add an external atom representing an undefined symbol in this graph.

Definition at line 560 of file JITLink.h.

References assert(), and Name.

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

◆ createSection()

Section& llvm::jitlink::AtomGraph::createSection ( StringRef  Name,
uint32_t  Alignment,
sys::Memory::ProtectionFlags  Prot,
bool  IsZeroFill 
)
inline

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

Definition at line 551 of file JITLink.h.

References llvm::ARMBuildAttrs::Section.

◆ defined_atoms() [1/2]

iterator_range<defined_atom_iterator> llvm::jitlink::AtomGraph::defined_atoms ( )
inline

◆ defined_atoms() [2/2]

iterator_range<const_defined_atom_iterator> llvm::jitlink::AtomGraph::defined_atoms ( ) const
inline

Definition at line 654 of file JITLink.h.

References llvm::make_range().

◆ dump()

void llvm::jitlink::AtomGraph::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 104 of file JITLink.cpp.

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

◆ external_atoms()

iterator_range<external_atom_iterator> llvm::jitlink::AtomGraph::external_atoms ( )
inline

Definition at line 641 of file JITLink.h.

References llvm::make_range().

◆ findAtomByAddress()

Expected<DefinedAtom &> llvm::jitlink::AtomGraph::findAtomByAddress ( JITTargetAddress  Address)
inline

Like getAtomByAddress, but returns an Error if the given address is not covered by an atom, rather than a null pointer.

Definition at line 730 of file JITLink.h.

References llvm::formatv().

◆ findAtomByName()

Expected<Atom &> llvm::jitlink::AtomGraph::findAtomByName ( StringRef  Name)
inline

Search for the given atom by name.

Returns the atom (if found) or an error (if no atom with this name exists).

Definition at line 678 of file JITLink.h.

References I.

◆ findDefinedAtomByName()

Expected<DefinedAtom &> llvm::jitlink::AtomGraph::findDefinedAtomByName ( StringRef  Name)
inline

Search for the given defined atom by name.

Returns the defined atom (if found) or an error (if no atom with this name exists, or if one exists but is not a defined atom).

Definition at line 688 of file JITLink.h.

References I.

◆ findSectionByName()

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

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

Definition at line 634 of file JITLink.h.

References Name.

◆ getAtomByAddress()

DefinedAtom* llvm::jitlink::AtomGraph::getAtomByAddress ( JITTargetAddress  Address)
inline

Returns the atom covering the given address, or an error if no such atom exists.

Returns null if no atom exists at the given address.

Definition at line 703 of file JITLink.h.

References assert(), and I.

◆ getAtomByName()

Atom& llvm::jitlink::AtomGraph::getAtomByName ( StringRef  Name)
inline

Returns the atom with the given name, which must exist in this graph.

Definition at line 661 of file JITLink.h.

References assert(), and I.

◆ getDefinedAtomByName()

DefinedAtom& llvm::jitlink::AtomGraph::getDefinedAtomByName ( StringRef  Name)
inline

Returns the atom with the given name, which must exist in this graph and be a DefinedAtom.

Definition at line 669 of file JITLink.h.

References assert().

◆ getEndianness()

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

Returns the endianness of atom-content in this graph.

Definition at line 548 of file JITLink.h.

References llvm::msgpack::Endianness.

◆ getName()

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

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

Definition at line 542 of file JITLink.h.

References Name.

◆ getPointerSize()

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

Returns the pointer size for use in this graph.

Definition at line 545 of file JITLink.h.

◆ invalidateAddrToAtomMap()

void llvm::jitlink::AtomGraph::invalidateAddrToAtomMap ( )
inline

Invalidate the atom-to-address map.

Definition at line 769 of file JITLink.h.

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

◆ removeAbsoluteAtom()

void llvm::jitlink::AtomGraph::removeAbsoluteAtom ( Atom A)
inline

Remove the given absolute atom from the graph.

Definition at line 746 of file JITLink.h.

References assert(), and llvm::jitlink::Atom::isAbsolute().

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

◆ removeDefinedAtom()

void llvm::jitlink::AtomGraph::removeDefinedAtom ( DefinedAtom DA)
inline

Remove the given defined atom from the graph.

Definition at line 754 of file JITLink.h.

References assert(), llvm::jitlink::Atom::getAddress(), llvm::jitlink::Atom::getName(), llvm::jitlink::DefinedAtom::getSection(), and llvm::jitlink::Atom::hasName().

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

◆ removeExternalAtom()

void llvm::jitlink::AtomGraph::removeExternalAtom ( Atom A)
inline

◆ sections()

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

Definition at line 627 of file JITLink.h.

References llvm::make_range().


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