| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 class CfgNode { | 23 class CfgNode { |
| 24 public: | 24 public: |
| 25 static CfgNode *create(Cfg *Func, SizeT LabelIndex, IceString Name = "") { | 25 static CfgNode *create(Cfg *Func, SizeT LabelIndex, IceString Name = "") { |
| 26 return new (Func->allocate<CfgNode>()) CfgNode(Func, LabelIndex, Name); | 26 return new (Func->allocate<CfgNode>()) CfgNode(Func, LabelIndex, Name); |
| 27 } | 27 } |
| 28 | 28 |
| 29 // Access the label number and name for this node. | 29 // Access the label number and name for this node. |
| 30 SizeT getIndex() const { return Number; } | 30 SizeT getIndex() const { return Number; } |
| 31 IceString getName() const; | 31 IceString getName() const; |
| 32 IceString getAsmName() const { |
| 33 return ".L" + Func->getFunctionName() + "$" + getName(); |
| 34 } |
| 35 |
| 36 // The HasReturn flag indicates that this node contains a return |
| 37 // instruction and therefore needs an epilog. |
| 38 void setHasReturn() { HasReturn = true; } |
| 39 bool getHasReturn() const { return HasReturn; } |
| 32 | 40 |
| 33 // Access predecessor and successor edge lists. | 41 // Access predecessor and successor edge lists. |
| 34 const NodeList &getInEdges() const { return InEdges; } | 42 const NodeList &getInEdges() const { return InEdges; } |
| 35 const NodeList &getOutEdges() const { return OutEdges; } | 43 const NodeList &getOutEdges() const { return OutEdges; } |
| 36 | 44 |
| 37 // Manage the instruction list. | 45 // Manage the instruction list. |
| 38 InstList &getInsts() { return Insts; } | 46 InstList &getInsts() { return Insts; } |
| 39 void appendInst(Inst *Inst); | 47 void appendInst(Inst *Inst); |
| 40 | 48 |
| 41 // Add a predecessor edge to the InEdges list for each of this | 49 // Add a predecessor edge to the InEdges list for each of this |
| 42 // node's successors. | 50 // node's successors. |
| 43 void computePredecessors(); | 51 void computePredecessors(); |
| 44 | 52 |
| 53 void placePhiLoads(); |
| 54 void placePhiStores(); |
| 55 void deletePhis(); |
| 56 void genCode(); |
| 57 void emit(Cfg *Func) const; |
| 45 void dump(Cfg *Func) const; | 58 void dump(Cfg *Func) const; |
| 46 | 59 |
| 47 private: | 60 private: |
| 48 CfgNode(Cfg *Func, SizeT LabelIndex, IceString Name); | 61 CfgNode(Cfg *Func, SizeT LabelIndex, IceString Name); |
| 49 CfgNode(const CfgNode &) LLVM_DELETED_FUNCTION; | 62 CfgNode(const CfgNode &) LLVM_DELETED_FUNCTION; |
| 50 CfgNode &operator=(const CfgNode &) LLVM_DELETED_FUNCTION; | 63 CfgNode &operator=(const CfgNode &) LLVM_DELETED_FUNCTION; |
| 51 Cfg *const Func; | 64 Cfg *const Func; |
| 52 const SizeT Number; // label index | 65 const SizeT Number; // label index |
| 53 IceString Name; // for dumping only | 66 IceString Name; // for dumping only |
| 67 bool HasReturn; // does this block need an epilog? |
| 54 NodeList InEdges; // in no particular order | 68 NodeList InEdges; // in no particular order |
| 55 NodeList OutEdges; // in no particular order | 69 NodeList OutEdges; // in no particular order |
| 56 PhiList Phis; // unordered set of phi instructions | 70 PhiList Phis; // unordered set of phi instructions |
| 57 InstList Insts; // ordered list of non-phi instructions | 71 InstList Insts; // ordered list of non-phi instructions |
| 58 }; | 72 }; |
| 59 | 73 |
| 60 } // end of namespace Ice | 74 } // end of namespace Ice |
| 61 | 75 |
| 62 #endif // SUBZERO_SRC_ICECFGNODE_H | 76 #endif // SUBZERO_SRC_ICECFGNODE_H |
| OLD | NEW |