OpenASIP 2.2
Loading...
Searching...
No Matches
DataDependenceEdge.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 DataDependenceEdge.hh
26 *
27 * Declaration of data dependence edge class
28 *
29 * @author Heikki Kultala 2006-2008 (heikki.kultala-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_DATA_DEPENDENCE_EDGE_HH
34#define TTA_DATA_DEPENDENCE_EDGE_HH
35
36#include "TCEString.hh"
37#include "GraphEdge.hh"
38
39class MoveNode;
40class ObjectState;
42
44public:
51
58
60 EdgeReason edgereason, DependenceType deptype,
62 bool guard = false, bool certainAlias = false,
63 bool tailPseudo = false, bool headPseudo = false,
64 int loop = 0);
65
67 EdgeReason edgereason, DependenceType deptype,
68 bool guard = false, bool certainAlias = false,
69 bool tailPseudo = false, bool headPseudo = false,
70 int loop = 0);
71
73 DataDependenceEdge(const DataDependenceEdge& other, bool invertLoop);
74
76 delete[] data_;
77 data_ = NULL;
78 }
79
80 TCEString toString() const;
81 TCEString toString(MoveNode& tail) const;
82
83 // For xml dumping
85 const MoveNode& tail,
86 const MoveNode& head);
87
89 return static_cast<DependenceType>(dependenceType_);
90 }
92 return static_cast<EdgeReason>(edgeReason_);
93 }
94
95 bool isFalseDep() const {
96 return edgeReason_ != EDGE_OPERATION &&
98 }
99
100 bool guardUse() const {
101 return edgeProperties_ & EPF_GUARD;
102 }
103 bool certainAlias() const {
105 }
106 /** returns whether the tail of the dependence does not directly
107 write/read the data but instead is a control flow move which may
108 cause it to be read/written */
109 bool tailPseudo() const {
111 }
112 /** returns whether the head of the dependence does not directly write/read
113 the data but instead is a control flow move which may cause it to be
114 read/written */
115 bool headPseudo() const {
117 }
118 bool isBackEdge() const {
119 return loopEdge_ != 0;
120 }
121 int loopDepth() const {
122 return loopEdge_;
123 }
124
125 bool isGPREdge() const {
126 return edgeReason() == EDGE_REGISTER;
127 }
128
129 bool isRegisterOrRA() const {
130 return edgeReason() == EDGE_REGISTER ||
131 edgeReason() == EDGE_RA;
132 }
133
134 bool isWAW() const {
135 return dependenceType_ == DEP_WAW;
136 }
137
138 bool isRAW() const {
139 return dependenceType_ == DEP_RAW;
140 }
141
142 const TCEString data() const {
143 if (data_ == NULL) {
144 return TCEString("");
145 } else {
146 return TCEString(data_);
147 }
148 }
149 bool operator ==(const DataDependenceEdge& other) const;
150
151 static void printStats(std::ostream& out);
152
153 // statistic counters for different types of edges created
155
156 void setData(const TCEString& newData);
157
158private:
159 TCEString depTypeSt() const;
160 TCEString edgeReasonSt() const;
161 TCEString guardSt() const;
162 TCEString pseudoSt() const;
163 TCEString latencySt(MoveNode& node) const;
164
165 // note: the size of this class must be highly optimized as there
166 // will be *lots* of edges in big basic blocks
167
168 // the flags stored in edgeProperties_
175
176 unsigned char dependenceType_; // DependenceType
177 unsigned char edgeReason_; // EdgeReason
178 unsigned char edgeProperties_;
179 unsigned char loopEdge_;
180 // register or mem alias info.
181 char* data_;
182};
183
184#endif
TCEString toString() const
TCEString edgeReasonSt() const
TCEString pseudoSt() const
unsigned char edgeProperties_
ObjectState * saveState(const MoveNode &tail, const MoveNode &head)
DependenceType dependenceType() const
TCEString latencySt(MoveNode &node) const
TCEString guardSt() const
unsigned char dependenceType_
bool operator==(const DataDependenceEdge &other) const
TCEString depTypeSt() const
static void printStats(std::ostream &out)
EdgeReason edgeReason() const
void setData(const TCEString &newData)
const TCEString data() const