ROSE  0.9.11.56
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 <AddressUsageMap.h>

Public Member Functions

 AddressUser ()
 Default constructed user is empty. More...
 
 AddressUser (SgAsmInstruction *insn, const BasicBlock::Ptr &bblock)
 Constructs new user which is an instruction and its basic block. More...
 
 AddressUser (const DataBlockPtr &dblock)
 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...
 
BasicBlock::Ptr firstBasicBlock () const
 Returns an arbitrary basic block. More...
 
const std::vector< BasicBlock::Ptr > & basicBlocks () const
 Returns all basic blocks to which this instruction belongs. More...
 
void insertBasicBlock (const BasicBlock::Ptr &bblock)
 Add another basic block to the set of basic blocks. More...
 
void eraseBasicBlock (const BasicBlock::Ptr &bblock)
 Remove a basic block from the set of basic blocks. More...
 
DataBlock::Ptr dataBlock () const
 Returns the data block. More...
 
BasicBlock::Ptr 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 ( )
inline

Default constructed user is empty.

Definition at line 56 of file AddressUsageMap.h.

Rose::BinaryAnalysis::Partitioner2::AddressUser::AddressUser ( SgAsmInstruction insn,
const BasicBlock::Ptr bblock 
)
inline

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.

Definition at line 63 of file AddressUsageMap.h.

Rose::BinaryAnalysis::Partitioner2::AddressUser::AddressUser ( const DataBlockPtr dblock)
inlineexplicit

Constructs a new user which is a data block.

The data block must not be the null pointer.

Definition at line 70 of file AddressUsageMap.h.

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
inline

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

Definition at line 82 of file AddressUsageMap.h.

Referenced by Rose::BinaryAnalysis::Partitioner2::AddressUsers::selectBasicBlocks().

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

Predicate returning true if user is a data block.

Definition at line 85 of file AddressUsageMap.h.

Referenced by Rose::BinaryAnalysis::Partitioner2::AddressUsers::selectDataBlocks().

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

True if this object was default constructed.

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

Definition at line 90 of file AddressUsageMap.h.

Referenced by operator bool().

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

Return the instruction.

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

Definition at line 97 of file AddressUsageMap.h.

BasicBlock::Ptr Rose::BinaryAnalysis::Partitioner2::AddressUser::firstBasicBlock ( ) const
inline

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.

Definition at line 105 of file AddressUsageMap.h.

const std::vector<BasicBlock::Ptr>& Rose::BinaryAnalysis::Partitioner2::AddressUser::basicBlocks ( ) const
inline

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.

Definition at line 114 of file AddressUsageMap.h.

void Rose::BinaryAnalysis::Partitioner2::AddressUser::insertBasicBlock ( const BasicBlock::Ptr bblock)

Add another basic block to the set of basic blocks.

void Rose::BinaryAnalysis::Partitioner2::AddressUser::eraseBasicBlock ( const BasicBlock::Ptr bblock)

Remove a basic block from the set of basic blocks.

DataBlock::Ptr Rose::BinaryAnalysis::Partitioner2::AddressUser::dataBlock ( ) const
inline

Returns the data block.

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

Definition at line 127 of file AddressUsageMap.h.

BasicBlock::Ptr 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 164 of file AddressUsageMap.h.

References isEmpty().


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