Otawa  0.10
otawa::tsim::BBPath Class Reference

#include <otawa/tsim/BBPath.h>

Inheritance diagram for otawa::tsim::BBPath:
otawa::PropList

Classes

class  BBIterator
 

Public Member Functions

elm::genstruct::Vector< BBPath * > * nexts ()
 Builds a vector containing this BBSequence made longer with all successors of the last basic block it holds. More...
 
int time (WorkSpace *fw)
 Returns the number of cycles the processor must do to cover the sequence. More...
 
int countInstructions ()
 
int t (WorkSpace *fw)
 tests if two BBSequences are the same or not (same basic blocks in the path)
More...
 
int length ()
 Gives the number of basic blocks that composes this path. More...
 
int l ()
 Same as BBPath::length()
Gives the number of basic blocks that composes this path. More...
 
BasicBlockhead ()
 
BasicBlocktail ()
 
elm::String makeVarName ()
 Creates a human-readable name (or representation) for this sequence
This name is like Seq_x1_x2_x3 if the basic blocks have names x1, x2 and x3. More...
 
ilp::VargetVar (ilp::System *system, bool explicit_names=false)
 if this sequence doesn't have a var (for the ilp system) attached, creates a new one More...
 
BBPathsub (int begin, int end)
 Returns a sub-path. More...
 
BBPathoperator() (int begin, int end)
 
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 Member Functions

static BBPathgetBBPath (BasicBlock *start)
 Returns the path of length 1 composed by only the given basic block. More...
 
static BBPathgetBBPath (elm::genstruct::Vector< BasicBlock * > *path)
 Returns the path composed by the given path. More...
 

Static Public Attributes

static int instructions_simulated = 0
 
static const PropList EMPTY
 This is an empty proplist for convenience. More...
 

Protected Member Functions

 BBPath (BasicBlock *start)
 Builds a new BBPath (length=1) from a given basic block. More...
 
 BBPath (elm::genstruct::Vector< BasicBlock * > *path)
 Builds a new BBPath from a vector of basic blocks. More...
 
int simulate (WorkSpace *fw)
 Launches a simulation of the sequence. More...
 

Protected Attributes

int _length
 
elm::genstruct::Vector
< BasicBlock * > 
basicBlocks
 
WorkSpacelast_framework_used
 

Friends

class PathManager
 

Detailed Description

Author
G. Cavaignac

This class represents a sequence of basic blocks, making a basic block path. BBPath are linked with others, and linked to basic blocks, and they are unique. One can't have two instances of the same path. It is possible to get a simulated time for this sequence

Constructor & Destructor Documentation

otawa::tsim::BBPath::BBPath ( BasicBlock start)
protected

Builds a new BBPath (length=1) from a given basic block.

Parameters
frameworkFrameWork where one can get a simulator, or IPET::ID_Explicit
startstarting basic block

References basicBlocks.

Referenced by getBBPath().

otawa::tsim::BBPath::BBPath ( elm::genstruct::Vector< BasicBlock * > *  path)
protected

Builds a new BBPath from a vector of basic blocks.

Parameters
frameworkFrameWork where one can get a simulator, or IPET::ID_Explicit
pathvector of the basic blocks

References basicBlocks, elm::genstruct::Vector< T >::get(), l(), and elm::genstruct::Vector< T >::length().

Member Function Documentation

void otawa::PropList::clearProps ( void  )
inherited
int otawa::tsim::BBPath::countInstructions ( void  )

References _length, and basicBlocks.

Referenced by otawa::tsim::Delta::processCFG(), and simulate().

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

BBPath * otawa::tsim::BBPath::getBBPath ( BasicBlock start)
static

Returns the path of length 1 composed by only the given basic block.

If this path doesn't exist, creates it.

Parameters
startbasic block
Returns
BBPath corresponding to the given basic block

References BBPath(), otawa::tsim::TreePath< T1, T2 >::rootData(), and otawa::tsim::Delta::TREE.

Referenced by nexts(), otawa::tsim::Delta::processBBPath(), otawa::tsim::Delta::processCFG(), and sub().

BBPath * otawa::tsim::BBPath::getBBPath ( elm::genstruct::Vector< BasicBlock * > *  path)
static

Returns the path composed by the given path.

If this path doesn't exist, creates it.

Parameters
pathvector of basic blocks composing the path
Returns
BBPath corresponding to the given path

References otawa::tsim::TreePath< T1, T2 >::add(), otawa::cfgio::bb(), BBPath(), elm::genstruct::Vector< T >::get(), otawa::tsim::TreePath< T1, T2 >::get(), and otawa::tsim::Delta::TREE.

ilp::Var * otawa::tsim::BBPath::getVar ( ilp::System system,
bool  explicit_names = false 
)

if this sequence doesn't have a var (for the ilp system) attached, creates a new one

Returns
Var corresponding to this sequence

References basicBlocks, length(), makeVarName(), otawa::ilp::System::newVar(), and otawa::ipet::VAR.

Referenced by otawa::tsim::Delta::processBBPath().

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

BasicBlock * otawa::tsim::BBPath::head ( void  )
inline
int otawa::tsim::BBPath::l ( )
inline

Same as BBPath::length()
Gives the number of basic blocks that composes this path.

Returns
length of the path

References length().

Referenced by BBPath(), and nexts().

int otawa::tsim::BBPath::length ( void  )
inline

Gives the number of basic blocks that composes this path.

Returns
length of the path

References _length.

Referenced by otawa::tsim::Delta::delta(), getVar(), l(), makeVarName(), otawa::tsim::Delta::processBBPath(), otawa::tsim::Delta::processCFG(), and sub().

String otawa::tsim::BBPath::makeVarName ( )

Creates a human-readable name (or representation) for this sequence
This name is like Seq_x1_x2_x3 if the basic blocks have names x1, x2 and x3.

Returns
string containing the sequence name

References basicBlocks, buf, elm::String::isEmpty(), length(), otawa::ilp::Var::name(), elm::StringBuffer::toString(), and otawa::ipet::VAR.

Referenced by getVar().

Vector< BBPath * > * otawa::tsim::BBPath::nexts ( )

Builds a vector containing this BBSequence made longer with all successors of the last basic block it holds.


Searches in the Delta Processor if these sequences already exists

Returns
vector of the new BBSequences

References elm::genstruct::Vector< T >::add(), basicBlocks, otawa::cfgio::bb(), otawa::cfgio::edge(), getBBPath(), and l().

Referenced by otawa::tsim::Delta::processBBPath(), and otawa::tsim::Delta::processCFG().

BBPath * otawa::tsim::BBPath::operator() ( int  begin,
int  end 
)
inline

References sub().

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
int otawa::tsim::BBPath::simulate ( WorkSpace fw)
protected

Launches a simulation of the sequence.

If the simulator supports state cloning, it uses the saved state of the sub-sequences in order to simulate less instructions.

Returns
number of cycles to cover the sequence

References countInstructions(), otawa::sim::State::cycle(), otawa::sim::State::flush(), otawa::sim::Simulator::instantiate(), instructions_simulated, otawa::WorkSpace::process(), otawa::sim::State::reset(), otawa::sim::State::run(), otawa::Process::simulator(), and otawa::sim::USE_MEMORY.

Referenced by time().

BBPath * otawa::tsim::BBPath::sub ( int  begin,
int  end 
)

Returns a sub-path.

Searches if this path already exists

Parameters
beginindex of the first basic block (first = 1)
endindex of the last basic block (last = length())
Returns
sub-path of current path, from begin to end indexes

References elm::genstruct::Vector< T >::add(), basicBlocks, otawa::p::end, getBBPath(), and length().

Referenced by operator()().

int otawa::tsim::BBPath::t ( WorkSpace fw)
inline

tests if two BBSequences are the same or not (same basic blocks in the path)

Parameters
bbsBBSequence to compare
Returns
boolean : true if both sequences are the same

Same as BBPath::time()
Returns the number of cycles the processor must do to cover the path. Simulates the path if necessary

Returns
number of cycles

References time().

Referenced by otawa::tsim::Delta::delta().

BasicBlock * otawa::tsim::BBPath::tail ( )
inline
int otawa::tsim::BBPath::time ( WorkSpace fw)

Returns the number of cycles the processor must do to cover the sequence.

Simulates the sequence if necessary

Returns
number of cycles

References simulate(), and otawa::ipet::TIME.

Referenced by otawa::tsim::Delta::delta(), otawa::tsim::Delta::processBBPath(), and t().

Friends And Related Function Documentation

friend class PathManager
friend

Member Data Documentation

int otawa::tsim::BBPath::_length
protected

Referenced by countInstructions(), and length().

elm::genstruct::Vector<BasicBlock*> otawa::tsim::BBPath::basicBlocks
protected
const PropList otawa::PropList::EMPTY
staticinherited

This is an empty proplist for convenience.

int otawa::tsim::BBPath::instructions_simulated = 0
static

Referenced by simulate().

WorkSpace* otawa::tsim::BBPath::last_framework_used
protected

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