LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
llvm::MCAtom Class Referenceabstract

Represents a contiguous range of either instructions (a TextAtom) or data (a DataAtom). Address ranges are expressed as closed intervals. More...

#include <MCAtom.h>

Inheritance diagram for llvm::MCAtom:
Inheritance graph
[legend]
Collaboration diagram for llvm::MCAtom:
Collaboration graph
[legend]

Public Types

enum  AtomKind { TextAtom, DataAtom }
 

Public Member Functions

virtual ~MCAtom ()
 
AtomKind getKind () const
 
uint64_t getBeginAddr () const
 Get the start address of the atom. More...
 
uint64_t getEndAddr () const
 Get the end address, i.e. the last one inside the atom. More...
 
Atom modification methods:

When modifying a TextAtom, keep instruction boundaries in mind. For instance, split must me given the start address of an instruction.

virtual MCAtomsplit (uint64_t SplitPt)=0
 Splits the atom in two at a given address. More...
 
virtual void truncate (uint64_t TruncPt)=0
 Truncates an atom, discarding everything after TruncPt. More...
 
Naming:

This is mostly for display purposes, and may contain anything that hints at what the atom contains: section or symbol name, BB start address, ..

StringRef getName () const
 
void setName (StringRef NewName)
 

Protected Member Functions

 MCAtom (AtomKind K, MCModule *P, uint64_t B, uint64_t E)
 
Atom remapping helpers
void remap (uint64_t NewBegin, uint64_t NewEnd)
 Remap the atom, using the given range, updating Begin/End. One or both of the bounds can remain the same, but overlapping with other atoms in the module is still forbidden. More...
 
void remapForTruncate (uint64_t TruncPt)
 Remap the atom to prepare for a truncation at TruncPt. Equivalent to: More...
 
void remapForSplit (uint64_t SplitPt, uint64_t &LBegin, uint64_t &LEnd, uint64_t &RBegin, uint64_t &REnd)
 Remap the atom to prepare for a split at SplitPt. The bounds for the resulting atoms are returned in {L,R}{Begin,End}. The current atom is truncated to LEnd. More...
 

Protected Attributes

const AtomKind Kind
 
std::string Name
 
MCModuleParent
 
uint64_t Begin
 
uint64_t End
 

Friends

class MCModule
 

Detailed Description

Represents a contiguous range of either instructions (a TextAtom) or data (a DataAtom). Address ranges are expressed as closed intervals.

Definition at line 34 of file MCAtom.h.

Member Enumeration Documentation

Enumerator
TextAtom 
DataAtom 

Definition at line 39 of file MCAtom.h.

Constructor & Destructor Documentation

virtual llvm::MCAtom::~MCAtom ( )
inlinevirtual

Definition at line 37 of file MCAtom.h.

llvm::MCAtom::MCAtom ( AtomKind  K,
MCModule P,
uint64_t  B,
uint64_t  E 
)
inlineprotected

Definition at line 78 of file MCAtom.h.

Member Function Documentation

uint64_t llvm::MCAtom::getBeginAddr ( ) const
inline

Get the start address of the atom.

Definition at line 43 of file MCAtom.h.

References Begin.

Referenced by llvm::MCBasicBlock::splitBasicBlock().

uint64_t llvm::MCAtom::getEndAddr ( ) const
inline

Get the end address, i.e. the last one inside the atom.

Definition at line 45 of file MCAtom.h.

References End.

Referenced by AtomComp(), AtomCompInv(), and llvm::MCBasicBlock::splitBasicBlock().

AtomKind llvm::MCAtom::getKind ( ) const
inline

Definition at line 40 of file MCAtom.h.

References Kind.

Referenced by llvm::MCTextAtom::classof(), and llvm::MCDataAtom::classof().

StringRef llvm::MCAtom::getName ( ) const
inline

Definition at line 67 of file MCAtom.h.

References Name.

Referenced by llvm::MCTextAtom::split(), and llvm::MCDataAtom::split().

void MCAtom::remap ( uint64_t  NewBegin,
uint64_t  NewEnd 
)
protected

Remap the atom, using the given range, updating Begin/End. One or both of the bounds can remain the same, but overlapping with other atoms in the module is still forbidden.

Definition at line 20 of file MCAtom.cpp.

References Parent.

Referenced by llvm::MCDataAtom::addData(), llvm::MCTextAtom::addInst(), remapForSplit(), and remapForTruncate().

void MCAtom::remapForSplit ( uint64_t  SplitPt,
uint64_t &  LBegin,
uint64_t &  LEnd,
uint64_t &  RBegin,
uint64_t &  REnd 
)
protected

Remap the atom to prepare for a split at SplitPt. The bounds for the resulting atoms are returned in {L,R}{Begin,End}. The current atom is truncated to LEnd.

Definition at line 30 of file MCAtom.cpp.

References Begin, End, and remap().

Referenced by llvm::MCTextAtom::split(), and llvm::MCDataAtom::split().

void MCAtom::remapForTruncate ( uint64_t  TruncPt)
protected

Remap the atom to prepare for a truncation at TruncPt. Equivalent to:

// Bound checks
remap(Begin, TruncPt);

Definition at line 24 of file MCAtom.cpp.

References Begin, End, and remap().

Referenced by llvm::MCTextAtom::truncate(), and llvm::MCDataAtom::truncate().

void llvm::MCAtom::setName ( StringRef  NewName)
inline

Definition at line 68 of file MCAtom.h.

References Name, and llvm::StringRef::str().

Referenced by llvm::MCTextAtom::split(), and llvm::MCDataAtom::split().

virtual MCAtom* llvm::MCAtom::split ( uint64_t  SplitPt)
pure virtual

Splits the atom in two at a given address.

Parameters
SplitPtAddress at which to start a new atom, splitting this one.
Returns
The newly created atom starting at SplitPt.

Implemented in llvm::MCDataAtom, and llvm::MCTextAtom.

virtual void llvm::MCAtom::truncate ( uint64_t  TruncPt)
pure virtual

Truncates an atom, discarding everything after TruncPt.

Parameters
TruncPtLast byte address to be contained in this atom.

Implemented in llvm::MCDataAtom, and llvm::MCTextAtom.

Friends And Related Function Documentation

friend class MCModule
friend

Definition at line 77 of file MCAtom.h.

Member Data Documentation

uint64_t llvm::MCAtom::Begin
protected
uint64_t llvm::MCAtom::End
protected
const AtomKind llvm::MCAtom::Kind
protected

Definition at line 72 of file MCAtom.h.

Referenced by getKind().

std::string llvm::MCAtom::Name
protected

Definition at line 73 of file MCAtom.h.

Referenced by getName(), and setName().

MCModule* llvm::MCAtom::Parent
protected

Definition at line 74 of file MCAtom.h.

Referenced by remap(), llvm::MCTextAtom::split(), and llvm::MCDataAtom::split().


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