Otawa  0.10
otawa::ParExeGraph Class Reference

Representation of a parametric execution graph (Parametric Execution Graph). More...

#include <otawa/parexegraph/ParExeGraph.h>

Inheritance diagram for otawa::ParExeGraph:
otawa::GenGraph< ParExeNode, ParExeEdge > otawa::graph::Graph

Classes

class  InstIterator
 
class  InstNodeIterator
 
class  Predecessor
 
class  PreorderIterator
 
struct  rename_table_t
 
class  StageIterator
 
class  StageNodeIterator
 
class  Successor
 

Public Types

typedef ParExeNodeVertex
 
typedef ParExeEdgeEdge
 

Public Member Functions

 ParExeGraph (WorkSpace *ws, ParExeProc *proc, elm::genstruct::Vector< Resource * > *hw_resources, ParExeSequence *seq, const PropList &props=PropList::EMPTY)
 Build a parametric execution graph. More...
 
virtual ~ParExeGraph (void)
 
ParExeSequencegetSequence (void) const
 
ParExeNodefirstNode ()
 
virtual ParExePipelinepipeline (ParExeStage *stage, ParExeInst *inst)
 
int numResources ()
 
Resourceresource (int index)
 
int numInstructions ()
 
virtual void build ()
 
virtual void createNodes (void)
 Creates nodes in the graph: one node for each (instruction/pipeline_stage) pair. More...
 
virtual void findDataDependencies (void)
 Compute for each first FU node which is the FU node producing the required data (and fill the producer list of a FU node). More...
 
virtual void addEdgesForPipelineOrder (void)
 Adds edges that represent the order of stages in the pipeline. More...
 
virtual void addEdgesForFetch (void)
 Add edges for fetch timing, that is edges ensuring that instruction in the same block are fetched in the same cycle and that instructions in sequence belonging to different memory blocks require are fetched in two cycles. More...
 
virtual void addEdgesForProgramOrder (elm::genstruct::SLList< ParExeStage * > *list_of_stages=NULL)
 Adds edges to reflect processing of instruction in the order of the program. More...
 
virtual void addEdgesForMemoryOrder (void)
 Adds edges to represent contention to access memory, basically, between FUs of instructions performing memory access. More...
 
virtual void addEdgesForDataDependencies (void)
 Adds edges for data dependencies, that is, if an instruction (a) produces content of a register and instruction (b) uses this register value create a solid edge between their execute stages. More...
 
virtual void addEdgesForQueues (void)
 Called to add edges representing contention on the different queues of the microprocessor. More...
 
void findContendingNodes ()
 
void createSequenceResources ()
 
int analyze ()
 Computes the cost, in cycles, of the current graph. More...
 
void initDelays ()
 
void clearDelays ()
 
void restoreDefaultLatencies ()
 
void setDefaultLatencies (TimingContext *tctxt)
 
void setLatencies (TimingContext *tctxt)
 
void propagate ()
 
void analyzeContentions ()
 
int cost ()
 
int delta (ParExeNode *a, Resource *res)
 This method is called to compute the delay of a given node compared to the last node of the prologue (i.e. More...
 
void dump (elm::io::Output &dotFile, const string &info="")
 
void display (elm::io::Output &output)
 
int count (void) const
 
bool contains (ParExeNode *item) const
 
bool isEmpty (void) const
 
 operator bool (void) const
 
void clear (void)
 
void add (GenNode *node)
 
void addAll (const C< ParExeNode * > &items)
 
void remove (GenNode *node)
 
void remove (GenEdge *edge)
 
void removeAll (const C< ParExeNode * > &items)
 
ParExeNodesinkOf (ParExeEdge *edge) const
 
int outDegree (ParExeNode *vertex) const
 
bool isSuccessorOf (ParExeNode *succ, ParExeNode *ref) const
 
ParExeNodesourceOf (ParExeEdge *edge) const
 
int inDegree (ParExeNode *vertex) const
 
bool isPredecessorOf (ParExeNode *succ, ParExeNode *ref) const
 
int indexOf (ParExeNode *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)
 

Protected Types

typedef struct
otawa::ParExeGraph::rename_table_t 
rename_table_t
 

Protected Attributes

WorkSpace_ws
 
PropList _props
 
ParExeProc_microprocessor
 
elm::genstruct::Vector
< Resource * > 
_resources
 
ParExeNode_first_node
 
ParExeNode_last_prologue_node
 
ParExeNode_last_node
 

Private Attributes

ParExeSequence_sequence
 
int _cache_line_size
 
int _capacity
 
int _branch_penalty
 

Friends

class InstIterator
 
class ParExeNode
 

Detailed Description

Representation of a parametric execution graph (Parametric Execution Graph).

Member Typedef Documentation

Constructor & Destructor Documentation

otawa::ParExeGraph::ParExeGraph ( WorkSpace ws,
ParExeProc proc,
elm::genstruct::Vector< Resource * > *  hw_resources,
ParExeSequence seq,
const PropList props = PropList::EMPTY 
)

Build a parametric execution graph.

Parameters
wsCurrent workspace.
procProcessor description.
seqInstruction sequence to compute.
propsOther parameters.

References _cache_line_size, _props, _resources, otawa::hard::Cache::blockSize(), cache, otawa::hard::CACHE_CONFIGURATION, otawa::hard::CacheConfiguration::instCache(), otawa::Process::instSize(), elm::genstruct::Vector< T >::isEmpty(), and otawa::WorkSpace::process().

otawa::ParExeGraph::~ParExeGraph ( void  )
virtual

Member Function Documentation

static const graph::Node* otawa::GenGraph< ParExeNode , ParExeEdge >::_ ( const GenNode *  node)
inlinestaticinherited
static const graph::Edge* otawa::GenGraph< ParExeNode , ParExeEdge >::_ ( const GenEdge *  edge)
inlinestaticinherited
const graph::Graph* otawa::GenGraph< ParExeNode , ParExeEdge >::_ ( void  ) const
inlineinherited
static graph::Node* otawa::GenGraph< ParExeNode , ParExeEdge >::_ ( GenNode *  node)
inlinestaticinherited
static graph::Edge* otawa::GenGraph< ParExeNode , ParExeEdge >::_ ( Edge edge)
inlinestaticinherited
graph::Graph* otawa::GenGraph< ParExeNode , ParExeEdge >::_ ( void  )
inlineinherited
void otawa::GenGraph< ParExeNode , ParExeEdge >::add ( GenNode *  node)
inlineinherited
void otawa::GenGraph< ParExeNode , ParExeEdge >::addAll ( const C< ParExeNode * > &  items)
inlineinherited
void otawa::ParExeGraph::addEdgesForDataDependencies ( void  )
virtual

Adds edges for data dependencies, that is, if an instruction (a) produces content of a register and instruction (b) uses this register value create a solid edge between their execute stages.

References _microprocessor, otawa::ParExeProc::execStage(), otawa::ParExePipeline::firstStage(), otawa::ParExeStage::fu(), otawa::ParExeNode::inst(), otawa::ParExeStage::node(), otawa::ParExeStage::numFus(), otawa::ParExeStage::numNodes(), and otawa::ParExeEdge::SOLID.

Referenced by build().

void otawa::ParExeGraph::addEdgesForFetch ( void  )
virtual

Add edges for fetch timing, that is edges ensuring that instruction in the same block are fetched in the same cycle and that instructions in sequence belonging to different memory blocks require are fetched in two cycles.

For example, for a block size of 16 with fixed-size instructions of 4 bytes, the instruction sequence is marked with fetches bounds:

  • start of basic block
  • 0x100C fetch
  • 0x1010 fetch
  • 0x1014
  • 0x1018
  • 0x101C
  • 0x1010 fetch
  • 0x1014

References _branch_penalty, _cache_line_size, _microprocessor, otawa::ProgItem::address(), otawa::cfgio::edge(), otawa::ParExeProc::fetchStage(), otawa::ParExeStage::firstNode(), otawa::ParExeInst::inst(), otawa::ParExeNode::inst(), otawa::Address::offset(), otawa::ParExeEdge::SLASHED, otawa::ParExeEdge::SOLID, and otawa::ProgItem::topAddress().

Referenced by build().

void otawa::ParExeGraph::addEdgesForMemoryOrder ( void  )
virtual
void otawa::ParExeGraph::addEdgesForPipelineOrder ( void  )
virtual

Adds edges that represent the order of stages in the pipeline.

References _sequence, and otawa::ParExeEdge::SOLID.

Referenced by build().

void otawa::ParExeGraph::addEdgesForProgramOrder ( elm::genstruct::SLList< ParExeStage * > *  list_of_stages = NULL)
virtual

Adds edges to reflect processing of instruction in the order of the program.

Parameters
list_of_stagesList of stages that process nodes in order (if an empty pointer is passed, one is created containing the in-order-scheduled stages).

References _microprocessor, otawa::GenGraph< ParExeNode, ParExeEdge >::count(), otawa::ParExeProc::listOfInorderStages(), otawa::ParExeEdge::SLASHED, and otawa::ParExeEdge::SOLID.

Referenced by build().

void otawa::ParExeGraph::addEdgesForQueues ( void  )
virtual

Called to add edges representing contention on the different queues of the microprocessor.

References _microprocessor, otawa::ParExeQueue::fillingStage(), otawa::ParExeQueue::name(), otawa::ParExeStage::node(), otawa::ParExeProc::pipeline(), otawa::ParExeQueue::size(), and otawa::ParExeEdge::SLASHED.

Referenced by build().

int otawa::ParExeGraph::analyze ( )

Computes the cost, in cycles, of the current graph.

The cost is the difference between the execution date in the commit stage of the last instruction of the considered instruction and of the last prefix instruction.

Returns
Cost for the current graph.

References _last_node, _last_prologue_node, clearDelays(), cost(), otawa::ParExeNode::delay(), initDelays(), and propagate().

Referenced by otawa::etime::EdgeTimeBuilder::processSequence().

void otawa::ParExeGraph::analyzeContentions ( )
void otawa::GenGraph< ParExeNode , ParExeEdge >::clear ( void  )
inlineinherited
void otawa::ParExeGraph::clearDelays ( )

References _resources, otawa::Resource::index(), and resource().

Referenced by analyze().

bool otawa::GenGraph< ParExeNode , ParExeEdge >::contains ( ParExeNode item) const
inlineinherited
int otawa::ParExeGraph::cost ( void  )
int otawa::GenGraph< ParExeNode , ParExeEdge >::count ( void  ) const
inlineinherited

Referenced by addEdgesForProgramOrder().

void otawa::ParExeGraph::createNodes ( void  )
virtual

Creates nodes in the graph: one node for each (instruction/pipeline_stage) pair.

For the execution stage, creates as many nodes as stages in the pipeline of the required functional unit.

References _last_node, _microprocessor, _sequence, otawa::ParExeStage::EXECUTE, ParExeNode, otawa::ParExeProc::pipeline(), and pipeline().

Referenced by build().

int otawa::ParExeGraph::delta ( ParExeNode node,
Resource res 
)

This method is called to compute the delay of a given node compared to the last node of the prologue (i.e.

the last node of the preceding block) with respect to a given resource.

Parameters
nodeThe node for which the delay is computed (e.g., the last node of the basic block under analysis)
resThe resource for which the delay is computed.
Returns
Delay (number of cycles).

References _last_prologue_node, _microprocessor, otawa::ParExeNode::delay(), otawa::Resource::index(), numResources(), otawa::ParExePipeline::numStages(), otawa::ParExeProc::pipeline(), otawa::Resource::QUEUE, otawa::Resource::STAGE, and otawa::Resource::type().

Referenced by cost().

void otawa::ParExeGraph::display ( elm::io::Output output)
void otawa::ParExeGraph::findDataDependencies ( void  )
virtual

Compute for each first FU node which is the FU node producing the required data (and fill the producer list of a FU node).

ParExeNode* otawa::ParExeGraph::firstNode ( void  )
inline
ParExeSequence* otawa::ParExeGraph::getSequence ( void  ) const
inline

References _sequence.

int otawa::GenGraph< ParExeNode , ParExeEdge >::inDegree ( ParExeNode vertex) const
inlineinherited
int otawa::GenGraph< ParExeNode , ParExeEdge >::indexOf ( ParExeNode vertex) const
inlineinherited
bool otawa::GenGraph< ParExeNode , ParExeEdge >::isEmpty ( void  ) const
inlineinherited
bool otawa::GenGraph< ParExeNode , ParExeEdge >::isPredecessorOf ( ParExeNode succ,
ParExeNode ref 
) const
inlineinherited
bool otawa::GenGraph< ParExeNode , ParExeEdge >::isSuccessorOf ( ParExeNode succ,
ParExeNode ref 
) const
inlineinherited
int otawa::ParExeGraph::numInstructions ( )
inline
int otawa::ParExeGraph::numResources ( )
inline

References _resources.

Referenced by delta(), and otawa::ParExeNode::ParExeNode().

otawa::GenGraph< ParExeNode , ParExeEdge >::operator bool ( void  ) const
inlineinherited
int otawa::GenGraph< ParExeNode , ParExeEdge >::outDegree ( ParExeNode vertex) const
inlineinherited
ParExePipeline * otawa::ParExeGraph::pipeline ( ParExeStage stage,
ParExeInst inst 
)
virtual
void otawa::ParExeGraph::propagate ( )
void otawa::GenGraph< ParExeNode , ParExeEdge >::remove ( GenNode *  node)
inlineinherited
void otawa::GenGraph< ParExeNode , ParExeEdge >::remove ( GenEdge *  edge)
inlineinherited
void otawa::GenGraph< ParExeNode , ParExeEdge >::removeAll ( const C< ParExeNode * > &  items)
inlineinherited
Resource* otawa::ParExeGraph::resource ( int  index)
inline

References _resources.

Referenced by clearDelays(), and propagate().

void otawa::ParExeGraph::restoreDefaultLatencies ( )
void otawa::ParExeGraph::setDefaultLatencies ( TimingContext tctxt)
void otawa::ParExeGraph::setLatencies ( TimingContext tctxt)
ParExeNode * otawa::GenGraph< ParExeNode , ParExeEdge >::sinkOf ( ParExeEdge edge) const
inlineinherited
ParExeNode * otawa::GenGraph< ParExeNode , ParExeEdge >::sourceOf ( ParExeEdge edge) const
inlineinherited

Friends And Related Function Documentation

friend class InstIterator
friend
friend class ParExeNode
friend

Referenced by createNodes().

Member Data Documentation

int otawa::ParExeGraph::_branch_penalty
private

Referenced by addEdgesForFetch().

int otawa::ParExeGraph::_cache_line_size
private

Referenced by addEdgesForFetch(), and ParExeGraph().

int otawa::ParExeGraph::_capacity
private
ParExeNode* otawa::ParExeGraph::_first_node
protected
ParExeNode* otawa::ParExeGraph::_last_node
protected

Referenced by analyze(), cost(), and createNodes().

ParExeNode* otawa::ParExeGraph::_last_prologue_node
protected
PropList otawa::ParExeGraph::_props
protected

Referenced by ParExeGraph().

WorkSpace* otawa::ParExeGraph::_ws
protected

Referenced by createSequenceResources().


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