Otawa  0.10
otawa::pfg::PFG Class Reference

A PFG (Program Flow Graph) is built from the binary form of the program to represent all possible pathes of the program from its entry point. More...

#include <otawa/cfg/PFG.h>

Inheritance diagram for otawa::pfg::PFG:
otawa::GenGraph< N, E > otawa::graph::Graph

Public Types

typedef N * Vertex
 
typedef E * Edge
 

Public Member Functions

 PFG (void)
 PFG constructor. More...
 
void add (BB *bb)
 Add a basic block to a PFG. More...
 
BBget (Address addr)
 Get a basic block from its address. More...
 
int count (void) const
 
bool contains (N *item) const
 
bool isEmpty (void) const
 
 operator bool (void) const
 
void clear (void)
 
void add (GenNode *node)
 
void add (Node *node)
 Add new node. More...
 
template<template< class _ > class C>
void addAll (const C< N * > &items)
 
void remove (GenNode *node)
 
void remove (GenEdge *edge)
 
template<template< class _ > class C>
void removeAll (const C< N * > &items)
 
N * sinkOf (E *edge) const
 
int outDegree (N *vertex) const
 
bool isSuccessorOf (N *succ, N *ref) const
 
N * sourceOf (E *edge) const
 
int inDegree (N *vertex) const
 
bool isPredecessorOf (N *succ, N *ref) const
 
int indexOf (N *vertex) const
 
const graph::Graph_ (void) const
 
graph::Graph_ (void)
 

Static Public Member Functions

static const graph::Node_ (const GenNode *node)
 
static const graph::Edge_ (const GenEdge *edge)
 
static graph::Node_ (GenNode *node)
 
static graph::Edge_ (Edge *edge)
 

Public Attributes

BB ret
 This special basic block is used as the sink vertex of edges representing sub-program return. More...
 
BB unknown
 This special basic block is used as the sink vertex of edges representing branch or call to an unknown target. More...
 

Private Attributes

genstruct::HashTable< Address,
BB * > 
bbs
 

Detailed Description

A PFG (Program Flow Graph) is built from the binary form of the program to represent all possible pathes of the program from its entry point.

Building a PFG is the first step to understand the control flow of the program. Usually, it helps to analyze the sub-program and processed CFG (Control Flow Graphs) are extracted from it.

Member Typedef Documentation

template<class N, class E>
typedef E* otawa::GenGraph< N, E >::Edge
inherited
template<class N, class E>
typedef N* otawa::GenGraph< N, E >::Vertex
inherited

Constructor & Destructor Documentation

otawa::pfg::PFG::PFG ( void  )

PFG constructor.

References otawa::GenGraph< N, E >::add(), ret, and unknown.

Member Function Documentation

template<class N, class E>
static const graph::Node* otawa::GenGraph< N, E >::_ ( const GenNode node)
inlinestaticinherited
template<class N, class E>
static const graph::Edge* otawa::GenGraph< N, E >::_ ( const GenEdge edge)
inlinestaticinherited
template<class N, class E>
const graph::Graph* otawa::GenGraph< N, E >::_ ( void  ) const
inlineinherited
template<class N, class E>
static graph::Node* otawa::GenGraph< N, E >::_ ( GenNode node)
inlinestaticinherited
template<class N, class E>
static graph::Edge* otawa::GenGraph< N, E >::_ ( Edge edge)
inlinestaticinherited
template<class N, class E>
graph::Graph* otawa::GenGraph< N, E >::_ ( void  )
inlineinherited
template<class N, class E>
void otawa::GenGraph< N, E >::add ( GenNode node)
inlineinherited
void otawa::pfg::PFG::add ( BB bb)

Add a basic block to a PFG.

Parameters
bbBasic block to add.
Warning
Linking with edges basic block from different PFG results in an error.

References otawa::GenGraph< N, E >::add(), otawa::pfg::BB::address(), otawa::cfgio::bb(), and bbs.

Referenced by otawa::PFGBuilder::addFunction().

void otawa::graph::Graph::add ( Node node)
inherited
template<class N, class E>
template<template< class _ > class C>
void otawa::GenGraph< N, E >::addAll ( const C< N * > &  items)
inlineinherited
template<class N, class E>
void otawa::GenGraph< N, E >::clear ( void  )
inlineinherited
template<class N, class E>
bool otawa::GenGraph< N, E >::contains ( N *  item) const
inlineinherited
template<class N, class E>
int otawa::GenGraph< N, E >::count ( void  ) const
inlineinherited
BB * otawa::pfg::PFG::get ( Address  addr)

Get a basic block from its address.

Parameters
addrAddress of start of the the basic block to get.
Returns
Found basic block at the starting address, null else.

References bbs.

template<class N, class E>
int otawa::GenGraph< N, E >::inDegree ( N *  vertex) const
inlineinherited
template<class N, class E>
int otawa::GenGraph< N, E >::indexOf ( N *  vertex) const
inlineinherited
template<class N, class E>
bool otawa::GenGraph< N, E >::isEmpty ( void  ) const
inlineinherited
template<class N, class E>
bool otawa::GenGraph< N, E >::isPredecessorOf ( N *  succ,
N *  ref 
) const
inlineinherited
template<class N, class E>
bool otawa::GenGraph< N, E >::isSuccessorOf ( N *  succ,
N *  ref 
) const
inlineinherited
template<class N, class E>
otawa::GenGraph< N, E >::operator bool ( void  ) const
inlineinherited
template<class N, class E>
int otawa::GenGraph< N, E >::outDegree ( N *  vertex) const
inlineinherited
template<class N, class E>
void otawa::GenGraph< N, E >::remove ( GenNode node)
inlineinherited
template<class N, class E>
void otawa::GenGraph< N, E >::remove ( GenEdge edge)
inlineinherited
template<class N, class E>
template<template< class _ > class C>
void otawa::GenGraph< N, E >::removeAll ( const C< N * > &  items)
inlineinherited
template<class N, class E>
N* otawa::GenGraph< N, E >::sinkOf ( E *  edge) const
inlineinherited
template<class N, class E>
N* otawa::GenGraph< N, E >::sourceOf ( E *  edge) const
inlineinherited

Member Data Documentation

genstruct::HashTable<Address, BB *> otawa::pfg::PFG::bbs
private

Referenced by add(), and get().

BB otawa::pfg::PFG::ret

This special basic block is used as the sink vertex of edges representing sub-program return.

Referenced by otawa::PFGBuilder::finalizeBB(), PFG(), and otawa::PFGBuilder::processWorkSpace().

BB otawa::pfg::PFG::unknown

This special basic block is used as the sink vertex of edges representing branch or call to an unknown target.

Referenced by otawa::PFGBuilder::finalizeBB(), PFG(), and otawa::PFGBuilder::processWorkSpace().


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