OLD | NEW |
1 //===- subzero/src/IceCfg.h - Control flow graph ----------------*- C++ -*-===// | 1 //===- subzero/src/IceCfg.h - Control flow graph ----------------*- 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 Cfg class, which represents the control flow | 10 // This file declares the Cfg class, which represents the control flow |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 const IceString &Name = ""); | 65 const IceString &Name = ""); |
66 SizeT getNumVariables() const { return Variables.size(); } | 66 SizeT getNumVariables() const { return Variables.size(); } |
67 const VarList &getVariables() const { return Variables; } | 67 const VarList &getVariables() const { return Variables; } |
68 | 68 |
69 // Manage arguments to the function. | 69 // Manage arguments to the function. |
70 void addArg(Variable *Arg); | 70 void addArg(Variable *Arg); |
71 const VarList &getArgs() const { return Args; } | 71 const VarList &getArgs() const { return Args; } |
72 | 72 |
73 // Miscellaneous accessors. | 73 // Miscellaneous accessors. |
74 TargetLowering *getTarget() const { return Target.get(); } | 74 TargetLowering *getTarget() const { return Target.get(); } |
| 75 Liveness *getLiveness() const { return Live.get(); } |
75 bool hasComputedFrame() const; | 76 bool hasComputedFrame() const; |
76 | 77 |
77 // Passes over the CFG. | 78 // Passes over the CFG. |
78 void translate(); | 79 void translate(); |
79 // After the CFG is fully constructed, iterate over the nodes and | 80 // After the CFG is fully constructed, iterate over the nodes and |
80 // compute the predecessor edges, in the form of | 81 // compute the predecessor edges, in the form of |
81 // CfgNode::InEdges[]. | 82 // CfgNode::InEdges[]. |
82 void computePredecessors(); | 83 void computePredecessors(); |
| 84 void renumberInstructions(); |
83 void placePhiLoads(); | 85 void placePhiLoads(); |
84 void placePhiStores(); | 86 void placePhiStores(); |
85 void deletePhis(); | 87 void deletePhis(); |
| 88 void doAddressOpt(); |
86 void genCode(); | 89 void genCode(); |
87 void genFrame(); | 90 void genFrame(); |
| 91 void liveness(LivenessMode Mode); |
| 92 bool validateLiveness() const; |
88 | 93 |
89 // Manage the CurrentNode field, which is used for validating the | 94 // Manage the CurrentNode field, which is used for validating the |
90 // Variable::DefNode field during dumping/emitting. | 95 // Variable::DefNode field during dumping/emitting. |
91 void setCurrentNode(const CfgNode *Node) { CurrentNode = Node; } | 96 void setCurrentNode(const CfgNode *Node) { CurrentNode = Node; } |
92 const CfgNode *getCurrentNode() const { return CurrentNode; } | 97 const CfgNode *getCurrentNode() const { return CurrentNode; } |
93 | 98 |
94 void emit(); | 99 void emit(); |
95 void dump(); | 100 void dump(); |
96 | 101 |
97 // Allocate data of type T using the per-Cfg allocator. | 102 // Allocate data of type T using the per-Cfg allocator. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 IceString FunctionName; | 137 IceString FunctionName; |
133 Type ReturnType; | 138 Type ReturnType; |
134 bool IsInternalLinkage; | 139 bool IsInternalLinkage; |
135 bool HasError; | 140 bool HasError; |
136 IceString ErrorMessage; | 141 IceString ErrorMessage; |
137 CfgNode *Entry; // entry basic block | 142 CfgNode *Entry; // entry basic block |
138 NodeList Nodes; // linearized node list; Entry should be first | 143 NodeList Nodes; // linearized node list; Entry should be first |
139 int32_t NextInstNumber; | 144 int32_t NextInstNumber; |
140 VarList Variables; | 145 VarList Variables; |
141 VarList Args; // subset of Variables, in argument order | 146 VarList Args; // subset of Variables, in argument order |
| 147 llvm::OwningPtr<Liveness> Live; |
142 llvm::OwningPtr<TargetLowering> Target; | 148 llvm::OwningPtr<TargetLowering> Target; |
143 | 149 |
144 // CurrentNode is maintained during dumping/emitting just for | 150 // CurrentNode is maintained during dumping/emitting just for |
145 // validating Variable::DefNode. Normally, a traversal over | 151 // validating Variable::DefNode. Normally, a traversal over |
146 // CfgNodes maintains this, but before global operations like | 152 // CfgNodes maintains this, but before global operations like |
147 // register allocation, setCurrentNode(NULL) should be called to | 153 // register allocation, setCurrentNode(NULL) should be called to |
148 // avoid spurious validation failures. | 154 // avoid spurious validation failures. |
149 const CfgNode *CurrentNode; | 155 const CfgNode *CurrentNode; |
150 | 156 |
151 Cfg(const Cfg &) LLVM_DELETED_FUNCTION; | 157 Cfg(const Cfg &) LLVM_DELETED_FUNCTION; |
152 Cfg &operator=(const Cfg &) LLVM_DELETED_FUNCTION; | 158 Cfg &operator=(const Cfg &) LLVM_DELETED_FUNCTION; |
153 }; | 159 }; |
154 | 160 |
155 } // end of namespace Ice | 161 } // end of namespace Ice |
156 | 162 |
157 #endif // SUBZERO_SRC_ICECFG_H | 163 #endif // SUBZERO_SRC_ICECFG_H |
OLD | NEW |