Otawa  0.10
otawa::CFGInfo Class Reference

This allows storing all CFG available in a workspace. More...

#include <otawa/cfg/CFGInfo.h>

Inheritance diagram for otawa::CFGInfo:
elm::Lock

Classes

class  Iter
 

Public Member Functions

 CFGInfo (WorkSpace *fw)
 Build a new CFGInfo. More...
 
virtual ~CFGInfo (void)
 Delete the CFG information contained in this program. More...
 
CFGfindCFG (Address addr)
 Get a CFG from the address of its first instruction. More...
 
CFGfindCFG (Inst *inst)
 Find the CFG starting by the basic block containing this instruction. More...
 
CFGfindCFG (const BasicBlock *bb)
 Find the CFG starting at the given basic block. More...
 
CFGfindCFG (String label)
 Find the CFG starting at the given label. More...
 
void add (CFG *cfg)
 Add a CFG to the CFG information structure. More...
 
void add (BasicBlock *bb)
 Add the given BB to the CFG information. More...
 
void clear (void)
 Remove all CFG stored in this CFG information. More...
 
void lock (void)
 
void unlock ()
 

Static Public Attributes

static Identifier< CFGInfo * > & ID = CFG_INFO
 This property allows to get the CFG information from the current CFG is member of. More...
 

Private Attributes

WorkSpacefw
 
genstruct::FragTable< CFG * > _cfgs
 
genstruct::FragTable
< BasicBlock * > 
bbs
 
MemBlockMap< BasicBlockmap
 

Detailed Description

This allows storing all CFG available in a workspace.

Constructor & Destructor Documentation

otawa::CFGInfo::CFGInfo ( WorkSpace _fw)

Build a new CFGInfo.

Parameters
fwWorkspace that the CFG information applies to.

References TRACE.

otawa::CFGInfo::~CFGInfo ( void  )
virtual

Delete the CFG information contained in this program.

References clear(), and TRACE.

Member Function Documentation

void otawa::CFGInfo::add ( CFG cfg)

Add a CFG to the CFG information structure.

Parameters
cfgAdded CFG.

References _cfgs.

Referenced by otawa::CFGBuilder::addCFG(), and otawa::CFGBuilder::buildCFG().

void otawa::CFGInfo::add ( BasicBlock bb)

Add the given BB to the CFG information.

Parameters
bbBB to add.

References elm::genstruct::FragTable< T >::add(), bbs, and map.

void otawa::CFGInfo::clear ( void  )

Remove all CFG stored in this CFG information.

References _cfgs, otawa::cfgio::bb(), bbs, elm::genstruct::FragTable< T >::clear(), and otawa::cfgio::edge().

Referenced by ~CFGInfo().

CFG * otawa::CFGInfo::findCFG ( Address  addr)

Get a CFG from the address of its first instruction.

Parameters
addrAddress of the first instruction.
Returns
Found CFG or null.

References otawa::cfgio::bb(), and map.

Referenced by findCFG(), otawa::WorkSpace::getStartCFG(), and otawa::CFGCollector::processWorkSpace().

CFG * otawa::CFGInfo::findCFG ( Inst inst)

Find the CFG starting by the basic block containing this instruction.

If the CFG does not exists, it is created and added.

The current algorithm does not allow detecting all CFG due to the irregular nature of the assembly code. Specially, function entries also used as loop head or as jump target of a function without continuation. Using this method, the user may inform the system about other existing CFG.
Parameters
instInstruction to find the CFG starting with.
Returns
Matching CFG or null.

References otawa::ProgItem::address(), otawa::cfgio::bb(), findCFG(), and map.

CFG * otawa::CFGInfo::findCFG ( const BasicBlock bb)

Find the CFG starting at the given basic block.

Parameters
bbBasic block to look at.
Returns
Found CFG or this BB is not a CFG start.

References otawa::ENTRY.

CFG * otawa::CFGInfo::findCFG ( String  label)

Find the CFG starting at the given label.

Parameters
labelLabel of the first instruction of the CFG.
Returns
Matching CFG or null.

References findCFG(), otawa::Process::findInstAt(), fw, and otawa::WorkSpace::process().

Member Data Documentation

genstruct::FragTable<CFG *> otawa::CFGInfo::_cfgs
private

Referenced by add(), and clear().

genstruct::FragTable<BasicBlock *> otawa::CFGInfo::bbs
private

Referenced by add(), and clear().

WorkSpace* otawa::CFGInfo::fw
private

Referenced by findCFG().

MemBlockMap<BasicBlock> otawa::CFGInfo::map
private

Referenced by add(), and findCFG().


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