OpenASIP  2.0
BUMoveNodeSelector.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2011 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 BUMoveNodeSelector.hh
26  *
27  * Declaration of BUMoveNodeSelector class.
28  *
29  * @author Vladim’r Guzma 2011(vladimir.guzma-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_BU_MOVE_NODE_SELECTOR_HH
34 #define TTA_BU_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 #include "DataDependenceGraph.hh"
56 
57 namespace TTAProgram {
58  class BasicBlock;
59 }
60 
61 namespace TTAMachine {
62  class Machine;
63 }
64 
65 /**
66  * Selects move nodes from a basic block and prioritizes move nodes on
67  * the critical path of the data dependence graph.
68  * This version prioritiezed for bottom up scheduling.
69  */
71 public:
79  virtual ~BUMoveNodeSelector();
80 
81  virtual MoveNodeGroup candidates();
82  virtual void notifyScheduled(MoveNode& node);
83  virtual void mightBeReady(MoveNode& node);
85 
86  /// Initializes ready list from nodes that are ready.
87  virtual void initializeReadylist();
88 
89  static void queueOperation(
90  ProgramOperation& po,
91  const DataDependenceGraph::NodeSet& nodes,
93 
94 private:
96 
98 
99  virtual bool isReadyToBeScheduled(MoveNodeGroup& nodes) const;
100  /// The data dependence graph built from the basic block.
102  /// The prioritized ready list.
104  // whether owns the DDG?
105  bool ddgOwned_;
106 };
107 
108 #endif
TTAProgram
Definition: Estimator.hh:65
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
BUMoveNodeSelector::dataDependenceGraph
virtual DataDependenceGraph & dataDependenceGraph()
Definition: BUMoveNodeSelector.cc:148
BoostGraph< MoveNode, DataDependenceEdge >::NodeSet
std::set< MoveNode *, typename MoveNode ::Comparator > NodeSet
Definition: BoostGraph.hh:86
BUMoveNodeSelector::candidates
virtual MoveNodeGroup candidates()
Definition: BUMoveNodeSelector.cc:157
DataDependenceGraph.hh
ProgramOperation
Definition: ProgramOperation.hh:70
MoveNode
Definition: MoveNode.hh:65
BUMoveNodeSelector::mightBeReady
virtual void mightBeReady(MoveNode &node)
Definition: BUMoveNodeSelector.cc:237
BUMoveNodeSelector
Definition: BUMoveNodeSelector.hh:70
MoveNodeSelector.hh
BUMoveNodeSelector::readyList_
ReadyMoveNodeGroupListBU readyList_
The prioritized ready list.
Definition: BUMoveNodeSelector.hh:103
BUMoveNodeSelector::ddg_
DataDependenceGraph * ddg_
The data dependence graph built from the basic block.
Definition: BUMoveNodeSelector.hh:101
ReadyMoveNodeGroupListBU
std::priority_queue< MoveNodeGroup, std::vector< MoveNodeGroup >, RLBUPriorityCriticalPath > ReadyMoveNodeGroupListBU
A prioritized list for the ready-to-be-scheduled move node groups.
Definition: ReadyMoveNodeGroupList.hh:156
MoveNodeSelector
Definition: MoveNodeSelector.hh:45
BUMoveNodeSelector::ddgOwned_
bool ddgOwned_
Definition: BUMoveNodeSelector.hh:105
TTAProgram::BasicBlock
Definition: BasicBlock.hh:85
BUMoveNodeSelector::queueOperation
static void queueOperation(ProgramOperation &po, const DataDependenceGraph::NodeSet &nodes, DataDependenceGraph::NodeSet &queue)
Definition: BUMoveNodeSelector.cc:315
BUMoveNodeSelector::notifyScheduled
virtual void notifyScheduled(MoveNode &node)
Definition: BUMoveNodeSelector.cc:209
DataDependenceGraph
Definition: DataDependenceGraph.hh:67
BUMoveNodeSelector::~BUMoveNodeSelector
virtual ~BUMoveNodeSelector()
Definition: BUMoveNodeSelector.cc:138
ReadyMoveNodeGroupList.hh
MoveNodeGroup
Definition: MoveNodeGroup.hh:48
TTAMachine
Definition: Assembler.hh:48
BUMoveNodeSelector::isReadyToBeScheduled
bool isReadyToBeScheduled(DataDependenceGraph::NodeSet &nodes) const
Definition: BUMoveNodeSelector.cc:349
BUMoveNodeSelector::initializeReadylist
virtual void initializeReadylist()
Initializes ready list from nodes that are ready.
Definition: BUMoveNodeSelector.cc:57
TTAMachine::Machine
Definition: Machine.hh:73
BUMoveNodeSelector::BUMoveNodeSelector
BUMoveNodeSelector(TTAProgram::BasicBlock &bb, const TTAMachine::Machine &machine)
Definition: BUMoveNodeSelector.cc:109