OpenASIP 2.2
Loading...
Searching...
No Matches
CycleLookBackSoftwareBypasser.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 CycleLookBackSoftwareBypasser.hh
26 *
27 * Declaration of CycleLookBackSoftwareBypasser interface.
28 *
29 * @author Pekka Jääskeläinen 2007 (pjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_CYCLE_LOOK_BACK_SOFTWARE_BYPASSER_HH
34#define TTA_CYCLE_LOOK_BACK_SOFTWARE_BYPASSER_HH
35
36#include <map>
37#include <set>
38
39#include "SoftwareBypasser.hh"
41
42namespace TTAMachine {
43 class Bus;
44}
46class MoveNode;
47/**
48 * A simple implementation of software bypassing that reschedules operand
49 * writes as bypassed moves in case the result has been produced in n
50 * previous cycles.
51 */
53public:
56
57 virtual int bypass(
58 MoveNodeGroup& candidates,
60 ResourceManager& rm, bool bypassTrigger);
61
62 virtual void removeBypass(
63 MoveNodeGroup& candidates,
65 ResourceManager& rm);
66
67 virtual void removeBypass(
68 MoveNode& moveNode,
70 ResourceManager& rm, bool restoreSource=true);
71
72 virtual int removeDeadResults(
73 MoveNodeGroup& candidates,
76 std::set<std::pair<TTAProgram::Move*, int> >& removedMoves);
77
78 void setSelector(MoveNodeSelector* selector);
79
80 virtual void clearCaches(DataDependenceGraph& ddg, bool removeDeadResults);
81
82 static void printStats();
83private:
84 /// count of cycles before the operand write to look for the producer
85 /// of the read value
87
88 /// count of cycles before the operand write to look for the producer
89 /// of the read value when cannot kill result
91
92 // whether dead results should be killed.
94
95 // whether to bypass from register-to-register moves
97
98 // whether to bypass to register-to-register moves
100
101 int bypassNode(
102 MoveNode& nodeToBypass,
103 int& lastOperandCycle,
105 ResourceManager& rm);
106
107 /// Stores sources and bypassed moves in case they
108 /// have to be unassigned (case when operands are scheduled
109 /// and bypassed but result can not be scheduled with such operands
110 // First is bypassed node, second is original source
111 std::map<MoveNode*, MoveNode*, MoveNode::Comparator> storedSources_;
112
113 // cycles and buses of source nodes so that they can be reassigned.
114 std::map<MoveNode*, int> sourceCycles_;
115 std::map<MoveNode*, const TTAMachine::Bus*> sourceBuses_;
116
117 std::map<MoveNode*, MoveNode*, MoveNode::Comparator> removedStoredSources_;
118
119 // these are alreayd removed from the dubgraph. remove also from the
120 // big ddg.
122
124
125 static int bypassCount_;
128};
129
130#endif
int cyclesToLookBack_
count of cycles before the operand write to look for the producer of the read value
int bypassNode(MoveNode &nodeToBypass, int &lastOperandCycle, DataDependenceGraph &ddg, ResourceManager &rm)
virtual void clearCaches(DataDependenceGraph &ddg, bool removeDeadResults)
std::map< MoveNode *, const TTAMachine::Bus * > sourceBuses_
virtual void removeBypass(MoveNodeGroup &candidates, DataDependenceGraph &ddg, ResourceManager &rm)
virtual int removeDeadResults(MoveNodeGroup &candidates, DataDependenceGraph &ddg, ResourceManager &rm, std::set< std::pair< TTAProgram::Move *, int > > &removedMoves)
int cyclesToLookBackNoDRE_
count of cycles before the operand write to look for the producer of the read value when cannot kill ...
std::map< MoveNode *, MoveNode *, MoveNode::Comparator > removedStoredSources_
void setSelector(MoveNodeSelector *selector)
virtual int bypass(MoveNodeGroup &candidates, DataDependenceGraph &ddg, ResourceManager &rm, bool bypassTrigger)
std::map< MoveNode *, MoveNode *, MoveNode::Comparator > storedSources_
Stores sources and bypassed moves in case they have to be unassigned (case when operands are schedule...
std::set< GraphNode *, typename GraphNode::Comparator > NodeSet
Definition Graph.hh:53