OpenASIP 2.2
Loading...
Searching...
No Matches
MoveNode.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 MoveNode.hh
26 *
27 * Declaration of MoveNode class.
28 *
29 * MoveNodes are the minimum independent unit of information in a
30 * minimally-ordered program representation. Typically, but not necessarily,
31 * the nodes in a program representation are linked together by dependences
32 * and thus form a graph.
33 *
34 * @author Vladimir Guzma 2006 (vladimir.guzma-no.spam-tut.fi)
35 * @author Ari Metsähalme 2006 (ari.metsahalme-no.spam-tut.fi)
36 * @author Pekka Jääskeläinen 2010, 2011
37 * @note rating: red
38 */
39
40#ifndef TTA_MOVE_NODE_HH
41#define TTA_MOVE_NODE_HH
42
43#include <vector>
44#include <string>
45#include <memory>
46#include "Exception.hh"
47#include "GraphNode.hh"
48
49// dummy classes until real implementations are written
50class Scope{} ;
51// Implementation in header file that includes this header file
53typedef std::shared_ptr<ProgramOperation> ProgramOperationPtr;
54
55namespace TTAProgram{
56 class Move;
57 class Immediate;
58}
59
60/**
61 * Node of the program representation.
62 *
63 * A MoveNode represents one move of a TTA program.
64 */
65class MoveNode : public GraphNode {
66public:
67
68 explicit MoveNode(std::shared_ptr<TTAProgram::Move> newMove);
69 explicit MoveNode(std::shared_ptr<TTAProgram::Immediate> imm);
70 virtual ~MoveNode();
71
72 MoveNode* copy();
73
74 bool isSourceOperation() const;
75 bool isGuardOperation() const;
76 inline bool isDestinationOperation() const;
77 inline unsigned int destinationOperationCount() const;
78
79 bool isOperationMove() const;
80
81 bool isSourceVariable() const;
82 bool isSourceConstant() const;
83 bool isSourceRA() const;
84 bool isSourceImmediateRegister() const;
85 bool isDestinationVariable() const;
86 bool isBypass() const;
87
88 bool isRegisterMove() const;
89 bool inSameOperation(const MoveNode& other) const;
90
91 bool isPlaced() const;
92 bool isAssigned() const;
93 bool isScheduled() const;
94 void setCycle(const int newcycle);
95 void unsetCycle();
96 int cycle() const;
97
98 int earliestResultReadCycle() const;
99 int latestTriggerWriteCycle() const;
100 int guardLatency() const;
101
102 Scope& scope();
105 ProgramOperation& destinationOperation(unsigned int index = 0) const;
108 ProgramOperationPtr destinationOperationPtr(unsigned int index = 0) const;
109
110 std::shared_ptr<TTAProgram::Move> movePtr();
111 std::shared_ptr<const TTAProgram::Move> movePtr() const;
112 std::shared_ptr<TTAProgram::Immediate> immediatePtr();
113 std::shared_ptr<const TTAProgram::Immediate> immediatePtr() const;
114
116 const TTAProgram::Move& move() const;
118 const TTAProgram::Immediate& immediate() const;
119
123
127 void unsetGuardOperation();
128
129 void finalize();
130 bool isFinalized() const;
131
132 void setIsInFrontier(bool inFrontier = true);
133 bool isInFrontier() const;
134 bool isLastUnscheduledMoveOfDstOp() const;
135
136 // to allow printing of graph
137 int type();
138 std::string toString() const;
139 std::string dotString() const;
140
141 // is move or entry node?
142 inline bool isMove() const;
143 inline bool isImmediate() const { return immediate_ != nullptr; }
144 bool isSourceReg(const std::string& reg) const;
145
146 /// Node can be entry node
147 MoveNode();
148private:
149 /// Copying forbidden. Use copy() for a deep copy.
151 /// Assignment forbidden
153
154 /// Pointer to Move this node represents, Node itself do not change move
155 const std::shared_ptr<TTAProgram::Move> move_;
156
157 /// Pointer to Immediate this node represents, Node itself do not change move
158 const std::shared_ptr<TTAProgram::Immediate> immediate_;
159
160 std::vector<ProgramOperationPtr> dstOps_;
161
163
165
166 /// Cycle in which the node is placed. Each cycle uniquely identifies an
167 /// instruction slot within the current scheduling scope.
169
170 /// True when the node placed (is given a cycle in program).
172
173 /// The movenode cannot be unscheduled anymore, fixed in place.
175
176 /// This is in scheduling frontier(used in Bubblefish scheduler)
178};
179
180#include "MoveNode.icc"
181
182#endif
std::shared_ptr< ProgramOperation > ProgramOperationPtr
Definition MoveNode.hh:53
std::string dotString() const
Definition MoveNode.cc:602
int type()
Definition MoveNode.cc:563
int earliestResultReadCycle() const
Definition MoveNode.cc:652
bool isOperationMove() const
Definition MoveNode.cc:253
void setGuardOperationPtr(ProgramOperationPtr po)
Definition MoveNode.cc:550
void setSourceOperationPtr(ProgramOperationPtr po)
Definition MoveNode.cc:541
ProgramOperationPtr sourceOperationPtr() const
Definition MoveNode.cc:458
bool isInFrontier_
This is in scheduling frontier(used in Bubblefish scheduler)
Definition MoveNode.hh:177
void finalize()
bool isSourceReg(const std::string &reg) const
Definition MoveNode.cc:798
unsigned int destinationOperationCount() const
bool isRegisterMove() const
Definition MoveNode.cc:294
bool isGuardOperation() const
Definition MoveNode.cc:181
int latestTriggerWriteCycle() const
Definition MoveNode.cc:698
std::shared_ptr< const TTAProgram::Immediate > immediatePtr() const
void unsetSourceOperation()
Definition MoveNode.cc:760
bool isImmediate() const
Definition MoveNode.hh:143
Scope & scope()
Definition MoveNode.cc:436
int cycle() const
Definition MoveNode.cc:421
bool finalized_
The movenode cannot be unscheduled anymore, fixed in place.
Definition MoveNode.hh:174
ProgramOperationPtr guardOperationPtr() const
Definition MoveNode.cc:484
void removeDestinationOperation(const ProgramOperation *po)
Definition MoveNode.cc:741
bool placed_
True when the node placed (is given a cycle in program).
Definition MoveNode.hh:171
bool isSourceVariable() const
Definition MoveNode.cc:196
ProgramOperationPtr srcOp_
Definition MoveNode.hh:162
std::shared_ptr< TTAProgram::Immediate > immediatePtr()
Definition MoveNode.cc:846
std::shared_ptr< const TTAProgram::Move > movePtr() const
bool isInFrontier() const
bool isMove() const
int cycle_
Cycle in which the node is placed. Each cycle uniquely identifies an instruction slot within the curr...
Definition MoveNode.hh:168
std::shared_ptr< TTAProgram::Move > movePtr()
int guardLatency() const
Definition MoveNode.cc:779
bool isBypass() const
Definition MoveNode.cc:280
const TTAProgram::Move & move() const
ProgramOperation & sourceOperation() const
Definition MoveNode.cc:453
bool isDestinationOperation() const
std::string toString() const
Definition MoveNode.cc:576
ProgramOperation & guardOperation() const
Definition MoveNode.cc:479
void unsetGuardOperation()
Definition MoveNode.cc:771
const std::shared_ptr< TTAProgram::Immediate > immediate_
Pointer to Immediate this node represents, Node itself do not change move.
Definition MoveNode.hh:158
bool isPlaced() const
Definition MoveNode.cc:352
void setIsInFrontier(bool inFrontier=true)
TTAProgram::Move & move()
ProgramOperationPtr guardOp_
Definition MoveNode.hh:164
bool isSourceOperation() const
Definition MoveNode.cc:168
MoveNode(const MoveNode &)
Copying forbidden. Use copy() for a deep copy.
void setCycle(const int newcycle)
Definition MoveNode.cc:503
bool isAssigned() const
Definition MoveNode.cc:367
bool isScheduled() const
Definition MoveNode.cc:409
virtual ~MoveNode()
Definition MoveNode.cc:110
bool isSourceRA() const
Definition MoveNode.cc:210
bool isSourceImmediateRegister() const
Definition MoveNode.cc:223
bool isSourceConstant() const
Definition MoveNode.cc:238
bool isLastUnscheduledMoveOfDstOp() const
Definition MoveNode.cc:817
bool isFinalized() const
void clearDestinationOperation()
Definition MoveNode.cc:730
MoveNode & operator=(const MoveNode &)
Assignment forbidden.
std::vector< ProgramOperationPtr > dstOps_
Definition MoveNode.hh:160
bool isDestinationVariable() const
Definition MoveNode.cc:264
void unsetCycle()
Definition MoveNode.cc:519
MoveNode * copy()
Definition MoveNode.cc:135
ProgramOperationPtr destinationOperationPtr(unsigned int index=0) const
bool inSameOperation(const MoveNode &other) const
Definition MoveNode.cc:306
const std::shared_ptr< TTAProgram::Move > move_
Pointer to Move this node represents, Node itself do not change move.
Definition MoveNode.hh:155
void addDestinationOperationPtr(ProgramOperationPtr po)
Definition MoveNode.cc:533
MoveNode()
Node can be entry node.
Definition MoveNode.cc:99
TTAProgram::Immediate & immediate()
Definition MoveNode.cc:838
ProgramOperation & destinationOperation(unsigned int index=0) const