ROSE  0.11.145.0
Public Member Functions | List of all members
Rose::BinaryAnalysis::Partitioner2::AddressUser Class Reference

Description

Address usage item.

This struct represents one user for an address interval. The user can be either an instruction with at least one valid basic block (since every instruction in the CFG belongs to at least one basic block in the CFG), or a data block, but not both.

Definition at line 33 of file AddressUsageMap.h.

#include <Rose/BinaryAnalysis/Partitioner2/AddressUsageMap.h>

Public Member Functions

 AddressUser ()
 Default constructed user is empty. More...
 
 AddressUser (SgAsmInstruction *, const BasicBlockPtr &)
 Constructs new user which is an instruction and its basic block. More...
 
 AddressUser (const DataBlockPtr &)
 Constructs a new user which is a data block. More...
 
rose_addr_t address () const
 Address of user. More...
 
bool isBasicBlock () const
 Predicate returning true if user is a basic block or instruction. More...
 
bool isDataBlock () const
 Predicate returning true if user is a data block. More...
 
bool isEmpty () const
 True if this object was default constructed. More...
 
SgAsmInstructioninsn () const
 Return the instruction. More...
 
BasicBlockPtr firstBasicBlock () const
 Returns an arbitrary basic block. More...
 
const std::vector< BasicBlockPtr > & basicBlocks () const
 Returns all basic blocks to which this instruction belongs. More...
 
void insertBasicBlock (const BasicBlockPtr &bblock)
 Add another basic block to the set of basic blocks. More...
 
void eraseBasicBlock (const BasicBlockPtr &bblock)
 Remove a basic block from the set of basic blocks. More...
 
DataBlockPtr dataBlock () const
 Returns the data block. More...
 
BasicBlockPtr isBlockEntry () const
 Determines if this user is a first instruction of a basic block. More...
 
bool operator== (const AddressUser &other) const
 Compare two users for equality. More...
 
bool operator< (const AddressUser &) const
 Compare two users for sorting. More...
 
void print (std::ostream &) const
 Print the pair on one line. More...
 
bool isConsistent () const
 Perform logic consistency checks. More...
 
 operator bool () const
 Return true/false in Boolean context. More...
 

Constructor & Destructor Documentation

Rose::BinaryAnalysis::Partitioner2::AddressUser::AddressUser ( )

Default constructed user is empty.

Rose::BinaryAnalysis::Partitioner2::AddressUser::AddressUser ( SgAsmInstruction ,
const BasicBlockPtr  
)

Constructs new user which is an instruction and its basic block.

The instruction must not be the null pointer, but the basic block may as long as a null block user is not inserted into the AUM. A null basic block is generally only useful when searching for a particular instruction in an AddressUsers object.

Rose::BinaryAnalysis::Partitioner2::AddressUser::AddressUser ( const DataBlockPtr )
explicit

Constructs a new user which is a data block.

The data block must not be the null pointer.

Member Function Documentation

rose_addr_t Rose::BinaryAnalysis::Partitioner2::AddressUser::address ( ) const

Address of user.

Returns the address of the instruction or the address of the data block, depending on which of isBasicBlock or isDataBlock returns true.

bool Rose::BinaryAnalysis::Partitioner2::AddressUser::isBasicBlock ( ) const

Predicate returning true if user is a basic block or instruction.

bool Rose::BinaryAnalysis::Partitioner2::AddressUser::isDataBlock ( ) const

Predicate returning true if user is a data block.

bool Rose::BinaryAnalysis::Partitioner2::AddressUser::isEmpty ( ) const

True if this object was default constructed.

Returns true if this AddressUser doesn't point to anything.

Referenced by operator bool().

SgAsmInstruction* Rose::BinaryAnalysis::Partitioner2::AddressUser::insn ( ) const

Return the instruction.

Returns the non-null instruction if this is an instruction address owner, otherwise returns the null pointer.

BasicBlockPtr Rose::BinaryAnalysis::Partitioner2::AddressUser::firstBasicBlock ( ) const

Returns an arbitrary basic block.

Returns a non-null basic block if this object points to an instruction, otherwise returns the null pointer. All instructions in the AUM belong to at least one basic block and therefore have a non-null basic block pointer.

const std::vector<BasicBlockPtr>& Rose::BinaryAnalysis::Partitioner2::AddressUser::basicBlocks ( ) const

Returns all basic blocks to which this instruction belongs.

Returns a non-empty vector if this is an instruction owner, otherwise returns an empty vector. All instructions in the AUM belong to at least one basic block and therefore return a non-empty vector; non-instruction owners don't have basic blocks.

void Rose::BinaryAnalysis::Partitioner2::AddressUser::insertBasicBlock ( const BasicBlockPtr bblock)

Add another basic block to the set of basic blocks.

void Rose::BinaryAnalysis::Partitioner2::AddressUser::eraseBasicBlock ( const BasicBlockPtr bblock)

Remove a basic block from the set of basic blocks.

DataBlockPtr Rose::BinaryAnalysis::Partitioner2::AddressUser::dataBlock ( ) const

Returns the data block.

Returns a non-null data block if this is a data block address owner, otherwise returns the null pointer.

BasicBlockPtr Rose::BinaryAnalysis::Partitioner2::AddressUser::isBlockEntry ( ) const

Determines if this user is a first instruction of a basic block.

If this user is the first instruction of some basic block then a pointer to that block is returned. An instruction can only be the first instruction of a single basic block, although that instruction may appear internally in other basic blocks as well.

bool Rose::BinaryAnalysis::Partitioner2::AddressUser::operator== ( const AddressUser other) const

Compare two users for equality.

Two users are equal if and only if they point to the same instruction (or both null) having the same basic block owners and they point to the same data block (or both null). This is used by the Sawyer::Container::IntervalMap to decide whether it's possible to join adjacent values.

bool Rose::BinaryAnalysis::Partitioner2::AddressUser::operator< ( const AddressUser ) const

Compare two users for sorting.

Two users are compared according to their starting addresses. If two instruction users have the same starting address then they are necessarily the same instruction (i.e., instruction pointers are equal) and thus belong to the same basic block(s). The basic blocks are not considered in the comparison. Data block ownership records compare based on their keys, which is their starting address and size.

void Rose::BinaryAnalysis::Partitioner2::AddressUser::print ( std::ostream &  ) const

Print the pair on one line.

bool Rose::BinaryAnalysis::Partitioner2::AddressUser::isConsistent ( ) const

Perform logic consistency checks.

Ensures that this object is logically consistent. If assertions are enabled this asserts, otherwise it returns false.

Rose::BinaryAnalysis::Partitioner2::AddressUser::operator bool ( ) const
inline

Return true/false in Boolean context.

Returns false if this AddressUser is empty (default constructed) and true otherwise.

Definition at line 150 of file AddressUsageMap.h.

References isEmpty().


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