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 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 IceString getAsmName() const { | 40 IceString getAsmName() const { |
41 return ".L" + Func->getFunctionName() + "$" + getName(); | 41 return ".L" + Func->getFunctionName() + "$" + getName(); |
42 } | 42 } |
43 | 43 |
44 // The HasReturn flag indicates that this node contains a return | 44 // The HasReturn flag indicates that this node contains a return |
45 // instruction and therefore needs an epilog. | 45 // instruction and therefore needs an epilog. |
46 void setHasReturn() { HasReturn = true; } | 46 void setHasReturn() { HasReturn = true; } |
47 bool getHasReturn() const { return HasReturn; } | 47 bool getHasReturn() const { return HasReturn; } |
48 | 48 |
| 49 void setNeedsPlacement(bool Value) { NeedsPlacement = Value; } |
| 50 bool needsPlacement() const { return NeedsPlacement; } |
| 51 |
49 // Access predecessor and successor edge lists. | 52 // Access predecessor and successor edge lists. |
50 const NodeList &getInEdges() const { return InEdges; } | 53 const NodeList &getInEdges() const { return InEdges; } |
51 const NodeList &getOutEdges() const { return OutEdges; } | 54 const NodeList &getOutEdges() const { return OutEdges; } |
52 | 55 |
53 // Manage the instruction list. | 56 // Manage the instruction list. |
54 InstList &getInsts() { return Insts; } | 57 InstList &getInsts() { return Insts; } |
55 PhiList &getPhis() { return Phis; } | 58 PhiList &getPhis() { return Phis; } |
56 void appendInst(Inst *Inst); | 59 void appendInst(Inst *Inst); |
57 void renumberInstructions(); | 60 void renumberInstructions(); |
58 // Rough and generally conservative estimate of the number of | 61 // Rough and generally conservative estimate of the number of |
59 // instructions in the block. It is updated when an instruction is | 62 // instructions in the block. It is updated when an instruction is |
60 // added, but not when deleted. It is recomputed during | 63 // added, but not when deleted. It is recomputed during |
61 // renumberInstructions(). | 64 // renumberInstructions(). |
62 InstNumberT getInstCountEstimate() const { return InstCountEstimate; } | 65 InstNumberT getInstCountEstimate() const { return InstCountEstimate; } |
63 | 66 |
64 // Add a predecessor edge to the InEdges list for each of this | 67 // Add a predecessor edge to the InEdges list for each of this |
65 // node's successors. | 68 // node's successors. |
66 void computePredecessors(); | 69 void computePredecessors(); |
| 70 CfgNode *splitIncomingEdge(CfgNode *Pred, SizeT InEdgeIndex); |
67 | 71 |
68 void placePhiLoads(); | 72 void placePhiLoads(); |
69 void placePhiStores(); | 73 void placePhiStores(); |
70 void deletePhis(); | 74 void deletePhis(); |
| 75 void advancedPhiLowering(); |
71 void doAddressOpt(); | 76 void doAddressOpt(); |
72 void doNopInsertion(); | 77 void doNopInsertion(); |
73 void genCode(); | 78 void genCode(); |
74 void livenessLightweight(); | 79 void livenessLightweight(); |
75 bool liveness(Liveness *Liveness); | 80 bool liveness(Liveness *Liveness); |
76 void livenessPostprocess(LivenessMode Mode, Liveness *Liveness); | 81 void livenessPostprocess(LivenessMode Mode, Liveness *Liveness); |
| 82 void contractIfEmpty(); |
77 void doBranchOpt(const CfgNode *NextNode); | 83 void doBranchOpt(const CfgNode *NextNode); |
78 void emit(Cfg *Func) const; | 84 void emit(Cfg *Func) const; |
79 void dump(Cfg *Func) const; | 85 void dump(Cfg *Func) const; |
80 | 86 |
81 private: | 87 private: |
82 CfgNode(Cfg *Func, SizeT LabelIndex, IceString Name); | 88 CfgNode(Cfg *Func, SizeT LabelIndex, IceString Name); |
83 Cfg *const Func; | 89 Cfg *const Func; |
84 const SizeT Number; // label index | 90 const SizeT Number; // label index |
85 IceString Name; // for dumping only | 91 IceString Name; // for dumping only |
86 bool HasReturn; // does this block need an epilog? | 92 bool HasReturn; // does this block need an epilog? |
| 93 bool NeedsPlacement; |
87 InstNumberT InstCountEstimate; // rough instruction count estimate | 94 InstNumberT InstCountEstimate; // rough instruction count estimate |
88 NodeList InEdges; // in no particular order | 95 NodeList InEdges; // in no particular order |
89 NodeList OutEdges; // in no particular order | 96 NodeList OutEdges; // in no particular order |
90 PhiList Phis; // unordered set of phi instructions | 97 PhiList Phis; // unordered set of phi instructions |
91 InstList Insts; // ordered list of non-phi instructions | 98 InstList Insts; // ordered list of non-phi instructions |
92 }; | 99 }; |
93 | 100 |
94 } // end of namespace Ice | 101 } // end of namespace Ice |
95 | 102 |
96 #endif // SUBZERO_SRC_ICECFGNODE_H | 103 #endif // SUBZERO_SRC_ICECFGNODE_H |
OLD | NEW |