| 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 /// \file | 10 /// \file |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 assert(Phi); | 254 assert(Phi); |
| 255 for (SizeT i = 0; i < InEdges.size(); ++i) { | 255 for (SizeT i = 0; i < InEdges.size(); ++i) { |
| 256 Phi->setLabel(i, InEdges[i]); | 256 Phi->setLabel(i, InEdges[i]); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 } | 260 } |
| 261 | 261 |
| 262 void Cfg::computeInOutEdges() { | 262 void Cfg::computeInOutEdges() { |
| 263 // Compute the out-edges. | 263 // Compute the out-edges. |
| 264 for (CfgNode *Node : Nodes) | 264 for (CfgNode *Node : Nodes) { |
| 265 Node->computeSuccessors(); | 265 Node->computeSuccessors(); |
| 266 } |
| 266 | 267 |
| 267 // Prune any unreachable nodes before computing in-edges. | 268 // Prune any unreachable nodes before computing in-edges. |
| 268 SizeT NumNodes = getNumNodes(); | 269 SizeT NumNodes = getNumNodes(); |
| 269 BitVector Reachable(NumNodes); | 270 BitVector Reachable(NumNodes); |
| 270 BitVector Pending(NumNodes); | 271 BitVector Pending(NumNodes); |
| 271 Pending.set(getEntryNode()->getIndex()); | 272 Pending.set(getEntryNode()->getIndex()); |
| 272 while (true) { | 273 while (true) { |
| 273 int Index = Pending.find_first(); | 274 int Index = Pending.find_first(); |
| 274 if (Index == -1) | 275 if (Index == -1) |
| 275 break; | 276 break; |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 // Allocate the fixed area in the function prolog. | 593 // Allocate the fixed area in the function prolog. |
| 593 getTarget()->reserveFixedAllocaArea(TotalSize, CombinedAlignment); | 594 getTarget()->reserveFixedAllocaArea(TotalSize, CombinedAlignment); |
| 594 } break; | 595 } break; |
| 595 } | 596 } |
| 596 } | 597 } |
| 597 | 598 |
| 598 void Cfg::processAllocas(bool SortAndCombine) { | 599 void Cfg::processAllocas(bool SortAndCombine) { |
| 599 TimerMarker _(TimerStack::TT_alloca, this); | 600 TimerMarker _(TimerStack::TT_alloca, this); |
| 600 const uint32_t StackAlignment = getTarget()->getStackAlignment(); | 601 const uint32_t StackAlignment = getTarget()->getStackAlignment(); |
| 601 CfgNode *EntryNode = getEntryNode(); | 602 CfgNode *EntryNode = getEntryNode(); |
| 603 assert(EntryNode); |
| 602 // LLVM enforces power of 2 alignment. | 604 // LLVM enforces power of 2 alignment. |
| 603 assert(llvm::isPowerOf2_32(StackAlignment)); | 605 assert(llvm::isPowerOf2_32(StackAlignment)); |
| 604 // Determine if there are large alignment allocations in the entry block or | 606 // Determine if there are large alignment allocations in the entry block or |
| 605 // dynamic allocations (variable size in the entry block). | 607 // dynamic allocations (variable size in the entry block). |
| 606 bool HasLargeAlignment = false; | 608 bool HasLargeAlignment = false; |
| 607 bool HasDynamicAllocation = false; | 609 bool HasDynamicAllocation = false; |
| 608 for (Inst &Instr : EntryNode->getInsts()) { | 610 for (Inst &Instr : EntryNode->getInsts()) { |
| 609 if (auto *Alloca = llvm::dyn_cast<InstAlloca>(&Instr)) { | 611 if (auto *Alloca = llvm::dyn_cast<InstAlloca>(&Instr)) { |
| 610 uint32_t AlignmentParam = Alloca->getAlignInBytes(); | 612 uint32_t AlignmentParam = Alloca->getAlignInBytes(); |
| 611 if (AlignmentParam > StackAlignment) | 613 if (AlignmentParam > StackAlignment) |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 } | 1167 } |
| 1166 } | 1168 } |
| 1167 // Print each basic block | 1169 // Print each basic block |
| 1168 for (CfgNode *Node : Nodes) | 1170 for (CfgNode *Node : Nodes) |
| 1169 Node->dump(this); | 1171 Node->dump(this); |
| 1170 if (isVerbose(IceV_Instructions)) | 1172 if (isVerbose(IceV_Instructions)) |
| 1171 Str << "}\n"; | 1173 Str << "}\n"; |
| 1172 } | 1174 } |
| 1173 | 1175 |
| 1174 } // end of namespace Ice | 1176 } // end of namespace Ice |
| OLD | NEW |