Otawa  0.10
ParExeGraph.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * Interface to the ParExeInst, ParExeSequence, ParExeGraph, ParExeNode, ParExeEdge classes.
4  *
5  * This file is part of OTAWA
6  * Copyright (c) 2007, IRIT UPS.
7  *
8  * OTAWA is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * OTAWA is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with OTAWA; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef _PAR_EXEGRAPH_H_
24 #define _PAR_EXEGRAPH_H_
25 
26 #include <otawa/graph/GenGraph.h>
27 #include <elm/PreIterator.h>
28 #include <elm/string/StringBuffer.h>
32 #include <otawa/cfg/BasicBlock.h>
33 #include <otawa/hard/Platform.h>
36 #include <otawa/util/Dominance.h>
38 
39 namespace otawa {
40 
41  class ParExeNode;
42  class ParExeEdge;
43  class ParExeGraph;
44 
46  public:
47  inline ParExeException(string message): otawa::Exception(message) { }
48  };
49 
50  typedef enum code_part_t {
51  PROLOGUE, // in one of the basic block's predecessors
52  BLOCK, // in the basic block under analysis
53  EPILOGUE, // in one of the basic block's successors
54  CODE_PARTS_NUMBER // should be the last value
55  } code_part_t;
56 
57 
58  /*
59  * class ParExeInst
60  *
61  */
62 
63  class ParExeInst {
64  private:
65  Inst * _inst; // pointer to the instruction in the CFG structure
66  BasicBlock *_bb; // pointer to the basic block the instruction belongs to
67  code_part_t _part; // position of the instruction in a sequence: PROLOGUE, BLOCK under analysis, or EPILOGUE
68  int _index; // index of the instruction in the sequence
69  elm::genstruct::Vector<ParExeNode *> _nodes; // nodes in the execution graph that are related to this instruction
70  ParExeNode * _fetch_node; // fetch node related to this instruction
71  ParExeNode *_exec_node; // execution node related to this instruction
74  elm::genstruct::Vector<ParExeInst *> _producing_insts; // list of instructions this one depends on (some of its operands are produced by those instructions)
75 
76  public:
78  : _inst(inst), _bb(bb), _part(part), _index(index), _exec_node(NULL), _first_fu_node(NULL), _last_fu_node(NULL) {}
79 
80  // set/get information on the instruction
81  inline Inst * inst() {return _inst;}
82  inline code_part_t codePart() {return _part;}
83  inline int index() {return _index;}
84  inline void setIndex(int index) {_index=index;}
85  inline ParExeNode * firstNode() { return _nodes[0];}
86  inline ParExeNode *node(int index) { return _nodes[index];}
91  inline ParExeNode * fetchNode() { return _fetch_node;}
92  inline ParExeNode * execNode() { return _exec_node;}
93  inline ParExeNode * firstFUNode() { return _first_fu_node;}
94  inline ParExeNode * lastFUNode() { return _last_fu_node;}
95  inline void addProducingInst(ParExeInst *inst) { _producing_insts.add(inst);}
96  inline BasicBlock * basicBlock() {return _bb;}
97 
98  // add/remove nodes for this instruction
99  void addNode(ParExeNode * node);
100  inline void removeNode(ParExeNode *node) { _nodes.remove(node); }
101  inline void deleteNodes() {
102  if (_nodes.length() != 0) { _nodes.clear(); }
103  }
104 
105  // iterator on nodes related to the instruction
106  class NodeIterator: public elm::genstruct::Vector<ParExeNode *>::Iterator {
107  public:
108  inline NodeIterator(const ParExeInst *inst) : elm::genstruct::Vector<ParExeNode *>::Iterator(inst->_nodes) {}
109  };
110 
111  // iterator on nodes related to the instruction
112  class ProducingInstIterator: public elm::genstruct::Vector<ParExeInst *>::Iterator {
113  public:
114  inline ProducingInstIterator(const ParExeInst *inst) : elm::genstruct::Vector<ParExeInst *>::Iterator(inst->_producing_insts) {}
115  };
116 
117  };
118 
119  /*
120  * class ParExeSequence
121  *
122  */
123 
124  // a sequence (double-linked list) of ParExeInst
125  class ParExeSequence : public elm::genstruct::DLList<ParExeInst *> {
126  public:
127  // iterator in the instructions in the sequence
128  class InstIterator: public elm::genstruct::DLList<ParExeInst *>::Iterator {
129  public:
130  inline InstIterator(const ParExeSequence *seq) : elm::genstruct::DLList<ParExeInst *>::Iterator(*seq) {}
131  };
132  // number of instructions in the sequence
134  };
135 
136 
137  /*
138  * class NodeLatency
139  *
140  */
141  // a latency of a node
142  class NodeLatency { // used in ParExeGraph.h
143  private:
144  ParExeNode *_node; // pointer to the node
145  int _latency; // value of the latency
146  public:
147  NodeLatency(ParExeNode *node, int latency) : _node(node), _latency(latency) {}
148  inline ParExeNode *node(){ return _node; }
149  inline int latency(){return _latency; }
150  };
151 
152  // -- class TimingContext ----------------------------------------------------------------------------------------
153 
155  private:
159  public:
161  _header[0] = NULL;
162  _header[1] = NULL;
163  }
165  _header[0] = h0;
166  _header[1] = h1;
167  }
168 
169  class NodeLatencyIterator: public elm::genstruct::SLList<NodeLatency *>::Iterator {
170  public:
171  inline NodeLatencyIterator(const TimingContext& tctxt)
172  : elm::genstruct::SLList<NodeLatency *>::Iterator(tctxt._node_latencies_list) {}
173  };
174 
176  for (NodeLatencyIterator nl(*ctxt) ; nl ; nl++){
177  NodeLatency *new_nl = new NodeLatency(nl->node(), nl->latency());
178  _node_latencies_list.addLast(new_nl);
179  }
180  _header[0] = ctxt->_header[0];
181  _header[1] = ctxt->_header[1];
182  _type = ctxt->_type;
183  }
185  while (!_node_latencies_list.isEmpty()){
186  NodeLatency * nl = _node_latencies_list.first();
187  _node_latencies_list.removeFirst();
188  delete nl;
189  }
190  }
191  inline void addNodeLatency(NodeLatency *nl)
192  { _node_latencies_list.addLast(nl); }
193  inline bool isEmpty()
194  { return _node_latencies_list.isEmpty(); }
195  inline void setHeaders(BasicBlock *h0, BasicBlock *h1=NULL){
196  _header[0] = h0;
197  _header[1] = h1;
198  }
199  inline BasicBlock *header(int index)
200  { return _header[index]; }
202  { _type = type; }
204  { return _type; }
205 
206  };
207 
208 
209  /*
210  * class ParExeGraph
211  *
212  */
213 
214  class ParExeGraph: public GenGraph<ParExeNode, ParExeEdge> {
215  friend class InstIterator;
216  friend class ParExeNode;
217  protected:
221  typedef struct rename_table_t { // used in ParExeGraph.cpp
224  } rename_table_t;
225  elm::genstruct::Vector<Resource *> _resources; // resources used by the sequence of instructions
226 
227  ParExeNode *_first_node; // first node in the graph
228  ParExeNode *_last_prologue_node; // ====== REALLY USEFUL? (used in analyze())
229  ParExeNode *_last_node; // ====== REALLY USEFUL? (used in analyze())
230  private:
231  ParExeSequence * _sequence; // sequence of instructions related to the graph
232  int _cache_line_size; // ====== REALLY USEFUL?
233  int _capacity; // ====== REALLY USEFUL? (used in analyze())
234  int _branch_penalty; // ====== REALLY USEFUL?
235 
236 
237  public:
239  virtual ~ParExeGraph(void);
240 
241  // set/get information related to the graph
242  inline ParExeSequence *getSequence(void) const { return _sequence; }
243  inline ParExeNode * firstNode(){return _first_node;}
245  inline int numResources() {return _resources.length();}
246  inline Resource *resource(int index){return _resources[index];}
247  inline int numInstructions(){return _sequence->length();}
248 
249  // build the graph
250  virtual void build();
251  virtual void createNodes(void);
252  virtual void findDataDependencies(void);
253  virtual void addEdgesForPipelineOrder(void);
254  virtual void addEdgesForFetch(void);
255  virtual void addEdgesForProgramOrder(elm::genstruct::SLList<ParExeStage *> *list_of_stages = NULL);
256  virtual void addEdgesForMemoryOrder(void);
257  virtual void addEdgesForDataDependencies(void);
258  virtual void addEdgesForQueues(void);
259 
260  // compute execution time
261  void findContendingNodes();
263  int analyze();
264  void initDelays();
265  void clearDelays();
267  void setDefaultLatencies(TimingContext *tctxt);
268  void setLatencies(TimingContext *tctxt);
269  void propagate();
270  void analyzeContentions();
271  int cost();
272  int delta(ParExeNode *a, Resource *res);
273 
274  // tracing
275  void dump(elm::io::Output& dotFile, const string& info = "");
276  void display(elm::io::Output& output);
277 
278 
280  public:
281  inline InstIterator(const ParExeSequence *sequence)
282  : ParExeSequence::InstIterator(sequence) {}
283  inline InstIterator(const ParExeGraph *graph)
285  };
287  public:
289  : ParExeInst::NodeIterator(inst) {}
290  };
291  class StageIterator : public elm::genstruct::SLList<ParExeStage *>::Iterator {
292  public:
294  : elm::genstruct::SLList<ParExeStage *>::Iterator(*list) {}
295  };
296 
298  public:
299  inline StageNodeIterator(const ParExeStage *stage)
300  : ParExeStage::NodeIterator(stage) {}
301  };
302 
303  class PreorderIterator: public graph::PreorderIterator<ParExeGraph> {
304  public:
306  : graph::PreorderIterator<ParExeGraph>(*graph, graph->firstNode()) {}
307  };
308 
309  class Predecessor: public PreIterator<Predecessor, ParExeNode *> {
310  public:
311  inline Predecessor(const ParExeNode* node): iter(node) { }
312  inline bool ended(void) const;
313  inline ParExeNode *item(void) const;
314  inline void next(void);
315  inline ParExeEdge *edge(void) const;
316  private:
318  };
319 
320  class Successor: public PreIterator<Successor, ParExeNode *> {
321  public:
322  inline Successor(const ParExeNode* node): iter(node) {}
323  inline bool ended(void) const;
324  inline ParExeNode *item(void) const;
325  inline void next(void);
326  inline ParExeEdge *edge(void) const;
327  private:
329  };
330 
331 
332  };
333 
334  /*
335  * class ParExeNode
336  *
337  */
338  // a node in an execution graph (ParExeGraph)
339  class ParExeNode: public GenGraph<ParExeNode,ParExeEdge>::GenNode{
340  private:
341  ParExeStage *_pipeline_stage; // pipeline stage to which the node is related
342  ParExeInst *_inst; // instruction to which the node is related
343  int _latency; // latency of the node
344  int _default_latency; // default latency of the node
345  elm::String _name; // name of the node (for tracing)
346 // elm::genstruct::AllocatedTable<int> * _d; // delays wrt availabilities of resources
347 // elm::genstruct::AllocatedTable<bool> * _e; // dependence on availabilities of resources
348  elm::genstruct::AllocatedTable<int> * _delay; // dependence and delays wrt availabilities of resources
349  protected:
350  elm::genstruct::Vector<ParExeNode *> _producers; // nodes this one depends on (its predecessors)
352  elm::BitVector * _possible_contenders; // ==== STILL USEFUL?
354  int _late_contenders; // ==== STILL USEFUL?
355 
356  public:
358  : ParExeGraph::GenNode((otawa::graph::Graph *) graph),
359  _pipeline_stage(stage), _inst(inst), _latency(stage->latency()), _default_latency(stage->latency()){
360  int num = graph->numResources();
362  for (int k=0 ; k<graph->numInstructions() ; k++) {
363  StringBuffer _buffer;
364  _buffer << stage->name() << "(I" << inst->index() << ")";
365  _name = _buffer.toString();
366  }
367  if (!graph->firstNode())
368  graph->_first_node = this;
369  if (inst->codePart() == PROLOGUE)
370  graph->_last_prologue_node = this;
371  }
372 
373  inline ParExeStage *stage(void) { return _pipeline_stage; }
374  inline ParExeInst *inst(void) { return _inst; }
375  inline int latency() { return _latency; }
376  inline void setDefaultLatency(int lat) { _default_latency = lat; _latency = lat; }
378  inline void setLatency(int latency) { _latency = latency; }
379  inline void addProducer(ParExeNode *prod) { if (!_producers.contains(prod)) _producers.add(prod); }
380  inline int numProducers(void) { return _producers.length(); }
381  inline ParExeNode *producer(int index) { return _producers[index]; }
382  inline void addContender(ParExeNode *cont) { _contenders.add(cont); }
384  inline elm::String name(void) { return _name; }
385  inline int delay(int index) {return (*_delay)[index];}
386  inline void setDelay(int index, int value) { (*_delay)[index] = value; }
387  inline void initContenders(int size) {_possible_contenders = new BitVector(size); } // ==== STILL USEFUL?
388  inline int lateContenders(void) {return _late_contenders; } // ==== STILL USEFUL?
389  inline void setLateContenders(int num) { _late_contenders = num; } // ==== STILL USEFUL?
390  inline elm::BitVector * possibleContenders(void) { return _possible_contenders; } // ==== STILL USEFUL?
391  inline void setContender(int index) { _possible_contenders->set(index); } // ==== STILL USEFUL?
392  void buildContendersMasks(); // ==== STILL USEFUL?
393  };
394 
395  /*
396  * class ParExeEdge
397  *
398  */
399  // an edge in an execution graph (ParExeGraph)
400  class ParExeEdge: public GenGraph<ParExeNode,ParExeEdge>::GenEdge{
401  public:
402  typedef enum edge_type_t {SOLID = 1, SLASHED = 2} edge_type_t_t;
403  private:
404  edge_type_t _type; // type of the edge: SOLID or SLASHED
406  int _latency;
407  public:
408  inline ParExeEdge(ParExeNode *source, ParExeNode *target, edge_type_t type, int latency = 0, const string& name = "")
409  : ParExeGraph::GenEdge(source, target), _type(type), _name(name), _latency(latency) { ASSERT(source != target); }
410  inline int latency(void) const{return _latency;}
411  inline void setLatency(int latency) {_latency = latency;}
412  inline edge_type_t type(void) const {return _type;}
413  inline const elm::string& name(void) const {return _name;}
414  };
415 
416  inline bool ParExeGraph::Predecessor::ended(void) const {return iter.ended();}
417  inline ParExeNode *ParExeGraph::Predecessor::item(void) const {return iter->source();}
418  inline void ParExeGraph::Predecessor::next(void) {iter.next();}
419  inline ParExeEdge *ParExeGraph::Predecessor::edge(void) const {return iter;}
420 
421  inline bool ParExeGraph::Successor::ended(void) const { return iter.ended();}
422  inline ParExeNode *ParExeGraph::Successor::item(void) const {return iter->target();}
423  inline void ParExeGraph::Successor::next(void) {iter.next();}
424  inline ParExeEdge *ParExeGraph::Successor::edge(void) const {return iter;}
425 
426 
427 } // namespace otawa
428 
429 #endif //_PAR_EXEGRAPH_H_
A simple iterator on the nodes contained in a graph.
Definition: Graph.h:138
int analyze()
Computes the cost, in cycles, of the current graph.
Definition: parexegraph_ParExeGraph.cpp:96
struct otawa::ParExeGraph::rename_table_t rename_table_t
void setDefaultLatency(int lat)
Definition: ParExeGraph.h:376
ParExeEdge * edge(void) const
Definition: ParExeGraph.h:424
struct otawa::sem::inst inst
Definition: ParExeGraph.h:320
Definition: GenGraph.h:38
int numInstructions()
Definition: ParExeGraph.h:247
void clearDelays()
Definition: parexegraph_ParExeGraph.cpp:404
N * source(void) const
Definition: GenGraph.h:67
This class represents a bank of registers.
Definition: Register.h:68
Exception thrown if there is an error during the build and the computation of.
Definition: ParExeGraph.h:45
edge_type_t _type
Definition: ParExeGraph.h:404
elm::String _name
Definition: ParExeGraph.h:405
ParExeNode * producer(int index)
Definition: ParExeGraph.h:381
int _default_latency
Definition: ParExeGraph.h:344
void addProducer(ParExeNode *prod)
Definition: ParExeGraph.h:379
Representation of a pipeline stage to be used to build a ParExeGraph.
Definition: ParExeProc.h:86
GenEdge(GenNode *source, GenNode *target)
Definition: GenGraph.h:66
void setHeaders(BasicBlock *h0, BasicBlock *h1=NULL)
Definition: ParExeGraph.h:195
Definition: ParExeGraph.h:402
void setDelay(int index, int value)
Definition: ParExeGraph.h:386
PreorderIterator(ParExeGraph *graph)
Definition: ParExeGraph.h:305
Predecessor(const ParExeNode *node)
Definition: ParExeGraph.h:311
NodeIterator(const ParExeInst *inst)
Definition: ParExeGraph.h:108
void setFetchNode(ParExeNode *node)
Definition: ParExeGraph.h:87
virtual void addEdgesForPipelineOrder(void)
Adds edges that represent the order of stages in the pipeline.
Definition: parexegraph_ParExeGraph.cpp:641
elm::genstruct::Vector< ParExeNode * > _producers
Definition: ParExeGraph.h:350
Definition: ParExeGraph.h:221
void addNode(ParExeNode *node)
Relates a node to an instruction in the sequence.
Definition: parexegraph_ParExeGraph.cpp:587
ParExeNode * firstNode()
Definition: ParExeGraph.h:85
GenGraph< ParExeNode, ParExeEdge >::InIterator iter
Definition: ParExeGraph.h:317
int _late_contenders
Definition: ParExeGraph.h:354
void restoreDefaultLatency(void)
Definition: ParExeGraph.h:377
void setLatency(int latency)
Definition: ParExeGraph.h:411
NodeLatency(ParExeNode *node, int latency)
Definition: ParExeGraph.h:147
Definition: ParExeGraph.h:297
BasicBlock * _bb
Definition: ParExeGraph.h:66
elm::genstruct::AllocatedTable< ParExeNode * > * table
Definition: ParExeGraph.h:223
void propagate()
Definition: parexegraph_ParExeGraph.cpp:415
elm::genstruct::AllocatedTable< int > * _delay
Definition: ParExeGraph.h:348
void display(elm::io::Output &output)
Definition: parexegraph_ParExeGraph.cpp:1259
BasicBlock * _header[2]
Definition: ParExeGraph.h:157
elm::genstruct::Vector< ParExeInst * > _producing_insts
Definition: ParExeGraph.h:74
Definition: ParExeGraph.h:402
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 ...
Definition: parexegraph_ParExeGraph.cpp:153
static const PropList EMPTY
This is an empty proplist for convenience.
Definition: PropList.h:66
int lateContenders(void)
Definition: ParExeGraph.h:388
ParExeStage * stage(void)
Definition: ParExeGraph.h:373
void setLatencies(TimingContext *tctxt)
Definition: parexegraph_ParExeGraph.cpp:454
ParExeSequence * _sequence
Definition: ParExeGraph.h:231
Représentation of a processor (to be used to build a ParExeGraph).
Definition: ParExeProc.h:195
int _branch_penalty
Definition: ParExeGraph.h:234
BasicBlock * header(int index)
Definition: ParExeGraph.h:199
ParExeNode * firstNode()
Definition: ParExeGraph.h:243
elm::String name(void)
Definition: ParExeProc.h:115
int index()
Definition: ParExeGraph.h:83
ParExeNode * firstFUNode()
Definition: ParExeGraph.h:93
StageIterator(const SLList< ParExeStage * > *list)
Definition: ParExeGraph.h:293
Definition: ParExeGraph.h:128
Inst * _inst
Definition: ParExeGraph.h:65
void setFirstFUNode(ParExeNode *node)
Definition: ParExeGraph.h:89
void next(void)
Definition: ParExeGraph.h:418
int _index
Definition: ParExeGraph.h:68
Inst * inst()
Definition: ParExeGraph.h:81
elm::genstruct::Vector< Resource * > _resources
Definition: ParExeGraph.h:225
code_part_t
Definition: ParExeGraph.h:50
dtd::Element bb(dtd::make("bb", _BB).attr(id).attr(address).attr(size))
elm::genstruct::Vector< ParExeNode * > _nodes
Definition: ParExeGraph.h:69
ParExeNode * _exec_node
Definition: ParExeGraph.h:71
ParExeNode * _last_fu_node
Definition: ParExeGraph.h:73
Definition: Resource.h:35
ParExeNode * node(int index)
Definition: ParExeGraph.h:86
ParExeNode * lastFUNode()
Definition: ParExeGraph.h:94
ParExeEdge(ParExeNode *source, ParExeNode *target, edge_type_t type, int latency=0, const string &name="")
Definition: ParExeGraph.h:408
virtual void addEdgesForFetch(void)
Add edges for fetch timing, that is edges ensuring that instruction in the same block are fetched in ...
Definition: parexegraph_ParExeGraph.cpp:669
Definition: ParExeGraph.h:106
StringOption proc(command, 'p',"processor","used processor","path","")
An edge in a ParExeGraph.
Definition: ParExeGraph.h:400
uint32 size
elm::BitVector * possibleContenders(void)
Definition: ParExeGraph.h:390
Resource * resource(int index)
Definition: ParExeGraph.h:246
ProducingInstIterator(const ParExeInst *inst)
Definition: ParExeGraph.h:114
void dump(elm::io::Output &dotFile, const string &info="")
Definition: parexegraph_ParExeGraph.cpp:1025
ParExeEdge * edge(void) const
Definition: ParExeGraph.h:419
WorkSpace * _ws
Definition: ParExeGraph.h:218
GenNode(graph::Graph *graph=0)
Definition: GenGraph.h:47
void restoreDefaultLatencies()
Definition: parexegraph_ParExeGraph.cpp:438
elm::String name(void)
Definition: ParExeGraph.h:384
Base class of Otawa exceptions.
Definition: base.h:168
int numResources()
Definition: ParExeGraph.h:245
InstIterator(const ParExeSequence *sequence)
Definition: ParExeGraph.h:281
ParExeInst(Inst *inst, BasicBlock *bb, code_part_t part, int index)
Definition: ParExeGraph.h:77
Iterator(const DLList &_list)
InstIterator(const ParExeGraph *graph)
Definition: ParExeGraph.h:283
void analyzeContentions()
Definition: parexegraph_ParExeGraph.cpp:254
void initDelays()
Definition: parexegraph_ParExeGraph.cpp:332
inst cont(void)
Definition: inst.h:151
elm::genstruct::SLList< NodeLatency * > _node_latencies_list
Definition: ParExeGraph.h:156
virtual void build()
Definition: parexegraph_ParExeGraph.cpp:562
virtual ParExePipeline * pipeline(ParExeStage *stage, ParExeInst *inst)
Definition: parexegraph_ParExeGraph.cpp:577
Definition: ParExeGraph.h:291
Definition: ParExeGraph.h:303
virtual void addEdgesForProgramOrder(elm::genstruct::SLList< ParExeStage * > *list_of_stages=NULL)
Adds edges to reflect processing of instruction in the order of the program.
Definition: parexegraph_ParExeGraph.cpp:707
Definition: ParExeGraph.h:53
An iterator allowing to traverse the graph using preorder, that is, a node is only traversed when its...
Definition: PreorderIterator.h:31
A node of the ParExeGraph, that represents the crossing of an instruction inside a microprocessor sta...
Definition: ParExeGraph.h:339
CachePenalty::cache_penalty_type_t _type
Definition: ParExeGraph.h:158
Graph * graph(void) const
Get the container graph if any.
Definition: Graph.h:75
StageNodeIterator(const ParExeStage *stage)
Definition: ParExeGraph.h:299
int _latency
Definition: ParExeGraph.h:145
elm::genstruct::DLList< elm::BitVector * > * contendersMasksList()
Definition: ParExeGraph.h:383
elm::BitVector * _possible_contenders
Definition: ParExeGraph.h:352
int length()
Definition: ParExeGraph.h:133
Definition: ParExeGraph.h:169
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
Definition: ParExeGraph.h:279
ParExeNode * node()
Definition: ParExeGraph.h:148
ParExeNode * fetchNode()
Definition: ParExeGraph.h:91
void removeNode(ParExeNode *node)
Definition: ParExeGraph.h:100
code_part_t _part
Definition: ParExeGraph.h:67
int latency()
Definition: ParExeGraph.h:149
ParExeStage * _pipeline_stage
Definition: ParExeGraph.h:341
Definition: ParExeGraph.h:286
int _latency
Definition: ParExeGraph.h:406
edge_type_t
Definition: ParExeGraph.h:402
~TimingContext()
Definition: ParExeGraph.h:184
void setLatency(int latency)
Definition: ParExeGraph.h:378
ParExeSequence * getSequence(void) const
Definition: ParExeGraph.h:242
void setContender(int index)
Definition: ParExeGraph.h:391
ParExeNode * _first_node
Definition: ParExeGraph.h:227
hard::RegBank * reg_bank
Definition: ParExeGraph.h:222
void set(int index) const
void buildContendersMasks()
Definition: parexegraph_ParExeGraph.cpp:460
TimingContext(BasicBlock *h0, BasicBlock *h1=NULL)
Definition: ParExeGraph.h:164
TimingContext(TimingContext *ctxt)
Definition: ParExeGraph.h:175
int _cache_line_size
Definition: ParExeGraph.h:232
bool isEmpty()
Definition: ParExeGraph.h:193
int count(void) const
ParExeGraph(WorkSpace *ws, ParExeProc *proc, elm::genstruct::Vector< Resource * > *hw_resources, ParExeSequence *seq, const PropList &props=PropList::EMPTY)
Build a parametric execution graph.
Definition: parexegraph_ParExeGraph.cpp:1217
virtual void createNodes(void)
Creates nodes in the graph: one node for each (instruction/pipeline_stage) pair.
Definition: parexegraph_ParExeGraph.cpp:603
const elm::string & name(void) const
Definition: ParExeGraph.h:413
A sequence of ParExeInstruction for which a ParExeGraph will be built.
Definition: ParExeGraph.h:125
elm::genstruct::Vector< ParExeNode * > _contenders
Definition: ParExeGraph.h:351
Representation of a pipeline (list of stages).
Definition: ParExeProc.h:157
NodeIterator(const ParExeStage *stage)
Definition: ParExeProc.h:145
ParExeNode * _fetch_node
Definition: ParExeGraph.h:70
ParExeException(string message)
Definition: ParExeGraph.h:47
Definition: ParExeGraph.h:52
ParExeNode * execNode()
Definition: ParExeGraph.h:92
void setExecNode(ParExeNode *node)
Definition: ParExeGraph.h:88
bool ended(void) const
Definition: ParExeGraph.h:421
int cost()
Definition: parexegraph_ParExeGraph.cpp:119
Definition: ParExeGraph.h:142
ParExeNode * _last_node
Definition: ParExeGraph.h:229
void setLastFUNode(ParExeNode *node)
Definition: ParExeGraph.h:90
if(!(yy_init))
Definition: ipet_lexer.cc:734
Definition: ParExeGraph.h:309
Iterator for the graph nodes related to the pipeline stage.
Definition: ParExeProc.h:143
ParExeNode * item(void) const
Definition: ParExeGraph.h:422
int latency()
Definition: ParExeGraph.h:375
Representation of a parametric execution graph (Parametric Execution Graph).
Definition: ParExeGraph.h:214
InstNodeIterator(const ParExeInst *inst)
Definition: ParExeGraph.h:288
Definition: ParExeGraph.h:112
bool ended(void) const
Definition: ParExeGraph.h:416
void createSequenceResources()
Definition: parexegraph_ParExeGraph.cpp:494
void setDefaultLatencies(TimingContext *tctxt)
Definition: parexegraph_ParExeGraph.cpp:446
void addNodeLatency(NodeLatency *nl)
Definition: ParExeGraph.h:191
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
virtual void findDataDependencies(void)
Compute for each first FU node which is the FU node producing the required data (and fill the produce...
Definition: parexegraph_ParExeGraph.cpp:800
void initContenders(int size)
Definition: ParExeGraph.h:387
int numProducers(void)
Definition: ParExeGraph.h:380
int _capacity
Definition: ParExeGraph.h:233
enum otawa::ParExeEdge::edge_type_t edge_type_t_t
BasicBlock * basicBlock()
Definition: ParExeGraph.h:96
GenGraph< ParExeNode, ParExeEdge >::OutIterator iter
Definition: ParExeGraph.h:328
elm::genstruct::DLList< elm::BitVector * > _contenders_masks_list
Definition: ParExeGraph.h:353
This class represents assembly instruction of a piece of code.
Definition: Inst.h:62
ParExeInst * _inst
Definition: ParExeGraph.h:342
virtual ~ParExeGraph(void)
Definition: parexegraph_ParExeGraph.cpp:933
int index(void) const
Definition: GenGraph.h:51
code_part_t codePart()
Definition: ParExeGraph.h:82
elm::String _name
Definition: ParExeGraph.h:345
Instruction as presented in the ParExeGraph.
Definition: ParExeGraph.h:63
void setIndex(int index)
Definition: ParExeGraph.h:84
This a list of properties.
Definition: PropList.h:63
void next(void)
Definition: ParExeGraph.h:423
N * target(void) const
Definition: GenGraph.h:68
ParExeInst * inst(void)
Definition: ParExeGraph.h:374
cache_penalty_type_t
Definition: CachePenalty.h:33
TimingContext()
Definition: ParExeGraph.h:160
virtual String message(void)
ParExeNode * _last_prologue_node
Definition: ParExeGraph.h:228
virtual void addEdgesForMemoryOrder(void)
Adds edges to represent contention to access memory, basically, between FUs of instructions performin...
Definition: parexegraph_ParExeGraph.cpp:746
PropList _props
Definition: ParExeGraph.h:219
int latency(void) const
Definition: ParExeGraph.h:410
Definition: ParExeGraph.h:54
friend class Graph
Definition: Graph.h:41
void addProducingInst(ParExeInst *inst)
Definition: ParExeGraph.h:95
ParExeNode(ParExeGraph *graph, ParExeStage *stage, ParExeInst *inst)
Definition: ParExeGraph.h:357
void setType(CachePenalty::cache_penalty_type_t type)
Definition: ParExeGraph.h:201
void findContendingNodes()
Definition: parexegraph_ParExeGraph.cpp:907
Definition: ParExeGraph.h:51
virtual void addEdgesForDataDependencies(void)
Adds edges for data dependencies, that is, if an instruction (a) produces content of a register and i...
Definition: parexegraph_ParExeGraph.cpp:866
Successor(const ParExeNode *node)
Definition: ParExeGraph.h:322
void addContender(ParExeNode *cont)
Definition: ParExeGraph.h:382
Definition: ParExeGraph.h:154
void deleteNodes()
Definition: ParExeGraph.h:101
CachePenalty::cache_penalty_type_t type()
Definition: ParExeGraph.h:203
int delay(int index)
Definition: ParExeGraph.h:385
void setLateContenders(int num)
Definition: ParExeGraph.h:389
ParExeProc * _microprocessor
Definition: ParExeGraph.h:220
ParExeNode * item(void) const
Definition: ParExeGraph.h:417
ParExeNode * _first_fu_node
Definition: ParExeGraph.h:72
InstIterator(const ParExeSequence *seq)
Definition: ParExeGraph.h:130
ParExeNode * _node
Definition: ParExeGraph.h:144
String toString(void)
virtual void addEdgesForQueues(void)
Called to add edges representing contention on the different queues of the microprocessor.
Definition: parexegraph_ParExeGraph.cpp:888
edge_type_t type(void) const
Definition: ParExeGraph.h:412
NodeLatencyIterator(const TimingContext &tctxt)
Definition: ParExeGraph.h:171
int _latency
Definition: ParExeGraph.h:343