OpenASIP  2.0
SoftwareBypasser.cc
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 SoftwareBypasser.cc
26  *
27  * Definition of SoftwareBypasser interface.
28  *
29  * @author Pekka Jääskeläinen 2007 (pjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #include "SoftwareBypasser.hh"
34 
35 #include "MoveNodeGroup.hh"
36 #include "DataDependenceGraph.hh"
37 #include "ResourceManager.hh"
38 
39 /**
40  * Empty constructor.
41  */
42 SoftwareBypasser::SoftwareBypasser() : bypassCount_(0), deadResultCount_(0){
43 }
44 
45 /**
46  * Empty destructor.
47  */
49 }
50 
51 /**
52  * Apply software bypassing to as many moves in the given MoveNodeGroup
53  * as possible.
54  *
55  * The given DDG can be used to inspect whether software bypassing is possible.
56  *
57  * @param candidates The moves to which apply software bypassing, if possible.
58  * @param ddg The data dependence grap in which the movenodes belong to.
59  * @param rm The resource manager which is used to check for resource
60  * availability.
61  * @param bypassTrigger whether to bypass the trigger or not.
62  * @return The count of bypassed moves.
63  */
64 int
66  MoveNodeGroup& candidates,
68  ResourceManager& rm,
69  bool /*bypassTrigger*/) {
70 
71  // use the arguments just to avoid compiler warnings with strict flags
72  candidates.nodeCount();
73  ddg.nodeCount();
74  rm.machine();
75  return 0;
76 }
77 
78 /**
79  * Remove software bypassing from as many moves in the given MoveNodeGroup
80  * as possible.
81  *
82  * @param candidates The moves from which to remove software bypassing, if
83  * possible.
84  * @param ddg The data dependence grap in which the movenodes belong to.
85  * @param rm The resource manager which is used to check for resource
86  * availability.
87  */
88 void
90  MoveNodeGroup& candidates,
92  ResourceManager& rm) {
93 
94  // use the arguments just to avoid compiler warnings with strict flags
95  candidates.nodeCount();
96  ddg.nodeCount();
97  rm.machine();
98  return;
99 }
100 
101 /**
102  * Remove dead result moves for each bypassed move of given MoveNodeGroup
103  * if possible. That is, no other result reads of result exists.
104  * This assumes that result moves in MoveNodeGroup are also scheduled.
105  *
106  * @param candidates The moves for which remove dead result writes
107  * @param ddg The data dependence grap in which the movenodes belong to.
108  * @param rm The resource manager which is used to check for resource
109  * availability.
110  * @param removedMoves The dead result eliminated moves and their original
111  * cycles, to allow rescheduling of moves that were previously
112  * resource (RF write port usually) constrained by the removed moves.
113  * @return number of dead results killed
114  */
115 int
117  MoveNodeGroup& candidates,
118  DataDependenceGraph& ddg,
119  ResourceManager& rm,
120  std::set<std::pair<TTAProgram::Move*, int> >& removedMoves) {
121 
122  // use the arguments just to avoid compiler warnings with strict flags
123  candidates.nodeCount();
124  ddg.nodeCount();
125  rm.machine();
126  removedMoves.begin();
127  return 0;
128 }
129 
130 /*
131  * Registers the selector being used to the bypasser.
132  *
133  * If the bypasser has been registered to the selector,
134  * bypasses can notify the selector about dependence changes
135  * (like WAR/WAW edge removal duo bypassing)
136  *
137  * Default implementation is empty, only actual bypasser implementations
138  * implement this.
139  *
140  * @param selector selector which bypasser notifies on some dependence changes.
141  */
142 void
144 }
SoftwareBypasser::setSelector
virtual void setSelector(MoveNodeSelector *selector)
Definition: SoftwareBypasser.cc:143
MoveNodeGroup.hh
DataDependenceGraph.hh
MoveNodeGroup::nodeCount
int nodeCount() const
Definition: MoveNodeGroup.cc:140
SoftwareBypasser::removeBypass
virtual void removeBypass(MoveNodeGroup &candidates, DataDependenceGraph &ddg, ResourceManager &rm)=0
Definition: SoftwareBypasser.cc:89
ResourceManager
Definition: ResourceManager.hh:53
SoftwareBypasser::bypass
virtual int bypass(MoveNodeGroup &candidates, DataDependenceGraph &ddg, ResourceManager &rm, bool bypassTrigger)=0
Definition: SoftwareBypasser.cc:65
MoveNodeSelector
Definition: MoveNodeSelector.hh:45
SoftwareBypasser::removeDeadResults
virtual int removeDeadResults(MoveNodeGroup &candidates, DataDependenceGraph &ddg, ResourceManager &rm, std::set< std::pair< TTAProgram::Move *, int > > &removedMoves)=0
Definition: SoftwareBypasser.cc:116
SoftwareBypasser::~SoftwareBypasser
virtual ~SoftwareBypasser()
Definition: SoftwareBypasser.cc:48
ResourceManager::machine
const TTAMachine::Machine & machine() const
Definition: ResourceManager.cc:56
DataDependenceGraph
Definition: DataDependenceGraph.hh:67
MoveNodeGroup
Definition: MoveNodeGroup.hh:48
BoostGraph::nodeCount
int nodeCount() const
SoftwareBypasser.hh
ResourceManager.hh
SoftwareBypasser::SoftwareBypasser
SoftwareBypasser()
Definition: SoftwareBypasser.cc:42