ROSE 0.11.145.192
|
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 36 of file AddressUsageMap.h.
#include <Rose/BinaryAnalysis/Partitioner2/AddressUsageMap.h>
Public Member Functions | |
AddressUser () | |
Default constructed user is empty. | |
AddressUser (SgAsmInstruction *, const BasicBlockPtr &) | |
Constructs new user which is an instruction and its basic block. | |
AddressUser (const DataBlockPtr &) | |
Constructs a new user which is a data block. | |
rose_addr_t | address () const |
Address of user. | |
bool | isBasicBlock () const |
Predicate returning true if user is a basic block or instruction. | |
bool | isDataBlock () const |
Predicate returning true if user is a data block. | |
bool | isEmpty () const |
True if this object was default constructed. | |
SgAsmInstruction * | insn () const |
Return the instruction. | |
BasicBlockPtr | firstBasicBlock () const |
Returns an arbitrary basic block. | |
const std::vector< BasicBlockPtr > & | basicBlocks () const |
Returns all basic blocks to which this instruction belongs. | |
void | insertBasicBlock (const BasicBlockPtr &bblock) |
Add another basic block to the set of basic blocks. | |
void | eraseBasicBlock (const BasicBlockPtr &bblock) |
Remove a basic block from the set of basic blocks. | |
DataBlockPtr | dataBlock () const |
Returns the data block. | |
BasicBlockPtr | isBlockEntry () const |
Determines if this user is a first instruction of a basic block. | |
bool | operator== (const AddressUser &other) const |
Compare two users for equality. | |
bool | operator< (const AddressUser &) const |
Compare two users for sorting. | |
void | print (std::ostream &) const |
Print the pair on one line. | |
bool | isConsistent () const |
Perform logic consistency checks. | |
operator bool () const | |
Return true/false in Boolean context. | |
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.
|
explicit |
Constructs a new user which is a data block.
The data block must not be the null pointer.
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::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.
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.
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.
|
inline |
Return true/false in Boolean context.
Returns false if this AddressUser is empty (default constructed) and true otherwise.
Definition at line 142 of file AddressUsageMap.h.
References isEmpty().