OLD | NEW |
(Empty) | |
| 1 //===- subzero/src/IceCfgNode.h - Control flow graph node -------*- C++ -*-===// |
| 2 // |
| 3 // The Subzero Code Generator |
| 4 // |
| 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. |
| 7 // |
| 8 //===----------------------------------------------------------------------===// |
| 9 // |
| 10 // This file declares the CfgNode class, which represents a single |
| 11 // basic block as its instruction list, in-edge list, and out-edge |
| 12 // list. |
| 13 // |
| 14 //===----------------------------------------------------------------------===// |
| 15 |
| 16 #ifndef SUBZERO_SRC_ICECFGNODE_H |
| 17 #define SUBZERO_SRC_ICECFGNODE_H |
| 18 |
| 19 #include "IceDefs.h" |
| 20 |
| 21 namespace Ice { |
| 22 |
| 23 class CfgNode { |
| 24 public: |
| 25 static CfgNode *create(Cfg *Func, SizeT LabelIndex, IceString Name = "") { |
| 26 return new (Func->allocate<CfgNode>()) CfgNode(Func, LabelIndex, Name); |
| 27 } |
| 28 |
| 29 // Access the label number and name for this node. |
| 30 SizeT getIndex() const { return Number; } |
| 31 IceString getName() const; |
| 32 |
| 33 // Access predecessor and successor edge lists. |
| 34 const NodeList &getInEdges() const { return InEdges; } |
| 35 const NodeList &getOutEdges() const { return OutEdges; } |
| 36 |
| 37 // Manage the instruction list. |
| 38 InstList &getInsts() { return Insts; } |
| 39 void appendInst(Inst *Inst); |
| 40 |
| 41 // Add a predecessor edge to the InEdges list for each of this |
| 42 // node's successors. |
| 43 void computePredecessors(); |
| 44 |
| 45 void dump(Cfg *Func) const; |
| 46 |
| 47 private: |
| 48 CfgNode(Cfg *Func, SizeT LabelIndex, IceString Name); |
| 49 CfgNode(const CfgNode &) LLVM_DELETED_FUNCTION; |
| 50 CfgNode &operator=(const CfgNode &) LLVM_DELETED_FUNCTION; |
| 51 Cfg *const Func; |
| 52 const SizeT Number; // label index |
| 53 IceString Name; // for dumping only |
| 54 NodeList InEdges; // in no particular order |
| 55 NodeList OutEdges; // in no particular order |
| 56 PhiList Phis; // unordered set of phi instructions |
| 57 InstList Insts; // ordered list of non-phi instructions |
| 58 }; |
| 59 |
| 60 } // end of namespace Ice |
| 61 |
| 62 #endif // SUBZERO_SRC_ICECFGNODE_H |
OLD | NEW |