| 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 15 matching lines...) Expand all Loading... |
| 26 CfgNode(const CfgNode &) = delete; | 26 CfgNode(const CfgNode &) = delete; |
| 27 CfgNode &operator=(const CfgNode &) = delete; | 27 CfgNode &operator=(const CfgNode &) = delete; |
| 28 | 28 |
| 29 public: | 29 public: |
| 30 static CfgNode *create(Cfg *Func, SizeT LabelIndex) { | 30 static CfgNode *create(Cfg *Func, SizeT LabelIndex) { |
| 31 return new (Func->allocate<CfgNode>()) CfgNode(Func, LabelIndex); | 31 return new (Func->allocate<CfgNode>()) CfgNode(Func, LabelIndex); |
| 32 } | 32 } |
| 33 | 33 |
| 34 // Access the label number and name for this node. | 34 // Access the label number and name for this node. |
| 35 SizeT getIndex() const { return Number; } | 35 SizeT getIndex() const { return Number; } |
| 36 void resetIndex(SizeT NewNumber) { Number = NewNumber; } |
| 36 IceString getName() const; | 37 IceString getName() const; |
| 37 void setName(const IceString &NewName) { | 38 void setName(const IceString &NewName) { |
| 38 // Make sure that the name can only be set once. | 39 // Make sure that the name can only be set once. |
| 39 assert(NameIndex == Cfg::IdentifierIndexInvalid); | 40 assert(NameIndex == Cfg::IdentifierIndexInvalid); |
| 40 if (!NewName.empty()) | 41 if (!NewName.empty()) |
| 41 NameIndex = Func->addIdentifierName(NewName); | 42 NameIndex = Func->addIdentifierName(NewName); |
| 42 } | 43 } |
| 43 IceString getAsmName() const { | 44 IceString getAsmName() const { |
| 44 return ".L" + Func->getFunctionName() + "$" + getName(); | 45 return ".L" + Func->getFunctionName() + "$" + getName(); |
| 45 } | 46 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 63 void renumberInstructions(); | 64 void renumberInstructions(); |
| 64 // Rough and generally conservative estimate of the number of | 65 // Rough and generally conservative estimate of the number of |
| 65 // instructions in the block. It is updated when an instruction is | 66 // instructions in the block. It is updated when an instruction is |
| 66 // added, but not when deleted. It is recomputed during | 67 // added, but not when deleted. It is recomputed during |
| 67 // renumberInstructions(). | 68 // renumberInstructions(). |
| 68 InstNumberT getInstCountEstimate() const { return InstCountEstimate; } | 69 InstNumberT getInstCountEstimate() const { return InstCountEstimate; } |
| 69 | 70 |
| 70 // Add a predecessor edge to the InEdges list for each of this | 71 // Add a predecessor edge to the InEdges list for each of this |
| 71 // node's successors. | 72 // node's successors. |
| 72 void computePredecessors(); | 73 void computePredecessors(); |
| 74 void computeSuccessors(); |
| 73 CfgNode *splitIncomingEdge(CfgNode *Pred, SizeT InEdgeIndex); | 75 CfgNode *splitIncomingEdge(CfgNode *Pred, SizeT InEdgeIndex); |
| 74 | 76 |
| 75 void placePhiLoads(); | 77 void placePhiLoads(); |
| 76 void placePhiStores(); | 78 void placePhiStores(); |
| 77 void deletePhis(); | 79 void deletePhis(); |
| 78 void advancedPhiLowering(); | 80 void advancedPhiLowering(); |
| 79 void doAddressOpt(); | 81 void doAddressOpt(); |
| 80 void doNopInsertion(); | 82 void doNopInsertion(); |
| 81 void genCode(); | 83 void genCode(); |
| 82 void livenessLightweight(); | 84 void livenessLightweight(); |
| 83 bool liveness(Liveness *Liveness); | 85 bool liveness(Liveness *Liveness); |
| 84 void livenessAddIntervals(Liveness *Liveness, InstNumberT FirstInstNum, | 86 void livenessAddIntervals(Liveness *Liveness, InstNumberT FirstInstNum, |
| 85 InstNumberT LastInstNum); | 87 InstNumberT LastInstNum); |
| 86 void contractIfEmpty(); | 88 void contractIfEmpty(); |
| 87 void doBranchOpt(const CfgNode *NextNode); | 89 void doBranchOpt(const CfgNode *NextNode); |
| 88 void emit(Cfg *Func) const; | 90 void emit(Cfg *Func) const; |
| 89 void emitIAS(Cfg *Func) const; | 91 void emitIAS(Cfg *Func) const; |
| 90 void dump(Cfg *Func) const; | 92 void dump(Cfg *Func) const; |
| 91 | 93 |
| 92 private: | 94 private: |
| 93 CfgNode(Cfg *Func, SizeT LabelIndex); | 95 CfgNode(Cfg *Func, SizeT LabelIndex); |
| 94 Cfg *const Func; | 96 Cfg *const Func; |
| 95 const SizeT Number; // label index | 97 SizeT Number; // label index |
| 96 Cfg::IdentifierIndexType NameIndex; // index into Cfg::NodeNames table | 98 Cfg::IdentifierIndexType NameIndex; // index into Cfg::NodeNames table |
| 97 bool HasReturn; // does this block need an epilog? | 99 bool HasReturn; // does this block need an epilog? |
| 98 bool NeedsPlacement; | 100 bool NeedsPlacement; |
| 99 InstNumberT InstCountEstimate; // rough instruction count estimate | 101 InstNumberT InstCountEstimate; // rough instruction count estimate |
| 100 NodeList InEdges; // in no particular order | 102 NodeList InEdges; // in no particular order |
| 101 NodeList OutEdges; // in no particular order | 103 NodeList OutEdges; // in no particular order |
| 102 PhiList Phis; // unordered set of phi instructions | 104 PhiList Phis; // unordered set of phi instructions |
| 103 InstList Insts; // ordered list of non-phi instructions | 105 InstList Insts; // ordered list of non-phi instructions |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 } // end of namespace Ice | 108 } // end of namespace Ice |
| 107 | 109 |
| 108 #endif // SUBZERO_SRC_ICECFGNODE_H | 110 #endif // SUBZERO_SRC_ICECFGNODE_H |
| OLD | NEW |