| OLD | NEW |
| 1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// | 1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===// |
| 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 implements the Cfg class, including constant pool | 10 // This file implements the Cfg class, including constant pool |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 if (Node->getHasReturn()) | 161 if (Node->getHasReturn()) |
| 162 getTarget()->addEpilog(Node); | 162 getTarget()->addEpilog(Node); |
| 163 } | 163 } |
| 164 | 164 |
| 165 // This is a lightweight version of live-range-end calculation. Marks | 165 // This is a lightweight version of live-range-end calculation. Marks |
| 166 // the last use of only those variables whose definition and uses are | 166 // the last use of only those variables whose definition and uses are |
| 167 // completely with a single block. It is a quick single pass and | 167 // completely with a single block. It is a quick single pass and |
| 168 // doesn't need to iterate until convergence. | 168 // doesn't need to iterate until convergence. |
| 169 void Cfg::livenessLightweight() { | 169 void Cfg::livenessLightweight() { |
| 170 TimerMarker T(TimerStack::TT_livenessLightweight, this); | 170 TimerMarker T(TimerStack::TT_livenessLightweight, this); |
| 171 getVMetadata()->init(); | 171 getVMetadata()->init(VMK_Uses); |
| 172 for (CfgNode *Node : Nodes) | 172 for (CfgNode *Node : Nodes) |
| 173 Node->livenessLightweight(); | 173 Node->livenessLightweight(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void Cfg::liveness(LivenessMode Mode) { | 176 void Cfg::liveness(LivenessMode Mode) { |
| 177 TimerMarker T(TimerStack::TT_liveness, this); | 177 TimerMarker T(TimerStack::TT_liveness, this); |
| 178 Live.reset(new Liveness(this, Mode)); | 178 Live.reset(new Liveness(this, Mode)); |
| 179 getVMetadata()->init(); | 179 getVMetadata()->init(VMK_Uses); |
| 180 Live->init(); | 180 Live->init(); |
| 181 // Initialize with all nodes needing to be processed. | 181 // Initialize with all nodes needing to be processed. |
| 182 llvm::BitVector NeedToProcess(Nodes.size(), true); | 182 llvm::BitVector NeedToProcess(Nodes.size(), true); |
| 183 while (NeedToProcess.any()) { | 183 while (NeedToProcess.any()) { |
| 184 // Iterate in reverse topological order to speed up convergence. | 184 // Iterate in reverse topological order to speed up convergence. |
| 185 // TODO(stichnot): Use llvm::make_range with LLVM 3.5. | 185 // TODO(stichnot): Use llvm::make_range with LLVM 3.5. |
| 186 for (auto I = Nodes.rbegin(), E = Nodes.rend(); I != E; ++I) { | 186 for (auto I = Nodes.rbegin(), E = Nodes.rend(); I != E; ++I) { |
| 187 CfgNode *Node = *I; | 187 CfgNode *Node = *I; |
| 188 if (NeedToProcess[Node->getIndex()]) { | 188 if (NeedToProcess[Node->getIndex()]) { |
| 189 NeedToProcess[Node->getIndex()] = false; | 189 NeedToProcess[Node->getIndex()] = false; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 } | 388 } |
| 389 } | 389 } |
| 390 // Print each basic block | 390 // Print each basic block |
| 391 for (CfgNode *Node : Nodes) | 391 for (CfgNode *Node : Nodes) |
| 392 Node->dump(this); | 392 Node->dump(this); |
| 393 if (getContext()->isVerbose(IceV_Instructions)) | 393 if (getContext()->isVerbose(IceV_Instructions)) |
| 394 Str << "}\n"; | 394 Str << "}\n"; |
| 395 } | 395 } |
| 396 | 396 |
| 397 } // end of namespace Ice | 397 } // end of namespace Ice |
| OLD | NEW |