| 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 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 public: | 30 public: |
| 31 static CfgNode *create(Cfg *Func, SizeT Number) { | 31 static CfgNode *create(Cfg *Func, SizeT Number) { |
| 32 return new (Func->allocate<CfgNode>()) CfgNode(Func, Number); | 32 return new (Func->allocate<CfgNode>()) CfgNode(Func, Number); |
| 33 } | 33 } |
| 34 | 34 |
| 35 Cfg *getCfg() const { return Func; } | 35 Cfg *getCfg() const { return Func; } |
| 36 | 36 |
| 37 /// Access the label number and name for this node. | 37 /// Access the label number and name for this node. |
| 38 SizeT getIndex() const { return Number; } | 38 SizeT getIndex() const { return Number; } |
| 39 void resetIndex(SizeT NewNumber) { Number = NewNumber; } | 39 void resetIndex(SizeT NewNumber) { Number = NewNumber; } |
| 40 NodeString getName() const { return Name; } | 40 std::string getName() const { |
| 41 if (Name.hasStdString()) |
| 42 return Name.toString(); |
| 43 return "__" + std::to_string(NumberOrig); |
| 44 } |
| 41 void setName(const std::string &NewName) { | 45 void setName(const std::string &NewName) { |
| 42 if (NewName.empty()) | 46 if (NewName.empty()) |
| 43 return; | 47 return; |
| 44 Name = NodeString::createWithString(Func, NewName); | 48 Name = NodeString::createWithString(Func, NewName); |
| 45 } | 49 } |
| 46 std::string getAsmName() const { | 50 std::string getAsmName() const { |
| 47 return ".L" + Func->getFunctionName() + "$" + getName(); | 51 return ".L" + Func->getFunctionName() + "$" + getName(); |
| 48 } | 52 } |
| 49 | 53 |
| 50 void incrementLoopNestDepth() { ++LoopNestDepth; } | 54 void incrementLoopNestDepth() { ++LoopNestDepth; } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 void profileExecutionCount(VariableDeclaration *Var); | 115 void profileExecutionCount(VariableDeclaration *Var); |
| 112 | 116 |
| 113 void addOutEdge(CfgNode *Out) { OutEdges.push_back(Out); } | 117 void addOutEdge(CfgNode *Out) { OutEdges.push_back(Out); } |
| 114 void addInEdge(CfgNode *In) { InEdges.push_back(In); } | 118 void addInEdge(CfgNode *In) { InEdges.push_back(In); } |
| 115 | 119 |
| 116 bool hasSingleOutEdge() const { | 120 bool hasSingleOutEdge() const { |
| 117 return (getOutEdges().size() == 1 || getOutEdges()[0] == getOutEdges()[1]); | 121 return (getOutEdges().size() == 1 || getOutEdges()[0] == getOutEdges()[1]); |
| 118 } | 122 } |
| 119 | 123 |
| 120 private: | 124 private: |
| 121 CfgNode(Cfg *Func, SizeT Number); | 125 CfgNode(Cfg *Func, SizeT Number) |
| 126 : Func(Func), Number(Number), NumberOrig(Number), |
| 127 Name(NodeString::createWithoutString(Func)) {} |
| 122 bool livenessValidateIntervals(Liveness *Liveness) const; | 128 bool livenessValidateIntervals(Liveness *Liveness) const; |
| 123 Cfg *const Func; | 129 Cfg *const Func; |
| 124 SizeT Number; /// invariant: Func->Nodes[Number]==this | 130 SizeT Number; /// invariant: Func->Nodes[Number]==this |
| 131 const SizeT NumberOrig; /// used for name auto-generation |
| 125 NodeString Name; | 132 NodeString Name; |
| 126 SizeT LoopNestDepth = 0; /// the loop nest depth of this node | 133 SizeT LoopNestDepth = 0; /// the loop nest depth of this node |
| 127 bool HasReturn = false; /// does this block need an epilog? | 134 bool HasReturn = false; /// does this block need an epilog? |
| 128 bool NeedsPlacement = false; | 135 bool NeedsPlacement = false; |
| 129 bool NeedsAlignment = false; /// is sandboxing required? | 136 bool NeedsAlignment = false; /// is sandboxing required? |
| 130 InstNumberT InstCountEstimate = 0; /// rough instruction count estimate | 137 InstNumberT InstCountEstimate = 0; /// rough instruction count estimate |
| 131 NodeList InEdges; /// in no particular order | 138 NodeList InEdges; /// in no particular order |
| 132 NodeList OutEdges; /// in no particular order | 139 NodeList OutEdges; /// in no particular order |
| 133 PhiList Phis; /// unordered set of phi instructions | 140 PhiList Phis; /// unordered set of phi instructions |
| 134 InstList Insts; /// ordered list of non-phi instructions | 141 InstList Insts; /// ordered list of non-phi instructions |
| 135 }; | 142 }; |
| 136 | 143 |
| 137 } // end of namespace Ice | 144 } // end of namespace Ice |
| 138 | 145 |
| 139 #endif // SUBZERO_SRC_ICECFGNODE_H | 146 #endif // SUBZERO_SRC_ICECFGNODE_H |
| OLD | NEW |