OpenASIP  2.0
BF2ScheduleFront.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2014 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 BF2ScheduleFront.hh
27  *
28  * Declaration of BF2ScheduleFront class
29  *
30  * Tries to schedule a group of moves.
31  *
32  * @author Heikki Kultala 2014-2020(heikki.kultala-no.spam-tuni.fi)
33  * @note rating: red
34  */
35 
36 #ifndef BF2_SCHEDULE_FRONT_HH
37 #define BF2_SCHEDULE_FRONT_HH
38 
39 #include "BFOptimization.hh"
40 #include "DataDependenceGraph.hh"
41 #include "BF2Scheduler.hh"
42 
43 class MoveNode;
44 class TCEString;
45 
46 namespace TTAMachine {
47  class Port;
48 }
49 
51 public:
52 
54  BF2Scheduler& sched, MoveNode& mn, int lc) :
55  BFOptimization(sched), mn_(mn), lc_(lc) {}
56 
57  virtual bool operator()() override;
58 
59  void undoOnlyMe() override;
60 
62 
63  void bypassed(MoveNode& src, MoveNode& dst) {
64  bypassSources_[&dst] = &src;
65  }
66 
67  void undidBypass(MoveNode&, MoveNode& dst) {
68  bypassSources_.erase(&dst);
69  }
70 
73 
74  static int prefResultCycle(const MoveNode& mn);
75 
76  void mightBeReady(MoveNode& n) override;
77 
78  void deletingNode(MoveNode* deletedNode) {
79  nodesToNotify_.erase(deletedNode);
80  }
81 
84 
85 protected:
86 
89 
90  int scheduleMove(
91  MoveNode& move,
93  bool allowEarlyBypass = true,
94  bool allowLateBypass = true,
95  bool allowEarlySharing = true);
96 
98 
100 
101  bool tryToScheduleMoveOuter(MoveNode& mn, int& latestCycle);
102 
104 
106 
107  void printFront(const TCEString& prefix);
108 
109 
110  void clearSchedulingFront();
111 
113 
114 private:
115 
117 
119 
121  ProgramOperation& po,
122  const DataDependenceGraph::NodeSet& processedNodes,
124 
126 
128 
130  int lc_;
131 
132  typedef std::map<MoveNode*, int, MoveNode::Comparator> PathLengthCache;
134 };
135 
136 #endif
BF2ScheduleFront::bypassSources_
MoveNodeMap bypassSources_
Definition: BF2ScheduleFront.hh:118
BF2ScheduleFront::scheduleFrontFromMove
bool scheduleFrontFromMove(MoveNode &mn)
Definition: BF2ScheduleFront.cc:81
BF2ScheduleFront::PathLengthCache
std::map< MoveNode *, int, MoveNode::Comparator > PathLengthCache
Definition: BF2ScheduleFront.hh:132
BF2ScheduleFront::MoveNodeMap
BF2Scheduler::MoveNodeMap MoveNodeMap
Definition: BF2ScheduleFront.hh:82
BF2ScheduleFront::illegalBypassSources_
DataDependenceGraph::NodeSet illegalBypassSources_
Definition: BF2ScheduleFront.hh:71
BF2ScheduleFront::lc_
int lc_
Definition: BF2ScheduleFront.hh:130
BoostGraph< MoveNode, DataDependenceEdge >::NodeSet
std::set< MoveNode *, typename MoveNode ::Comparator > NodeSet
Definition: BoostGraph.hh:86
BF2ScheduleFront::getPreferredLimits
BF2Scheduler::SchedulingLimits getPreferredLimits(const MoveNode &mn)
Definition: BF2ScheduleFront.cc:441
BF2ScheduleFront::undidBypass
void undidBypass(MoveNode &, MoveNode &dst)
Definition: BF2ScheduleFront.hh:67
DataDependenceGraph.hh
ProgramOperation
Definition: ProgramOperation.hh:70
MoveNode
Definition: MoveNode.hh:65
BF2Scheduler::MoveNodeMap
std::map< MoveNode *, MoveNode *, MoveNode::Comparator > MoveNodeMap
Definition: BF2Scheduler.hh:177
BFOptimization
Definition: BFOptimization.hh:73
BF2ScheduleFront::undoOnlyMe
void undoOnlyMe() override
Definition: BF2ScheduleFront.cc:582
BF2ScheduleFront::schedulingFront_
DataDependenceGraph::NodeSet schedulingFront_
Definition: BF2ScheduleFront.hh:125
BF2ScheduleFront::appendBypassSources
void appendBypassSources(MoveNodeMap &map)
Definition: BF2ScheduleFront.cc:705
BF2ScheduleFront::pathLengthCache_
PathLengthCache pathLengthCache_
Definition: BF2ScheduleFront.hh:133
BF2ScheduleFront::latestScheduledOfFrontCycle
int latestScheduledOfFrontCycle()
Definition: BF2ScheduleFront.cc:327
BF2Scheduler.hh
BF2ScheduleFront::requeueOtherMovesOfSameOp
void requeueOtherMovesOfSameOp(MoveNode &mn)
Definition: BF2ScheduleFront.cc:502
BF2ScheduleFront::bypassed
void bypassed(MoveNode &src, MoveNode &dst)
Definition: BF2ScheduleFront.hh:63
BF2ScheduleFront::mightBeReady
void mightBeReady(MoveNode &n) override
Definition: BF2ScheduleFront.cc:701
BF2ScheduleFront::tryRevertEarlierBypass
bool tryRevertEarlierBypass(MoveNode &mn)
Definition: BF2ScheduleFront.cc:671
BF2ScheduleFront::scheduleMove
int scheduleMove(MoveNode &move, BF2Scheduler::SchedulingLimits limits, bool allowEarlyBypass=true, bool allowLateBypass=true, bool allowEarlySharing=true)
Definition: BF2ScheduleFront.cc:468
BF2ScheduleFront::nodesToNotify_
DataDependenceGraph::NodeSet nodesToNotify_
Definition: BF2ScheduleFront.hh:127
BF2Scheduler
Definition: BF2Scheduler.hh:74
BF2ScheduleFront::operator()
virtual bool operator()() override
Definition: BF2ScheduleFront.cc:61
BF2ScheduleFront::findInducingBypassSource
MoveNode * findInducingBypassSource(MoveNode &mn)
Definition: BF2ScheduleFront.cc:603
BF2ScheduleFront::deletingNode
void deletingNode(MoveNode *deletedNode)
Definition: BF2ScheduleFront.hh:78
BF2ScheduleFront::tryToScheduleMoveOuter
bool tryToScheduleMoveOuter(MoveNode &mn, int &latestCycle)
Definition: BF2ScheduleFront.cc:170
BF2ScheduleFront::prefResultCycle
static int prefResultCycle(const MoveNode &mn)
Definition: BF2ScheduleFront.cc:406
BF2ScheduleFront::findInducingBypassSourceFromOperation
MoveNode * findInducingBypassSourceFromOperation(ProgramOperation &po, const DataDependenceGraph::NodeSet &processedNodes, DataDependenceGraph::NodeSet &queue)
Definition: BF2ScheduleFront.cc:642
BF2Scheduler::SchedulingLimits
Definition: BF2Scheduler.hh:166
BF2ScheduleFront::BF2ScheduleFront
BF2ScheduleFront(BF2Scheduler &sched, MoveNode &mn, int lc)
Definition: BF2ScheduleFront.hh:53
BF2ScheduleFront::allNodesOfSameOperation
DataDependenceGraph::NodeSet allNodesOfSameOperation(MoveNode &mn)
Definition: BF2ScheduleFront.cc:514
BF2ScheduleFront::printFront
void printFront(const TCEString &prefix)
Definition: BF2ScheduleFront.cc:572
BF2ScheduleFront::illegalOperandShares_
DataDependenceGraph::NodeSet illegalOperandShares_
Definition: BF2ScheduleFront.hh:72
TCEString
Definition: TCEString.hh:53
TTAMachine
Definition: Assembler.hh:48
BF2ScheduleFront::clearSchedulingFront
void clearSchedulingFront()
Definition: BF2ScheduleFront.cc:595
BF2ScheduleFront::getMoveNodeFromFrontBU
MoveNode * getMoveNodeFromFrontBU()
Definition: BF2ScheduleFront.cc:339
BF2ScheduleFront
Definition: BF2ScheduleFront.hh:50
BFOptimization.hh
BF2ScheduleFront::mn_
MoveNode & mn_
Definition: BF2ScheduleFront.hh:129