ROSE  0.9.9.139
Public Member Functions | List of all members
Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock Class Reference

Description

Shared reference to data block.

A data block can be referenced from (owned by) multiple functions and/or basic blocks, where each owner has a shared-ownership pointer to the data block. When a data block and (some of) its owners are attached to the CFG/AUM, we need to be able to quickly find the owners when given the data block. For instance, we can use the AUM to find all data blocks that overlap a certain address interval, and then use the data block's owner list to find the functions that necessarily also overlap that interval. The OwnedDataBlock objects keeps track of the child-to-parent ownership links by containing a pointer to a data block and pointers to the functions and/or basic blocks that own it.

Definition at line 26 of file OwnedDataBlock.h.

#include <OwnedDataBlock.h>

Public Member Functions

 OwnedDataBlock ()
 Default constructed null ownership. More...
 
 OwnedDataBlock (const DataBlock::Ptr &dblock)
 Construct a new data block ownership record. More...
 
 OwnedDataBlock (const DataBlock::Ptr &dblock, const Function::Ptr &owner)
 Construct a new data block ownership record. More...
 
 OwnedDataBlock (const DataBlock::Ptr &dblock, const BasicBlock::Ptr &owner)
 Construct a new data block ownership record. More...
 
bool isValid () const
 Determines whether an ownership record is valid. More...
 
DataBlock::Ptr dataBlock () const
 Returns the data block for this ownership record. More...
 
size_t insertOwner (const Function::Ptr &)
 Add a function owner for this data block. More...
 
size_t insertOwner (const BasicBlock::Ptr &)
 Add a basic block owner for this data block. More...
 
size_t eraseOwner (const Function::Ptr &)
 Remove a function owner for this data block. More...
 
size_t eraseOwner (const BasicBlock::Ptr &)
 Remove a basic block owner for this data block. More...
 
const std::vector< Function::Ptr > & owningFunctions () const
 Returns the list of functions that own this data block. More...
 
const std::vector< BasicBlock::Ptr > & owningBasicBlocks () const
 Returns the list of basic blocks that own this data block. More...
 
size_t nFunctionOwners () const
 Returns the number of functions that own this data block. More...
 
size_t nBasicBlockOwners () const
 Returns the number basic blocks that own this data block. More...
 
size_t nOwners () const
 Returns the number of owners for this data block. More...
 
bool isOwned () const
 Returns true if this data block is owned. More...
 

Constructor & Destructor Documentation

Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::OwnedDataBlock ( )
inline

Default constructed null ownership.

A default constructed data block ownership record does not point to any data block, and its isValid method returns false. All other methods for constructing an ownership record require a non-null data block and the isValid method would return true for them.

Definition at line 49 of file OwnedDataBlock.h.

Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::OwnedDataBlock ( const DataBlock::Ptr dblock)
inlineexplicit

Construct a new data block ownership record.

The data block must not be a null pointer. The lists of owning functions and basic blocks are empty after this call.

Definition at line 54 of file OwnedDataBlock.h.

Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::OwnedDataBlock ( const DataBlock::Ptr dblock,
const Function::Ptr owner 
)
inline

Construct a new data block ownership record.

The data block is marked so that it is owned by the specified function. Neither the data block nor the function may be null pointers.

Definition at line 62 of file OwnedDataBlock.h.

Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::OwnedDataBlock ( const DataBlock::Ptr dblock,
const BasicBlock::Ptr owner 
)
inline

Construct a new data block ownership record.

The data block is marked so that it is owned by this one basic block. Neither the data block nor the basic block may be null pointers.

Definition at line 72 of file OwnedDataBlock.h.

Member Function Documentation

bool Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::isValid ( ) const
inline

Determines whether an ownership record is valid.

Returns true if and only if this ownership record points to a non-null data block. This will return true for all ownership records except those that are default constructed.

Definition at line 82 of file OwnedDataBlock.h.

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

Returns the data block for this ownership record.

The return value is guaranteed to be non-null if and only if isValid returns true.

Definition at line 87 of file OwnedDataBlock.h.

Referenced by Rose::BinaryAnalysis::Partitioner2::AddressUser::dataBlock(), and Rose::BinaryAnalysis::Partitioner2::AddressUser::isDataBlock().

size_t Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::insertOwner ( const Function::Ptr )

Add a function owner for this data block.

The specified function must not be null and this must be a valid ownership record. If the function is already in the function owners list then this method does nothing. Returns the number of owners after adding the specified function.

size_t Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::insertOwner ( const BasicBlock::Ptr )

Add a basic block owner for this data block.

The specified basic block must not be null and this must be a valid ownership record. If the basic block is already in the basic block owners list then this method does nothing. Returns the number of owners after adding the specified basic block.

size_t Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::eraseOwner ( const Function::Ptr )

Remove a function owner for this data block.

If the function is a null pointer or the function is not an owner of the data block then this method does nothing. Returns the number of owners after removing the specified function.

size_t Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::eraseOwner ( const BasicBlock::Ptr )

Remove a basic block owner for this data block.

If the basic block is a null pointer or the basic block is not an owner of the data block then this method does nothing. Returns the number of owners after removing the specified basic block.

const std::vector<Function::Ptr>& Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::owningFunctions ( ) const
inline

Returns the list of functions that own this data block.

The returned list contains distinct functions sorted by entry address. The returned list will always be empty for ownership records for which isValid returns false.

Definition at line 119 of file OwnedDataBlock.h.

const std::vector<BasicBlock::Ptr>& Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::owningBasicBlocks ( ) const
inline

Returns the list of basic blocks that own this data block.

The returned list contains distinct basic blocks sorted by starting address. The returned list will always be empty for ownership records for which isValid returns false.

Definition at line 125 of file OwnedDataBlock.h.

size_t Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::nFunctionOwners ( ) const
inline

Returns the number of functions that own this data block.

The return value will always be zero for ownership records for which isValid returns false.

Definition at line 129 of file OwnedDataBlock.h.

size_t Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::nBasicBlockOwners ( ) const
inline

Returns the number basic blocks that own this data block.

The return value will always be zero for ownership records for which isValid returns false.

Definition at line 133 of file OwnedDataBlock.h.

size_t Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::nOwners ( ) const
inline

Returns the number of owners for this data block.

The total number of owners is the sum of the number of function owners and the number of basic block owners. The return value will always be zero for ownership records for which isValid returns false.

Definition at line 139 of file OwnedDataBlock.h.

bool Rose::BinaryAnalysis::Partitioner2::OwnedDataBlock::isOwned ( ) const
inline

Returns true if this data block is owned.

Returns true if this data block has any function owners or basic block owners, and false otherwise. The return value will always be false for ownership records for which isValid returns false.

Definition at line 145 of file OwnedDataBlock.h.


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