Otawa  0.10
otawa::CFG Class Reference

Control Flow Graph representation. More...

#include <otawa/cfg/CFG.h>

Inheritance diagram for otawa::CFG:
otawa::PropList otawa::VirtualCFG

Classes

class  BBIterator
 

Public Member Functions

 CFG (Segment *seg, BasicBlock *entry)
 Constructor. More...
 
virtual ~CFG (void)
 
Segmentsegment (void) const
 
string label (void)
 Get some label to identify the CFG. More...
 
string name (void)
 Build a name that identifies this CFG and is valid C name. More...
 
string format (const Address &addr)
 Format the display of the given address relativelt to the given CFG. More...
 
int number (void)
 
address_t address (void)
 Get the address of the first instruction of the CFG. More...
 
BasicBlockentry (void)
 Get the entry basic block of the CFG. More...
 
BasicBlockexit (void)
 Get the exit basic block of the CFG. More...
 
int countBB (void)
 
bool isVirtual (void) const
 
bool isInlined (void) const
 
void numberBB (void)
 Number the basic block of the CFG, that is, hook a property with ID_Index identifier and the integer value of the number to each basic block. More...
 
BasicBlockfirstBB (void)
 Get the first basic block of the CFG. More...
 
InstfirstInst (void)
 Get the first instruction of the CFG. More...
 
void print (io::Output &out)
 Print a reference for the CFG. More...
 
PropertygetProp (const AbstractIdentifier *id) const
 Find a property by its identifier. More...
 
void setProp (Property *prop)
 Set the property in the property list removing any double. More...
 
void setProp (const AbstractIdentifier *id)
 
void removeProp (const AbstractIdentifier *id)
 Remove a property matching the given identifier. More...
 
void removeProp (const AbstractIdentifier &id)
 
PropertyextractProp (const AbstractIdentifier *id)
 Remove a property matching the given identifier and return it. More...
 
PropertyextractProp (const AbstractIdentifier &id)
 Remove a property matching the given identifier and return it. More...
 
void addProp (Property *prop)
 Add property to the list without checking of duplication. More...
 
void removeAllProp (const AbstractIdentifier *id)
 Remove all the properties matching the given identifier. More...
 
bool hasProp (const AbstractIdentifier &id) const
 Test if the property list contains a property matching the given identifier. More...
 
void clearProps (void)
 Remove all properties from the list. More...
 
void addProps (const PropList &props)
 Add all properties from the given property list, in a reverse order. More...
 
void print (elm::io::Output &out) const
 Display the current property list. More...
 

Static Public Attributes

static const PropList EMPTY
 This is an empty proplist for convenience. More...
 

Protected Member Functions

 CFG (void)
 Build an empty CFG. More...
 
virtual void scan (void)
 Scan the CFG for finding exit and builds virtual edges with entry and exit. More...
 

Protected Attributes

unsigned long flags
 
EndBasicBlock _entry
 
EndBasicBlock _exit
 
bbs_t _bbs
 

Static Protected Attributes

static const unsigned long FLAG_Scanned = 0x01
 
static const unsigned long FLAG_Virtual = 0x02
 
static const unsigned long FLAG_Inlined = 0x04
 

Private Types

typedef genstruct::FragTable
< BasicBlock * > 
bbs_t
 

Private Member Functions

const bbs_tgetBBS (void)
 

Private Attributes

Segment_seg
 
BasicBlockent
 

Friends

class CFGInfo
 

Detailed Description

Control Flow Graph representation.

Its entry basic block is given and the graph is built using following taken and not-taken properties of the block.

Member Typedef Documentation

Constructor & Destructor Documentation

otawa::CFG::CFG ( Segment seg,
BasicBlock entry 
)

Constructor.

Add a property to the basic block for quick retrieval of the matching CFG.

References otawa::FUNCTION_LABEL, label(), and otawa::LABEL.

otawa::CFG::~CFG ( void  )
virtual
otawa::CFG::CFG ( void  )
protected

Build an empty CFG.

Member Function Documentation

Address otawa::CFG::address ( void  )

Get the address of the first instruction of the CFG.

Returns
Return address of the first instruction.

References otawa::BasicBlock::address(), otawa::cfgio::edge(), ent, entry(), and otawa::Address::null.

Referenced by otawa::PCGBlock::getAddress(), makeAddress(), and nameOf().

void otawa::PropList::clearProps ( void  )
inherited
Property * otawa::PropList::extractProp ( const AbstractIdentifier id)
inherited

Remove a property matching the given identifier and return it.

Caller is responsible of the management of the obtained property.

Parameters
idIdentifier of the property to extract.

References otawa::Property::_next, and otawa::Property::next().

Referenced by otawa::script::Script::makeConfig().

Property * otawa::PropList::extractProp ( const AbstractIdentifier id)
inlineinherited

Remove a property matching the given identifier and return it.

Caller is responsible of the management of the obtained property.

Parameters
idIdentifier of the property to extract.

References otawa::PropList::extractProp().

Referenced by otawa::PropList::extractProp().

BasicBlock * otawa::CFG::firstBB ( void  )

Get the first basic block of the CFG.

Returns
First basic block.

References _bbs, FLAG_Scanned, flags, and scan().

Referenced by otawa::DelayedBuilder::buildEdges(), firstInst(), and otawa::etime::EdgeTimeBuilder::processEdge().

Inst * otawa::CFG::firstInst ( void  )

Get the first instruction of the CFG.

Returns
First instruction of the CFG.

References otawa::cfgio::bb(), firstBB(), FLAG_Scanned, flags, and scan().

Referenced by otawa::Virtualizer::isInlined(), otawa::CFGProcessor::str(), otawa::VirtualCFG::virtualize(), and otawa::Virtualizer::virtualize().

string otawa::CFG::format ( const Address addr)

Format the display of the given address relativelt to the given CFG.

Parameters
addrAddress to format.
Returns
Formatted address.

References elm::_, otawa::ot::address(), elm::io::hex(), and otawa::display::LABEL.

const bbs_t& otawa::CFG::getBBS ( void  )
inlineprivate

References _bbs, FLAG_Scanned, flags, and scan().

bool otawa::PropList::hasProp ( const AbstractIdentifier id) const
inlineinherited

Test if the property list contains a property matching the given identifier.

Parameters
idProperty identifier to look for.
Returns
True if the list contains the matching property, false else.

References otawa::PropList::getProp().

Referenced by otawa::ipet::BasicConstraintsBuilder::addEntryConstraint(), otawa::Monitor::configure(), otawa::ImmutableRef< T, I >::exists(), and otawa::Manager::setVerbosity().

bool otawa::CFG::isInlined ( void  ) const
inline

References FLAG_Inlined, and flags.

Referenced by otawa::VirtualCFG::virtualize().

bool otawa::CFG::isVirtual ( void  ) const
inline
string otawa::CFG::name ( void  )

Build a name that identifies this CFG and is valid C name.

Returns
Name of the CFG.

References _, otawa::BasicBlock::address(), ent, and label().

void otawa::CFG::numberBB ( void  )

Number the basic block of the CFG, that is, hook a property with ID_Index identifier and the integer value of the number to each basic block.

The entry get the number 0 et the exit the last number.

References _bbs, otawa::INDEX, and elm::genstruct::FragTable< T >::length().

Referenced by otawa::PSTBuilder::getVCFG(), and otawa::Virtualizer::virtualizeCFG().

void otawa::CFG::print ( io::Output out)

Print a reference for the CFG.

Parameters
outOutput stream.

References label().

Referenced by otawa::operator<<().

void otawa::PropList::print ( elm::io::Output out) const
inherited

Display the current property list.

Parameters
outOutput to use.

Referenced by otawa::operator<<(), and otawa::ContextualProperty::print().

void otawa::PropList::removeAllProp ( const AbstractIdentifier id)
inherited

Remove all the properties matching the given identifier.

Parameters
idIdentifier of properties to remove.

References otawa::Property::_next, and otawa::Property::next().

Referenced by otawa::LoopUnroller::unroll().

void otawa::PropList::removeProp ( const AbstractIdentifier id)
inherited
void otawa::PropList::removeProp ( const AbstractIdentifier id)
inlineinherited
void otawa::CFG::scan ( void  )
protectedvirtual
Segment * otawa::CFG::segment ( void  ) const
inline

References _seg.

void otawa::PropList::setProp ( Property prop)
inherited

Set the property in the property list removing any double.

Parameters
propProperty to set.

References otawa::Property::_next, otawa::Property::id(), and otawa::Property::next().

void otawa::PropList::setProp ( const AbstractIdentifier id)
inlineinherited

Friends And Related Function Documentation

friend class CFGInfo
friend

Member Data Documentation

EndBasicBlock otawa::CFG::_entry
protected
EndBasicBlock otawa::CFG::_exit
protected
Segment* otawa::CFG::_seg
private

Referenced by segment().

const PropList otawa::PropList::EMPTY
staticinherited

This is an empty proplist for convenience.

BasicBlock* otawa::CFG::ent
mutableprivate

Referenced by address(), label(), name(), and scan().

const unsigned long otawa::CFG::FLAG_Inlined = 0x04
staticprotected
const unsigned long otawa::CFG::FLAG_Scanned = 0x01
staticprotected
const unsigned long otawa::CFG::FLAG_Virtual = 0x02
staticprotected

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