ROSE  0.9.9.168
Public Types | Public Member Functions | List of all members
Rose::BinaryAnalysis::Reachability Class Reference

Description

Analysis that computes reachability of CFG vertices.

Certain CFG vertices are marked as intrinsically reachable, such as program entry points, exported functions, signal handlers, etc., and then reachability is propagated through the graph.

Definition at line 15 of file BinaryReachability.h.

#include <BinaryReachability.h>

Public Types

enum  Reason {
  NOT_REACHABLE = 0,
  ENTRY_POINT = 0x00000001,
  EXPORTED_FUNCTION = 0x00000002,
  SIGNAL_HANDLER = 0x00000004,
  PREDEFINED = 0x000000ff,
  USER_DEFINED = 0xffffff00,
  USER_DEFINED_0 = 0x00000100
}
 Predefined bit flags for why something is reachable. More...
 

Public Member Functions

void clear ()
 Clear previous results. More...
 
void clearReachability ()
 Clear all reachability. More...
 
unsigned isIntrinsicallyReachable (size_t vertexId) const
 Query intrinsic reachability. More...
 
void intrinsicallyReachable (size_t vertexId, unsigned how, bool doPropagate=true)
 Change intrinsic reachability. More...
 
unsigned isReachable (size_t vertexId) const
 Query computed reachability. More...
 
const std::vector< unsigned > & reachability () const
 Computed reachability for all vertices. More...
 
void markSpecialFunctions (const Partitioner2::Partitioner &)
 Mark special vertices for containers. More...
 
void propagate ()
 Propagate intrinsic reachability through the graph. More...
 
const Partitioner2::ControlFlowGraphcfg () const
 Property: Control flow graph. More...
 
void cfg (const Partitioner2::ControlFlowGraph &)
 Property: Control flow graph. More...
 

Member Enumeration Documentation

Predefined bit flags for why something is reachable.

Enumerator
NOT_REACHABLE 

Vertex is not reachable.

ENTRY_POINT 

Vertex is a program entry point.

EXPORTED_FUNCTION 

Vertex is an exported function.

SIGNAL_HANDLER 

Vertex is a signal handler.

PREDEFINED 

ROSE-defined reachability reasons.

USER_DEFINED 

User-defined reachability reasons.

USER_DEFINED_0 

First user-defined reason bit.

Definition at line 18 of file BinaryReachability.h.

Member Function Documentation

const Partitioner2::ControlFlowGraph& Rose::BinaryAnalysis::Reachability::cfg ( ) const
inline

Property: Control flow graph.

Assigning a new control flow graph to this analysis will erase all previous information. Assigning an empty control flow graph has the same effect as calling clear.

Definition at line 40 of file BinaryReachability.h.

void Rose::BinaryAnalysis::Reachability::cfg ( const Partitioner2::ControlFlowGraph )

Property: Control flow graph.

Assigning a new control flow graph to this analysis will erase all previous information. Assigning an empty control flow graph has the same effect as calling clear.

void Rose::BinaryAnalysis::Reachability::clear ( )

Clear previous results.

This is the same as setting the control flow graph to an empty graph.

void Rose::BinaryAnalysis::Reachability::clearReachability ( )

Clear all reachability.

This clears all reachability (marking all vertices as not reachable) without throwing away the control flow graph.

unsigned Rose::BinaryAnalysis::Reachability::isIntrinsicallyReachable ( size_t  vertexId) const

Query intrinsic reachability.

Returns the intrinsic reachability for a vertex. The vertex ID numst be valid for the graph being analyzed. The return value is a bit vector of Reason bits, some of which might be user-defined.

void Rose::BinaryAnalysis::Reachability::intrinsicallyReachable ( size_t  vertexId,
unsigned  how,
bool  doPropagate = true 
)

Change intrinsic reachability.

The intrinsic reachability of the specified vertex is changed to how, which is a bit vector of Reason bits. Changing the intrinsic reachability of a vertex to NOT_REACHABLE does not necessarily mark the vertex as unreachable since it might be reachable from other reachable vertices. The new reachability will be immediately propagated through the graph unless doPropagate is false.

unsigned Rose::BinaryAnalysis::Reachability::isReachable ( size_t  vertexId) const

Query computed reachability.

Returns the computed reachability for a vertex. The return value is always a superset of the vertex's intrinsic reachability and is a bit vector of Reason bits. The vertex ID must be valid.

const std::vector<unsigned>& Rose::BinaryAnalysis::Reachability::reachability ( ) const

Computed reachability for all vertices.

The return value is a vector of Reason bit flags for each vertex, indexed by vertex ID.

void Rose::BinaryAnalysis::Reachability::markSpecialFunctions ( const Partitioner2::Partitioner )

Mark special vertices for containers.

Scan the list of functions in the partitioner and mark as reachable the entry points of functions whose reason for existing is because they are program entry points or exports. The specified partitioner's control flow graph must have vertices numbered consistently with the control flow graph that's been set by the cfg property.

void Rose::BinaryAnalysis::Reachability::propagate ( )

Propagate intrinsic reachability through the graph.

This runs a data-flow analysis to propagate the intrinsic reachability bits through the graph. The propagation happens automatically whenever intrinsicallyReachable is called unless its doPropagate parameter is false.


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