OpenASIP  2.0
SequentialMoveNodeSelector.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2010 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 /**
26  * @file SequentialMoveNodeSelector.cc
27  *
28  * Implementation of SequentialModeNodeSelector class.
29  *
30  * @author Heikki Kultala 2008 (hkultala-no.spam-cs.tut.fi)
31  * @author Pekka Jääskeläinen 2010 (pjaaskel)
32  * @note rating: red
33  */
34 
36 #include "Instruction.hh"
37 #include "Move.hh"
38 #include "SpecialRegisterPort.hh"
39 #include "TerminalFUPort.hh"
40 #include "ProgramOperation.hh"
41 #include "FunctionUnit.hh"
42 #include "TCEString.hh"
43 #include "MoveNodeGroupBuilder.hh"
44 #include "MoveNode.hh"
45 
46 namespace TTAProgram {
47 }
48 
49 namespace TTAMachine {
50  class SpecialRegisterPort;
51 }
52 
53 /**
54  * Constructor.
55  *
56  * @param bb Basic block containing moves to be selected.
57  */
60  MoveNodeGroupBuilder builder;
61  mngs_ = builder.build(bb);
62  mngIter_ = mngs_->begin();
63 }
64 
66  while(!mngs_->empty()) {
67  std::list<MoveNodeGroup*>::iterator iter = mngs_->begin();
68  MoveNodeGroup* mng = *iter;
69  for (int i = 0; i < mng->nodeCount(); i++) {
70  delete &mng->node(i);
71  }
72  delete mng;
73  mngs_->erase(iter);
74  }
75  delete mngs_;
76 }
77 
78 /**
79  * Gives a group of unselected movenodes to schedules.
80  *
81  * This always returns them in order; and every one just once.
82  * Returns an empty MNG when there's no more MNGS to return.
83  */
86  // are there any unselected movenodegroups left?
87  if (mngIter_ != mngs_->end()) {
88  return **mngIter_++;
89  } else {
90  // return empty mng
91  return MoveNodeGroup();
92  }
93 }
94 
95 void
97 }
98 
99 void
101 }
102 
MoveNodeGroupBuilder.hh
TTAProgram
Definition: Estimator.hh:65
SequentialMoveNodeSelector::mngs_
MNGList * mngs_
Definition: SequentialMoveNodeSelector.hh:63
MoveNodeGroupBuilder
Definition: MoveNodeGroupBuilder.hh:52
MoveNodeGroup::node
MoveNode & node(int index) const
Definition: MoveNodeGroup.cc:152
SequentialMoveNodeSelector::candidates
virtual MoveNodeGroup candidates()
Definition: SequentialMoveNodeSelector.cc:85
MoveNode
Definition: MoveNode.hh:65
MoveNodeGroup::nodeCount
int nodeCount() const
Definition: MoveNodeGroup.cc:140
SequentialMoveNodeSelector::mightBeReady
void mightBeReady(MoveNode &node)
Definition: SequentialMoveNodeSelector.cc:96
SequentialMoveNodeSelector::mngIter_
MNGList::iterator mngIter_
Definition: SequentialMoveNodeSelector.hh:66
SequentialMoveNodeSelector::~SequentialMoveNodeSelector
virtual ~SequentialMoveNodeSelector()
Definition: SequentialMoveNodeSelector.cc:65
TCEString.hh
MoveNodeGroupBuilder::build
MoveNodeGroupList * build(TTAProgram::BasicBlock &bb)
Definition: MoveNodeGroupBuilder.cc:57
Instruction.hh
SequentialMoveNodeSelector::notifyScheduled
virtual void notifyScheduled(MoveNode &node)
Definition: SequentialMoveNodeSelector.cc:100
SequentialMoveNodeSelector::SequentialMoveNodeSelector
SequentialMoveNodeSelector(TTAProgram::BasicBlock &bb)
Definition: SequentialMoveNodeSelector.cc:58
TerminalFUPort.hh
ProgramOperation.hh
TTAProgram::BasicBlock
Definition: BasicBlock.hh:85
SpecialRegisterPort.hh
MoveNodeGroup
Definition: MoveNodeGroup.hh:48
Move.hh
TTAMachine
Definition: Assembler.hh:48
MoveNode.hh
SequentialMoveNodeSelector.hh
FunctionUnit.hh