ROSE  0.9.9.109
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. Address usage items are usually ordered by their starting address.

Definition at line 30 of file AddressUsageMap.h.

#include <AddressUsageMap.h>

Public Member Functions

 AddressUser (SgAsmInstruction *insn, const BasicBlock::Ptr &bblock)
 Constructs new user which is an instruction and its basic block. More...
 
 AddressUser (const OwnedDataBlock &odblock)
 Constructs a new user which is a data block. 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...
 
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...
 
const OwnedDataBlockdataBlockOwnership () const
 Return the data block ownership information. More...
 
OwnedDataBlockdataBlockOwnership ()
 Return the data block ownership information. More...
 

Constructor & Destructor Documentation

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 55 of file AddressUsageMap.h.

Rose::BinaryAnalysis::Partitioner2::AddressUser::AddressUser ( const OwnedDataBlock odblock)
inline

Constructs a new user which is a data block.

The data block must not be the null pointer.

Definition at line 62 of file AddressUsageMap.h.

Member Function Documentation

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

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

Definition at line 65 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 68 of file AddressUsageMap.h.

References Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::dataBlock().

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

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 73 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 is an instruction owner, 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; non-instruction address owners don't have basic blocks.

Definition at line 82 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 91 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 104 of file AddressUsageMap.h.

References Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::dataBlock().

const OwnedDataBlock& Rose::BinaryAnalysis::Partitioner2::AddressUser::dataBlockOwnership ( ) const
inline

Return the data block ownership information.

Returns ownership information for a data block. If this owner is not a data block address owner then the return value will be a default constructed ownership record for which OwnedDataBlock::isValid returns false.

Definition at line 114 of file AddressUsageMap.h.

OwnedDataBlock& Rose::BinaryAnalysis::Partitioner2::AddressUser::dataBlockOwnership ( )
inline

Return the data block ownership information.

Returns ownership information for a data block. If this owner is not a data block address owner then the return value will be a default constructed ownership record for which OwnedDataBlock::isValid returns false.

Definition at line 117 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 only their data blocks and not ownership lists.

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.


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