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(IceCfg *Cfg, IceSize_t LabelIndex, |
| 26 IceString Name = "") { |
| 27 return new (Cfg->allocate<CfgNode>()) CfgNode(Cfg, LabelIndex, Name); |
| 28 } |
| 29 |
| 30 // Access the label number and name for this node. |
| 31 IceSize_t getIndex() const { return Number; } |
| 32 IceString getName() const; |
| 33 |
| 34 // Access predecessor and successor edge lists. |
| 35 const NodeList &getInEdges() const { return InEdges; } |
| 36 const NodeList &getOutEdges() const { return OutEdges; } |
| 37 |
| 38 // Manage the instruction list. |
| 39 InstList &getInsts() { return Insts; } |
| 40 void appendInst(Inst *Inst); |
| 41 |
| 42 // Add a predecessor edge to the InEdges list for each of this |
| 43 // node's successors. |
| 44 void computePredecessors(); |
| 45 |
| 46 void dump(IceCfg *Cfg) const; |
| 47 |
| 48 private: |
| 49 CfgNode(IceCfg *Cfg, IceSize_t LabelIndex, IceString Name); |
| 50 CfgNode(const CfgNode &) LLVM_DELETED_FUNCTION; |
| 51 CfgNode &operator=(const CfgNode &) LLVM_DELETED_FUNCTION; |
| 52 IceCfg *const Cfg; |
| 53 const IceSize_t Number; // label index |
| 54 IceString Name; // for dumping only |
| 55 NodeList InEdges; // in no particular order |
| 56 NodeList OutEdges; // in no particular order |
| 57 PhiList Phis; // unordered set of phi instructions |
| 58 InstList Insts; // ordered list of non-phi instructions |
| 59 }; |
| 60 |
| 61 } // end of namespace Ice |
| 62 |
| 63 #endif // SUBZERO_SRC_ICECFGNODE_H |
OLD | NEW |