OpenASIP 2.2
Loading...
Searching...
No Matches
ProgramDependenceNode.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 ProgramDependenceNode.hh
26 *
27 * Declaration of prototype of graph-based program representation:
28 * declaration of the program dependence node.
29 *
30 * @author Vladimir Guzma 2006 (vladimir.guzma-no.spam-tut.fi)
31 * @note rating: red
32 */
33#ifndef TTA_PROGRAM_DEPENDENCE_NODE_HH
34#define TTA_PROGRAM_DEPENDENCE_NODE_HH
35
37
38class MoveNode;
39class BasicBlockNode;
40
41/**
42*/
44public:
45 enum NodeType {
46 PDG_NODE_REGION, // Region nodes of PDG
47 PDG_NODE_PREDICATE, // Predicate nodes of PDG
48 PDG_NODE_MOVE, // Single statements nodes
49 PDG_NODE_LOOPENTRY, // Region that is loop entry node
50 PDG_NODE_LOOPCLOSE // Region that is loop entry node
51 };
52
58 MoveNode& mNode,
59 NodeType type = PDG_NODE_MOVE);
60 virtual ~ProgramDependenceNode();
61
62 // Stores information about region and eec
63 // Duplicates NodeSet which is available only in Graph :(
64 typedef std::set<ProgramDependenceNode*> NodesInfo;
65 bool isRegionNode() const { return type_ == PDG_NODE_REGION;}
66 bool isPredicateMoveNode() const { return type_ == PDG_NODE_PREDICATE;}
67 bool isMoveNode() const { return type_ == PDG_NODE_MOVE;}
68 bool isLoopEntryNode() const { return type_ == PDG_NODE_LOOPENTRY;}
69 bool isLoopEntryNode(int component) const {
71 bool isLoopCloseNode() const { return type_ == PDG_NODE_LOOPCLOSE;}
72 bool isLastNode() const { return lastNode_;}
75 void setLastNode() { lastNode_ = true; }
76 int component() const { return component_;}
77
79 const MoveNode& moveNode() const;
81 const ControlDependenceNode& cdgNode() const;
82 std::string dotString() const;
83 std::string toString() const;
84 const NodesInfo& region();
85 const NodesInfo& eec();
86 void printRelations() const;
88 void setNewFirstBB(BasicBlockNode* newBB) { newFirstBB_ = newBB;}
89 std::vector<BasicBlockNode*> leafBlocks() { return leafBlocks_;}
91 leafBlocks_.push_back(newLeaf); }
92 void addLeafBlocks(std::vector<BasicBlockNode*> newLeafs) {
93 leafBlocks_.insert(leafBlocks_.end(), newLeafs.begin(), newLeafs.end());
94 }
95
96protected:
101private:
105 /// Stores "region" information for computing serialization information
107 /// Stores "eec" information for computing serialization information
109 /// Number of strong component the node belongs to.
110 /// Node can be part of several strong components so this value
111 /// have practical meaning only for loop close nodes - close just one
112 /// loop, and loop entry nodes - marks a component in which node is
113 /// loop entry. Still can be regular region of larger loop
114 /// Full list of nodes that belongs to actual components is available
115 /// in strongComponents_ vector in PDG
117 /// First basic block of a subgraph of a region
119 /// Vector of basic blocks of a subgraph that do not have outgoing
120 /// edged and will need to get connected
121 std::vector<BasicBlockNode*> leafBlocks_;
122 /// Indicates that node must be scheduled last between it's siblings
123 /// because it's subgraph contains close node and it's parent is entry
125};
126
127#endif
void setNewFirstBB(BasicBlockNode *newBB)
bool lastNode_
Indicates that node must be scheduled last between it's siblings because it's subgraph contains close...
void addLeafBlock(BasicBlockNode *newLeaf)
void addToEEC(ProgramDependenceNode &node)
void setComponent(int component)
BasicBlockNode * newFirstBB_
First basic block of a subgraph of a region.
std::vector< BasicBlockNode * > leafBlocks_
Vector of basic blocks of a subgraph that do not have outgoing edged and will need to get connected.
std::string dotString() const
BasicBlockNode * newFirstBB()
bool isLoopEntryNode(int component) const
int component_
Number of strong component the node belongs to. Node can be part of several strong components so this...
void addToRegion(ProgramDependenceNode &node)
void addLeafBlocks(std::vector< BasicBlockNode * > newLeafs)
std::vector< BasicBlockNode * > leafBlocks()
std::set< ProgramDependenceNode * > NodesInfo
NodesInfo eec_
Stores "eec" information for computing serialization information.
void setLoopEntryNode(int component)
ControlDependenceNode & cdgNode()
std::string toString() const
NodesInfo region_
Stores "region" information for computing serialization information.
ControlDependenceNode * cdgNode_