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

Description

Reference to a function, basic block, instruction, or address.

A reference can be an empty reference, or it points to a function and/or basic block and/or instruction, or it is an address in any combination. A reference has a granularity depending on the finest thing to which it points (see granularity). All non-empty references have a computable address regardless of whether an address is actually stored. References are comparable.

Definition at line 22 of file Reference.h.

#include <Reference.h>

Public Types

enum  Granularity {
  EMPTY,
  ADDRESS,
  INSTRUCTION,
  BASIC_BLOCK,
  FUNCTION
}
 Granularity. More...
 

Public Member Functions

Granularity granularity () const
 Reference granularity. More...
 
bool isEmpty () const
 Predicate for emptiness. More...
 
bool hasFunction () const
 Predicate for having a function. More...
 
Function::Ptr function () const
 Optional function pointer. More...
 
bool hasBasicBlock () const
 Predicate for having a basic block. More...
 
BasicBlock::Ptr basicBlock () const
 Optional basic block pointer. More...
 
bool hasInstruction () const
 Predicate for having an instruction. More...
 
SgAsmInstructioninstruction () const
 Optional instruction pointer. More...
 
bool hasExplicitAddress () const
 Predicate for having a stored address. More...
 
rose_addr_t address () const
 Address. More...
 
bool operator== (const Reference &other) const
 Whether two references are equal. More...
 
bool operator< (const Reference &other) const
 Compare two references. More...
 
 Reference (const Function::Ptr &function, const BasicBlock::Ptr &bblock=BasicBlock::Ptr(), SgAsmInstruction *insn=NULL, const Sawyer::Optional< rose_addr_t > &address=Sawyer::Nothing())
 Constructor. More...
 
 Reference (const BasicBlock::Ptr &bblock, SgAsmInstruction *insn=NULL, const Sawyer::Optional< rose_addr_t > &address=Sawyer::Nothing())
 Constructor. More...
 
 Reference (SgAsmInstruction *insn, const Sawyer::Optional< rose_addr_t > &address=Sawyer::Nothing())
 Constructor. More...
 
 Reference (rose_addr_t address)
 Constructor. More...
 
 Reference ()
 Constructor. More...
 

Member Enumeration Documentation

Granularity.

Enumerator
EMPTY 

Reference points to nothing and has no address.

ADDRESS 

Reference points to nothing but has an address.

INSTRUCTION 

Reference points to an instruction but no stored address.

BASIC_BLOCK 

Reference points to a basic block but not an instruction or a stored address.

FUNCTION 

Reference points to a function but not a basic block or instruction, and has no stored address.

Definition at line 29 of file Reference.h.

Constructor & Destructor Documentation

Rose::BinaryAnalysis::Partitioner2::Reference::Reference ( const Function::Ptr function,
const BasicBlock::Ptr bblock = BasicBlock::Ptr(),
SgAsmInstruction insn = NULL,
const Sawyer::Optional< rose_addr_t > &  address = Sawyer::Nothing() 
)
inlineexplicit

Constructor.

A reference can be constructed from any combination of a function, basic block, instruction, and address.

Definition at line 44 of file Reference.h.

Rose::BinaryAnalysis::Partitioner2::Reference::Reference ( const BasicBlock::Ptr bblock,
SgAsmInstruction insn = NULL,
const Sawyer::Optional< rose_addr_t > &  address = Sawyer::Nothing() 
)
inlineexplicit

Constructor.

A reference can be constructed from any combination of a function, basic block, instruction, and address.

Definition at line 49 of file Reference.h.

Rose::BinaryAnalysis::Partitioner2::Reference::Reference ( SgAsmInstruction insn,
const Sawyer::Optional< rose_addr_t > &  address = Sawyer::Nothing() 
)
inlineexplicit

Constructor.

A reference can be constructed from any combination of a function, basic block, instruction, and address.

Definition at line 53 of file Reference.h.

Rose::BinaryAnalysis::Partitioner2::Reference::Reference ( rose_addr_t  address)
inlineexplicit

Constructor.

A reference can be constructed from any combination of a function, basic block, instruction, and address.

Definition at line 56 of file Reference.h.

Rose::BinaryAnalysis::Partitioner2::Reference::Reference ( )
inline

Constructor.

A reference can be constructed from any combination of a function, basic block, instruction, and address.

Definition at line 59 of file Reference.h.

Member Function Documentation

Granularity Rose::BinaryAnalysis::Partitioner2::Reference::granularity ( ) const
inline

Reference granularity.

Returns the granularity for the reference. The granularity is the finest thing stored in the reference. The order from finest to coarsest is: EMPTY, ADDRESS, INSTRUCTION, BASIC_BLOCK, FUNCTION.

Definition at line 67 of file Reference.h.

References ADDRESS, BASIC_BLOCK, EMPTY, FUNCTION, and INSTRUCTION.

Referenced by isEmpty().

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

Predicate for emptiness.

Returns true if this reference points to nothing and has no stored address.

Definition at line 82 of file Reference.h.

References EMPTY, and granularity().

bool Rose::BinaryAnalysis::Partitioner2::Reference::hasFunction ( ) const
inline

Predicate for having a function.

Returns true if the reference points to a function.

Definition at line 89 of file Reference.h.

Function::Ptr Rose::BinaryAnalysis::Partitioner2::Reference::function ( ) const
inline

Optional function pointer.

Definition at line 94 of file Reference.h.

bool Rose::BinaryAnalysis::Partitioner2::Reference::hasBasicBlock ( ) const
inline

Predicate for having a basic block.

Returns true if the reference points to a basic block.

Definition at line 101 of file Reference.h.

BasicBlock::Ptr Rose::BinaryAnalysis::Partitioner2::Reference::basicBlock ( ) const
inline

Optional basic block pointer.

Definition at line 106 of file Reference.h.

bool Rose::BinaryAnalysis::Partitioner2::Reference::hasInstruction ( ) const
inline

Predicate for having an instruction.

Returns true if the reference points to an instruction.

Definition at line 113 of file Reference.h.

SgAsmInstruction* Rose::BinaryAnalysis::Partitioner2::Reference::instruction ( ) const
inline

Optional instruction pointer.

Definition at line 118 of file Reference.h.

bool Rose::BinaryAnalysis::Partitioner2::Reference::hasExplicitAddress ( ) const
inline

Predicate for having a stored address.

All non-empty references have a computable address, but an address can also be stored explicitly. This predicate returns true when an address is stored explicitly.

Definition at line 126 of file Reference.h.

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

Address.

All non-empty references have either an explicitly stored address or an address that can be obtained from an instruction, basic block, or function. This method returns the first address found from that list.

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

Whether two references are equal.

Two references are equal if they are both empty, or else if they have the same address and granularity.

bool Rose::BinaryAnalysis::Partitioner2::Reference::operator< ( const Reference other) const

Compare two references.

Returns true when this reference is less than the other reference. The empty reference is less than all non-empty references. A non-empty reference is less than or greater than another non-empty reference if its address is less than or greater than the other reference's address. When two references have the same address then the finer granularity reference is less than the coarser reference.


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