OpenASIP  2.0
CriticalPathBBMoveNodeSelector.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file CriticalPathBBMoveNodeSelector.hh
26  *
27  * Declaration of CriticalPathBBMoveNodeSelector class.
28  *
29  * @author Pekka Jääskeläinen 2007 (pekka.jaaskelainen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_CRITICAL_PATH_BB_MOVE_NODE_SELECTOR_HH
34 #define TTA_CRITICAL_PATH_BB_MOVE_NODE_SELECTOR_HH
35 
36 #ifdef _GLIBCXX_DEBUG
37 /* If enabled, the priority list crashes with error
38  "elements in iterator range [__first, __last) do not form a heap
39  with respect to the predicate __comp" when calling readyList_.pop() in
40  CriticalPathBBMoveNodeSelector::candidates().
41 
42  It's probably caused by a situation in which a node's priority changes
43  during scheduling and the priority list does not notify the change before
44  pop() is called and it detects a malformed heap (a parent node larger than
45  a child node), or something.
46 
47  @todo This needs to be fixed at some point somehow as it might result in
48  weird errors in some machines or undeterministic schedule.
49 */
50 #undef _GLIBCXX_DEBUG
51 #endif
52 
53 #include "MoveNodeSelector.hh"
55 
57 
58 namespace TTAProgram {
59  class BasicBlock;
60 }
61 
62 namespace TTAMachine {
63  class Machine;
64 }
65 
66 /**
67  * Selects move nodes from a basic block and prioritizes move nodes on
68  * the critical path of the data dependence graph.
69  */
71 public:
79 
81 
82  virtual MoveNodeGroup candidates();
83  virtual void notifyScheduled(MoveNode& node);
84 
86 
87  void mightBeReady(MoveNode& node);
88 
89 private:
90  bool isReadyToBeScheduled(MoveNode& node) const;
91 
92  /// Initializes ready list from nodes that are ready.
93  void initializeReadylist();
94 
95  /// The data dependence graph built from the basic block.
97  /// The prioritized ready list.
99  // whether owns the DDG?
100  bool ddgOwned_;
101 };
102 
103 #endif
CriticalPathBBMoveNodeSelector
Definition: CriticalPathBBMoveNodeSelector.hh:70
CriticalPathBBMoveNodeSelector::ddg_
DataDependenceGraph * ddg_
The data dependence graph built from the basic block.
Definition: CriticalPathBBMoveNodeSelector.hh:96
TTAProgram
Definition: Estimator.hh:65
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
MoveNode
Definition: MoveNode.hh:65
ReadyMoveNodeGroupList
std::priority_queue< MoveNodeGroup, std::vector< MoveNodeGroup >, RLPriorityCriticalPath > ReadyMoveNodeGroupList
A prioritized list for the ready-to-be-scheduled move node groups.
Definition: ReadyMoveNodeGroupList.hh:151
CriticalPathBBMoveNodeSelector::mightBeReady
void mightBeReady(MoveNode &node)
Definition: CriticalPathBBMoveNodeSelector.cc:235
MoveNodeSelector.hh
CriticalPathBBMoveNodeSelector::dataDependenceGraph
virtual DataDependenceGraph & dataDependenceGraph()
Definition: CriticalPathBBMoveNodeSelector.cc:191
CriticalPathBBMoveNodeSelector::readyList_
ReadyMoveNodeGroupList readyList_
The prioritized ready list.
Definition: CriticalPathBBMoveNodeSelector.hh:98
CriticalPathBBMoveNodeSelector::initializeReadylist
void initializeReadylist()
Initializes ready list from nodes that are ready.
Definition: CriticalPathBBMoveNodeSelector.cc:50
CriticalPathBBMoveNodeSelector::CriticalPathBBMoveNodeSelector
CriticalPathBBMoveNodeSelector(TTAProgram::BasicBlock &bb, const TTAMachine::Machine &machine)
Definition: CriticalPathBBMoveNodeSelector.cc:96
CriticalPathBBMoveNodeSelector::candidates
virtual MoveNodeGroup candidates()
Definition: CriticalPathBBMoveNodeSelector.cc:148
MoveNodeSelector
Definition: MoveNodeSelector.hh:45
CriticalPathBBMoveNodeSelector::notifyScheduled
virtual void notifyScheduled(MoveNode &node)
Definition: CriticalPathBBMoveNodeSelector.cc:202
TTAProgram::BasicBlock
Definition: BasicBlock.hh:85
CriticalPathBBMoveNodeSelector::isReadyToBeScheduled
bool isReadyToBeScheduled(MoveNode &node) const
Definition: CriticalPathBBMoveNodeSelector.cc:324
CriticalPathBBMoveNodeSelector::ddgOwned_
bool ddgOwned_
Definition: CriticalPathBBMoveNodeSelector.hh:100
DataDependenceGraph
Definition: DataDependenceGraph.hh:67
ReadyMoveNodeGroupList.hh
MoveNodeGroup
Definition: MoveNodeGroup.hh:48
TTAMachine
Definition: Assembler.hh:48
TTAMachine::Machine
Definition: Machine.hh:73
CriticalPathBBMoveNodeSelector::~CriticalPathBBMoveNodeSelector
virtual ~CriticalPathBBMoveNodeSelector()
Definition: CriticalPathBBMoveNodeSelector.cc:136