Lines Matching refs:Blocks
161 // Sorts the CFGs blocks using a reverse post-order depth-first traversal.
162 // Each block will be written into the Blocks array in order, and its BlockID
164 // block, and ID should be the total number of blocks.
165 unsigned BasicBlock::topologicalSort(SimpleArray<BasicBlock *> &Blocks,
170 ID = Block->topologicalSort(Blocks, ID);
172 // We may lose pointers to unreachable blocks.
175 Blocks[BlockID] = this;
181 // which guarantees that all blocks are serialized after their dominator and
187 // and no blocks are accessible via traversal of back-edges from the exit that
189 unsigned BasicBlock::topologicalFinalSort(SimpleArray<BasicBlock *> &Blocks,
196 ID = DominatorNode.Parent->topologicalFinalSort(Blocks, ID);
198 ID = Pred->topologicalFinalSort(Blocks, ID);
199 assert(static_cast<size_t>(ID) < Blocks.size());
201 Blocks[BlockID] = this;
259 // Renumber instructions in all blocks
262 for (auto *Block : Blocks)
287 // 1) Removing unreachable blocks.
289 // 3) Topologically sorting the blocks into the "Blocks" array.
291 // Topologically sort the blocks starting from the entry block.
292 unsigned NumUnreachableBlocks = Entry->topologicalSort(Blocks, Blocks.size());
294 // If there were unreachable blocks shift everything down, and delete them.
295 for (unsigned I = NumUnreachableBlocks, E = Blocks.size(); I < E; ++I) {
297 Blocks[NI] = Blocks[I];
298 Blocks[NI]->BlockID = NI;
299 // FIXME: clean up predecessor pointers to unreachable blocks?
301 Blocks.drop(NumUnreachableBlocks);
305 for (auto *Block : Blocks)
309 unsigned NumBlocks = Exit->topologicalFinalSort(Blocks, 0);
310 assert(static_cast<size_t>(NumBlocks) == Blocks.size());
318 for (auto *Block : Blocks.reverse()) {
324 for (auto *Block : Blocks) {
329 for (auto *Block : Blocks.reverse()) {