Otawa  0.10
otawa::ContextTree Class Reference

#include <otawa/util/ContextTree.h>

Inheritance diagram for otawa::ContextTree:
otawa::PropList

Classes

class  BBIterator
 
class  ChildrenIterator
 Iterator for the children of a context tree. More...
 

Public Types

enum  kind_t { ROOT = 0, FUNCTION, LOOP }
 This enumerate represents the kind of a context tree. More...
 
typedef enum
otawa::ContextTree::kind_t 
kind_t
 

Public Member Functions

 ContextTree (CFG *cfg, ContextTree *parent=0, bool _inline=true)
 Build a new context tree for the given CFG. More...
 
 ~ContextTree (void)
 Free the entire tree. More...
 
BasicBlockbb (void) const
 Get the BB that heads this tree (enter of functions for ROOT and FUNCTION, header for LOOP). More...
 
kind_t kind (void) const
 Get the kind of the tree node. More...
 
CFGcfg (void) const
 Get the CFG containing this context tree. More...
 
ContextTreeparent (void) const
 Get the parent tree of the current one. More...
 
bool isChildOf (const ContextTree *ct)
 Test transitively if the current context tree is a child of the given one. More...
 
ContextTreeenclosingFunction (void)
 Find the enclosing function containing this context tree. 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...
 

Private Member Functions

 ContextTree (BasicBlock *bb, CFG *cfg, ContextTree *parent)
 Build the context tree of a loop. More...
 
void addChild (ContextTree *tree)
 Add a children context tree. More...
 
void addBB (BasicBlock *bb, bool _inline)
 Add the given basic block to the context tree. More...
 

Private Attributes

kind_t _kind
 
BasicBlock_bb
 
CFG_cfg
 
elm::genstruct::Vector
< BasicBlock * > 
_bbs
 
elm::genstruct::Vector
< ContextTree * > 
_children
 
ContextTree_parent
 

Member Typedef Documentation

Member Enumeration Documentation

This enumerate represents the kind of a context tree.

Enumerator
ROOT 

A function context tree root of the whole tree.

FUNCTION 

A function context tree (due to a function call).

LOOP 

A loop context tree.

Constructor & Destructor Documentation

otawa::ContextTree::ContextTree ( BasicBlock bb,
CFG cfg,
ContextTree parent 
)
private

Build the context tree of a loop.

Parameters
bbHeader of the loop.
cfgOwner CFG.
parentParent context tree.

Referenced by addBB(), and ContextTree().

otawa::ContextTree::ContextTree ( CFG cfg,
ContextTree parent = 0,
bool  _inline = true 
)

Build a new context tree for the given CFG.

Parameters
cfgCFG to build the context tree for.
parentParent context tree.
_inlineIf true, inline the call BB.

References addBB(), addChild(), bb(), ContextTree(), otawa::ENCLOSING_LOOP_HEADER, otawa::CFG::label(), otawa::LOOP_HEADER, otawa::OWNER_CONTEXT_TREE, parent(), and TRACE.

otawa::ContextTree::~ContextTree ( void  )

Free the entire tree.

References _children.

Member Function Documentation

void otawa::ContextTree::addBB ( BasicBlock bb,
bool  _inline 
)
private

Add the given basic block to the context tree.

Parameters
bbAdded BB.
bbIf true, inline the call.

References _bbs, addChild(), otawa::Edge::CALL, ContextTree(), otawa::cfgio::edge(), enclosingFunction(), otawa::BasicBlock::isCall(), LOOP, parent(), and TRACE.

Referenced by ContextTree().

void otawa::ContextTree::addChild ( ContextTree child)
private

Add a children context tree.

Parameters
childContext tree to add.

References _cfg, _children, _kind, cfg(), FUNCTION, kind(), otawa::CFG::label(), ROOT, and TRACE.

Referenced by addBB(), and ContextTree().

BasicBlock * otawa::ContextTree::bb ( void  ) const
inline

Get the BB that heads this tree (enter of functions for ROOT and FUNCTION, header for LOOP).

Returns
Header of the tree.

References _bb.

Referenced by otawa::ccg::ConstraintBuilder::addConstraintHeader(), otawa::cat::CATConstraintBuilder::buildLBLOCKSET(), ContextTree(), and otawa::cat::CATBuilder::worst().

CFG * otawa::ContextTree::cfg ( void  ) const
inline

Get the CFG containing this context tree.

Returns
Container CFG.

References _cfg.

Referenced by addChild().

void otawa::PropList::clearProps ( void  )
inherited
ContextTree * otawa::ContextTree::enclosingFunction ( void  )

Find the enclosing function containing this context tree.

Called on a function or root context tree returns the current context tree itself.

Returns
Enclosing function context tree.

References kind(), LOOP, and parent().

Referenced by addBB().

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().

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::ContextTree::isChildOf ( const ContextTree ct)
inline

Test transitively if the current context tree is a child of the given one.

Parameters
ctParent context tree.
Returns
True if the current context tree is a child of the given one.

References _parent.

ContextTree * otawa::ContextTree::parent ( void  ) const
inline

Get the parent tree of the current one.

Returns
Parent tree or null for root tree.

References _parent.

Referenced by addBB(), ContextTree(), and enclosingFunction().

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::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

Member Data Documentation

BasicBlock* otawa::ContextTree::_bb
private

Referenced by bb().

elm::genstruct::Vector<BasicBlock *> otawa::ContextTree::_bbs
private

Referenced by addBB().

CFG* otawa::ContextTree::_cfg
private

Referenced by addChild(), and cfg().

elm::genstruct::Vector<ContextTree *> otawa::ContextTree::_children
private

Referenced by addChild(), and ~ContextTree().

kind_t otawa::ContextTree::_kind
private

Referenced by addChild(), and kind().

ContextTree* otawa::ContextTree::_parent
private

Referenced by isChildOf(), and parent().

const PropList otawa::PropList::EMPTY
staticinherited

This is an empty proplist for convenience.


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