OLD | NEW |
1 //===- subzero/src/IceCfgNode.h - Control flow graph node -------*- C++ -*-===// | 1 //===- subzero/src/IceCfgNode.h - Control flow graph node -------*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
11 /// This file declares the CfgNode class, which represents a single | 11 /// This file declares the CfgNode class, which represents a single basic block |
12 /// basic block as its instruction list, in-edge list, and out-edge | 12 /// as its instruction list, in-edge list, and out-edge list. |
13 /// list. | |
14 /// | 13 /// |
15 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
16 | 15 |
17 #ifndef SUBZERO_SRC_ICECFGNODE_H | 16 #ifndef SUBZERO_SRC_ICECFGNODE_H |
18 #define SUBZERO_SRC_ICECFGNODE_H | 17 #define SUBZERO_SRC_ICECFGNODE_H |
19 | 18 |
20 #include "IceDefs.h" | 19 #include "IceDefs.h" |
21 #include "IceInst.h" // InstList traits | 20 #include "IceInst.h" // InstList traits |
22 | 21 |
23 namespace Ice { | 22 namespace Ice { |
(...skipping 19 matching lines...) Expand all Loading... |
43 NameIndex = Func->addIdentifierName(NewName); | 42 NameIndex = Func->addIdentifierName(NewName); |
44 } | 43 } |
45 IceString getAsmName() const { | 44 IceString getAsmName() const { |
46 return ".L" + Func->getFunctionName() + "$" + getName(); | 45 return ".L" + Func->getFunctionName() + "$" + getName(); |
47 } | 46 } |
48 | 47 |
49 void incrementLoopNestDepth() { ++LoopNestDepth; } | 48 void incrementLoopNestDepth() { ++LoopNestDepth; } |
50 void setLoopNestDepth(SizeT NewDepth) { LoopNestDepth = NewDepth; } | 49 void setLoopNestDepth(SizeT NewDepth) { LoopNestDepth = NewDepth; } |
51 SizeT getLoopNestDepth() const { return LoopNestDepth; } | 50 SizeT getLoopNestDepth() const { return LoopNestDepth; } |
52 | 51 |
53 /// The HasReturn flag indicates that this node contains a return | 52 /// The HasReturn flag indicates that this node contains a return instruction |
54 /// instruction and therefore needs an epilog. | 53 /// and therefore needs an epilog. |
55 void setHasReturn() { HasReturn = true; } | 54 void setHasReturn() { HasReturn = true; } |
56 bool getHasReturn() const { return HasReturn; } | 55 bool getHasReturn() const { return HasReturn; } |
57 | 56 |
58 void setNeedsPlacement(bool Value) { NeedsPlacement = Value; } | 57 void setNeedsPlacement(bool Value) { NeedsPlacement = Value; } |
59 bool needsPlacement() const { return NeedsPlacement; } | 58 bool needsPlacement() const { return NeedsPlacement; } |
60 | 59 |
61 void setNeedsAlignment() { NeedsAlignment = true; } | 60 void setNeedsAlignment() { NeedsAlignment = true; } |
62 bool needsAlignment() const { return NeedsAlignment; } | 61 bool needsAlignment() const { return NeedsAlignment; } |
63 | 62 |
64 /// \name Access predecessor and successor edge lists. | 63 /// \name Access predecessor and successor edge lists. |
65 /// @{ | 64 /// @{ |
66 const NodeList &getInEdges() const { return InEdges; } | 65 const NodeList &getInEdges() const { return InEdges; } |
67 const NodeList &getOutEdges() const { return OutEdges; } | 66 const NodeList &getOutEdges() const { return OutEdges; } |
68 /// @} | 67 /// @} |
69 | 68 |
70 /// \name Manage the instruction list. | 69 /// \name Manage the instruction list. |
71 /// @{ | 70 /// @{ |
72 InstList &getInsts() { return Insts; } | 71 InstList &getInsts() { return Insts; } |
73 PhiList &getPhis() { return Phis; } | 72 PhiList &getPhis() { return Phis; } |
74 void appendInst(Inst *Inst); | 73 void appendInst(Inst *Inst); |
75 void renumberInstructions(); | 74 void renumberInstructions(); |
76 /// Rough and generally conservative estimate of the number of | 75 /// Rough and generally conservative estimate of the number of instructions in |
77 /// instructions in the block. It is updated when an instruction is | 76 /// the block. It is updated when an instruction is added, but not when |
78 /// added, but not when deleted. It is recomputed during | 77 /// deleted. It is recomputed during renumberInstructions(). |
79 /// renumberInstructions(). | |
80 InstNumberT getInstCountEstimate() const { return InstCountEstimate; } | 78 InstNumberT getInstCountEstimate() const { return InstCountEstimate; } |
81 /// @} | 79 /// @} |
82 | 80 |
83 /// \name Manage predecessors and successors. | 81 /// \name Manage predecessors and successors. |
84 /// @{ | 82 /// @{ |
85 | 83 |
86 /// Add a predecessor edge to the InEdges list for each of this | 84 /// Add a predecessor edge to the InEdges list for each of this node's |
87 /// node's successors. | 85 /// successors. |
88 void computePredecessors(); | 86 void computePredecessors(); |
89 void computeSuccessors(); | 87 void computeSuccessors(); |
90 CfgNode *splitIncomingEdge(CfgNode *Pred, SizeT InEdgeIndex); | 88 CfgNode *splitIncomingEdge(CfgNode *Pred, SizeT InEdgeIndex); |
91 /// @} | 89 /// @} |
92 | 90 |
93 void placePhiLoads(); | 91 void placePhiLoads(); |
94 void placePhiStores(); | 92 void placePhiStores(); |
95 void deletePhis(); | 93 void deletePhis(); |
96 void advancedPhiLowering(); | 94 void advancedPhiLowering(); |
97 void doAddressOpt(); | 95 void doAddressOpt(); |
(...skipping 24 matching lines...) Expand all Loading... |
122 InstNumberT InstCountEstimate = 0; /// rough instruction count estimate | 120 InstNumberT InstCountEstimate = 0; /// rough instruction count estimate |
123 NodeList InEdges; /// in no particular order | 121 NodeList InEdges; /// in no particular order |
124 NodeList OutEdges; /// in no particular order | 122 NodeList OutEdges; /// in no particular order |
125 PhiList Phis; /// unordered set of phi instructions | 123 PhiList Phis; /// unordered set of phi instructions |
126 InstList Insts; /// ordered list of non-phi instructions | 124 InstList Insts; /// ordered list of non-phi instructions |
127 }; | 125 }; |
128 | 126 |
129 } // end of namespace Ice | 127 } // end of namespace Ice |
130 | 128 |
131 #endif // SUBZERO_SRC_ICECFGNODE_H | 129 #endif // SUBZERO_SRC_ICECFGNODE_H |
OLD | NEW |