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 // This file declares the CfgNode class, which represents a single | 10 // This file declares the CfgNode class, which represents a single |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 bool getHasReturn() const { return HasReturn; } | 44 bool getHasReturn() const { return HasReturn; } |
45 | 45 |
46 // Access predecessor and successor edge lists. | 46 // Access predecessor and successor edge lists. |
47 const NodeList &getInEdges() const { return InEdges; } | 47 const NodeList &getInEdges() const { return InEdges; } |
48 const NodeList &getOutEdges() const { return OutEdges; } | 48 const NodeList &getOutEdges() const { return OutEdges; } |
49 | 49 |
50 // Manage the instruction list. | 50 // Manage the instruction list. |
51 InstList &getInsts() { return Insts; } | 51 InstList &getInsts() { return Insts; } |
52 void appendInst(Inst *Inst); | 52 void appendInst(Inst *Inst); |
53 void renumberInstructions(); | 53 void renumberInstructions(); |
| 54 // Rough and generally conservative estimate of the number of |
| 55 // instructions in the block. It is updated when an instruction is |
| 56 // added, but not when deleted. It is recomputed during |
| 57 // renumberInstructions(). |
| 58 InstNumberT getInstCountEstimate() const { return InstCountEstimate; } |
54 | 59 |
55 // Add a predecessor edge to the InEdges list for each of this | 60 // Add a predecessor edge to the InEdges list for each of this |
56 // node's successors. | 61 // node's successors. |
57 void computePredecessors(); | 62 void computePredecessors(); |
58 | 63 |
59 void placePhiLoads(); | 64 void placePhiLoads(); |
60 void placePhiStores(); | 65 void placePhiStores(); |
61 void deletePhis(); | 66 void deletePhis(); |
62 void doAddressOpt(); | 67 void doAddressOpt(); |
63 void doNopInsertion(); | 68 void doNopInsertion(); |
64 void genCode(); | 69 void genCode(); |
65 void livenessLightweight(); | 70 void livenessLightweight(); |
66 bool liveness(Liveness *Liveness); | 71 bool liveness(Liveness *Liveness); |
67 void livenessPostprocess(LivenessMode Mode, Liveness *Liveness); | 72 void livenessPostprocess(LivenessMode Mode, Liveness *Liveness); |
68 void doBranchOpt(const CfgNode *NextNode); | 73 void doBranchOpt(const CfgNode *NextNode); |
69 void emit(Cfg *Func) const; | 74 void emit(Cfg *Func) const; |
70 void dump(Cfg *Func) const; | 75 void dump(Cfg *Func) const; |
71 | 76 |
72 private: | 77 private: |
73 CfgNode(Cfg *Func, SizeT LabelIndex, IceString Name); | 78 CfgNode(Cfg *Func, SizeT LabelIndex, IceString Name); |
74 CfgNode(const CfgNode &) = delete; | 79 CfgNode(const CfgNode &) = delete; |
75 CfgNode &operator=(const CfgNode &) = delete; | 80 CfgNode &operator=(const CfgNode &) = delete; |
76 Cfg *const Func; | 81 Cfg *const Func; |
77 const SizeT Number; // label index | 82 const SizeT Number; // label index |
78 IceString Name; // for dumping only | 83 IceString Name; // for dumping only |
79 bool HasReturn; // does this block need an epilog? | 84 bool HasReturn; // does this block need an epilog? |
| 85 InstNumberT InstCountEstimate; // rough instruction count estimate |
80 NodeList InEdges; // in no particular order | 86 NodeList InEdges; // in no particular order |
81 NodeList OutEdges; // in no particular order | 87 NodeList OutEdges; // in no particular order |
82 PhiList Phis; // unordered set of phi instructions | 88 PhiList Phis; // unordered set of phi instructions |
83 InstList Insts; // ordered list of non-phi instructions | 89 InstList Insts; // ordered list of non-phi instructions |
84 }; | 90 }; |
85 | 91 |
86 } // end of namespace Ice | 92 } // end of namespace Ice |
87 | 93 |
88 #endif // SUBZERO_SRC_ICECFGNODE_H | 94 #endif // SUBZERO_SRC_ICECFGNODE_H |
OLD | NEW |