OpenASIP 2.2
Loading...
Searching...
No Matches
ControlDependenceNode.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 ControlDependenceNode.hh
26 *
27 * Prototype control dependence graph of TTA program representation:
28 * declaration of graph node (basic block or region node).
29 *
30 * @author Vladimir Guzma 2006 (vladimir.guzma-no.spam-tut.fi)
31 * @note rating: red
32 */
33
34#ifndef TTA_CONTROL_DEPENDENCE_NODE_HH
35#define TTA_CONTROL_DEPENDENCE_NODE_HH
36
37#include <string>
38#include <set>
39
40#include "TCEString.hh"
41#include "GraphNode.hh"
42#include "CodeSnippet.hh"
43#include "BasicBlockNode.hh"
44
45namespace TTAProgram {
46class Instruction;
47class CodeSnippet;
48}
49/**
50 * Node of the control dependence graph. Each node represents one basic block
51 * or region node.
52 *
53 * A basic block is defined as an ordered sequence of adjacent instructions
54 * in which only the first can be target of jump and ony the last one (save
55 * jump delay slots) can contain jumps.
56 *
57 * @note Instructions that contain function calls are control flow bariers
58 * also. For now they split basic blocks into two, with special type of edge
59 * connecting them.
60 */
62public:
63 enum NodeType {
64 CDEP_NODE_REGION, // Region nodes of CDG
65 CDEP_NODE_PREDICATE, // Predicate nodes of CDG
66 CDEP_NODE_BB, // Basic block nodes containing code snippets
67 CDEP_NODE_LOOPENTRY, // Region that is loop entry node
68 CDEP_NODE_LOOPCLOSE // Region that is loop entry node
69 };
70 /// Storage type for other nodes of same graph needed to define
71 /// some non graph relations.
72 /// Duplicit type compared to NodeSet, but that is defined in Graph class
73 typedef std::set<ControlDependenceNode*> NodesInfo;
76 BasicBlockNode* bblock = NULL) :
77 type_(type), code_(bblock), component_(-1), lastNode_(false) {}
78 virtual ~ControlDependenceNode();
79
80 bool isControlDependenceNode() const;
81 bool isRegionNode() const;
82 bool isPredicateNode() const;
83 bool isBBNode() const;
84 bool isEntryNode() const;
85 bool isExitNode() const;
86 bool isLoopEntryNode() const;
87 bool isLoopEntryNode(int component) const;
88 bool isLoopCloseNode() const;
91 int component() const { return component_;}
92 /// LastNode marks node that must be ordered last compared to it's
93 /// sibling nodes - Close node of loop
94 void setLastNode() { lastNode_ = true; }
95 bool isLastNode() const { return lastNode_;}
96 int instructionCount() const;
97 TTAProgram::Instruction& instruction(int index) const;
99
100 NodeType type() const;
101 std::string toString() const;
102
104 const NodesInfo& region();
105
107 const NodesInfo& eec();
108
111
112 void printRelations() const;
113
114private:
117 /// Stores "region" information for computing serialization information
119 /// Stores "eec" information for computing serialization information
121 /// Stores "shadow" eec information for predicate basic blocks
122 /// which can be then copied into PDG for nodes of basic blocks
123 /// that are not actuall predicate node
125 /// Number of strong component the node belongs to, if any
127 /// Indicated that the node should be scheduled last from it's siblings
128 /// Case when node is predicate or region, has close node in it's subgraph
129 /// and ancestor which is loop entry node
131};
132
133#endif
find Finds info of the inner loops in the false
void addToRegion(ControlDependenceNode &node)
void setLastNode()
LastNode marks node that must be ordered last compared to it's sibling nodes - Close node of loop.
NodesInfo region_
Stores "region" information for computing serialization information.
std::string toString() const
TTAProgram::Instruction & instruction(int index) const
ControlDependenceNode(const NodeType type=CDEP_NODE_BB, BasicBlockNode *bblock=NULL)
int component_
Number of strong component the node belongs to, if any.
void setComponent(int component)
NodesInfo pseudoPredicateEEC_
Stores "shadow" eec information for predicate basic blocks which can be then copied into PDG for node...
const NodesInfo & pseudoPredicateEEC()
std::set< ControlDependenceNode * > NodesInfo
Storage type for other nodes of same graph needed to define some non graph relations....
NodesInfo eec_
Stores "eec" information for computing serialization information.
void addToEEC(ControlDependenceNode &node)
bool lastNode_
Indicated that the node should be scheduled last from it's siblings Case when node is predicate or re...
void setLoopEntryNode(int component)
BasicBlockNode * basicBlockNode() const
void addToPseudoPredicateEEC(ControlDependenceNode &node)