ROSE  0.11.145.0
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 23 of file Reference.h.

#include <Rose/BinaryAnalysis/Partitioner2/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...
 
FunctionPtr function () const
 Optional function pointer. More...
 
bool hasBasicBlock () const
 Predicate for having a basic block. More...
 
BasicBlockPtr 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 FunctionPtr &)
 Constructor. More...
 
 Reference (const FunctionPtr &, const BasicBlockPtr &, SgAsmInstruction *=nullptr, const Sawyer::Optional< rose_addr_t > &=Sawyer::Nothing())
 Constructor. More...
 
 Reference (const BasicBlockPtr &, SgAsmInstruction *=nullptr, const Sawyer::Optional< rose_addr_t > &=Sawyer::Nothing())
 Constructor. More...
 
 Reference (SgAsmInstruction *, const Sawyer::Optional< rose_addr_t > &=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 30 of file Reference.h.

Constructor & Destructor Documentation

Rose::BinaryAnalysis::Partitioner2::Reference::Reference ( const FunctionPtr )
explicit

Constructor.

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

Rose::BinaryAnalysis::Partitioner2::Reference::Reference ( const FunctionPtr ,
const BasicBlockPtr ,
SgAsmInstruction = nullptr,
const Sawyer::Optional< rose_addr_t > &  = Sawyer::Nothing() 
)
explicit

Constructor.

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

Rose::BinaryAnalysis::Partitioner2::Reference::Reference ( const BasicBlockPtr ,
SgAsmInstruction = nullptr,
const Sawyer::Optional< rose_addr_t > &  = Sawyer::Nothing() 
)
explicit

Constructor.

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

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

Constructor.

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

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

Constructor.

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

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

Constructor.

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

Member Function Documentation

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

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.

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

Predicate for emptiness.

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

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

Predicate for having a function.

Returns true if the reference points to a function.

FunctionPtr Rose::BinaryAnalysis::Partitioner2::Reference::function ( ) const

Optional function pointer.

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

Predicate for having a basic block.

Returns true if the reference points to a basic block.

BasicBlockPtr Rose::BinaryAnalysis::Partitioner2::Reference::basicBlock ( ) const

Optional basic block pointer.

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

Predicate for having an instruction.

Returns true if the reference points to an instruction.

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

Optional instruction pointer.

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

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.

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: