Lines Matching defs:block
98 // Parameters and OSR values are always fixed to the start block.
144 BasicBlock* block = schedule_->block(control);
145 schedule_->AddNode(block, node);
268 ConnectBlocks(*i); // Connect block to its predecessor/successors.
274 // control flow graph at the bottom of {block}.
275 void Run(BasicBlock* block, Node* exit) {
280 component_start_ = block;
281 component_end_ = schedule_->block(exit);
305 ConnectBlocks(*i); // Connect block to its predecessor/successors.
313 void FixNode(BasicBlock* block, Node* node) {
314 schedule_->AddNode(block, node);
343 BasicBlock* block = BuildBlockForNode(loop);
344 FixNode(block, node);
411 BasicBlock* block = schedule_->block(node);
412 if (block == nullptr) {
413 block = schedule_->NewBasicBlock();
414 TRACE("Create block id:%d for #%d:%s\n", block->id().ToInt(), node->id(),
416 FixNode(block, node);
418 return block;
435 successor_blocks[index] = schedule_->block(successors[index]);
442 predecessor_block = schedule_->block(node);
563 BasicBlock* block = schedule_->block(merge);
564 DCHECK_NOT_NULL(block);
566 // merge's basic block.
569 TraceConnect(merge, predecessor_block, block);
570 schedule_->AddGoto(predecessor_block, block);
602 void TraceConnect(Node* node, BasicBlock* block, BasicBlock* succ) {
603 DCHECK_NOT_NULL(block);
606 node->op()->mnemonic(), block->id().ToInt());
609 node->op()->mnemonic(), block->id().ToInt(), succ->id().ToInt());
637 BasicBlock* component_start_; // Component single-entry block.
638 BasicBlock* component_end_; // Component single-exit block.
653 // Initialize per-block data.
664 // Compute the special reverse-post-order block ordering, which is essentially
666 // 1. If block A is a predecessor of B, then A appears before B in the order,
669 // => If block A dominates block B, then A appears before B in the order.
670 // => If block A is a loop header, A appears before all blocks in the loop
723 const ZoneVector<BasicBlock*>& GetOutgoingBlocks(BasicBlock* block) {
724 if (HasLoopNumber(block)) {
725 LoopInfo const& loop = loops_[GetLoopNumber(block)];
736 // Numbering for BasicBlock::rpo_number for this block traversal:
744 BasicBlock* block;
756 void AddOutgoing(Zone* zone, BasicBlock* block) {
760 outgoing->push_back(block);
766 stack_[depth].block = child;
774 BasicBlock* PushFront(BasicBlock* head, BasicBlock* block) {
775 block->set_rpo_next(head);
776 return block;
779 static int GetLoopNumber(BasicBlock* block) { return block->loop_number(); }
780 static void SetLoopNumber(BasicBlock* block, int loop_number) {
781 return block->set_loop_number(loop_number);
783 static bool HasLoopNumber(BasicBlock* block) {
784 return block->loop_number() >= 0;
788 // end block in actual control flow (e.g. with end having successors).
821 if (frame->block != end &&
822 frame->index < frame->block->SuccessorCount()) {
824 BasicBlock* succ = frame->block->SuccessorAt(frame->index++);
828 backedges_.push_back(Backedge(frame->block, frame->index - 1));
839 // Finished with all successors; pop the stack and add the block.
840 order = PushFront(order, frame->block);
841 frame->block->set_rpo_number(kBlockVisited1);
858 // edges that lead out of loops. Visits each block once, but linking loop
864 BasicBlock* block = frame->block;
867 if (block != end && frame->index < block->SuccessorCount()) {
869 succ = block->SuccessorAt(frame->index++);
870 } else if (HasLoopNumber(block)) {
872 if (block->rpo_number() == kBlockOnStack) {
875 DCHECK(loop != nullptr && loop->header == block);
876 loop->start = PushFront(order, block);
878 block->set_rpo_number(kBlockVisited2);
887 size_t outgoing_index = frame->index - block->SuccessorCount();
888 LoopInfo* info = &loops_[GetLoopNumber(block)];
890 if (block != entry && info->outgoing != nullptr &&
919 // Finished with all successors of the current block.
920 if (HasLoopNumber(block)) {
922 LoopInfo* info = &loops_[GetLoopNumber(block)];
933 order = PushFront(order, block);
934 block->set_rpo_number(kBlockVisited2);
1023 (*queue)[queue_length++].block = member;
1029 BasicBlock* block = (*queue)[--queue_length].block;
1030 for (size_t j = 0; j < block->PredecessorCount(); j++) {
1031 BasicBlock* pred = block->PredecessorAt(j);
1035 (*queue)[queue_length++].block = pred;
1057 for (BasicBlock* block = order_; block != nullptr;
1058 block = block->rpo_next()) {
1059 os << std::setw(5) << "B" << block->rpo_number() << ":";
1061 bool range = loops_[i].header->LoopContains(block);
1062 bool membership = loops_[i].header != block && range;
1066 os << " id:" << block->id() << ": ";
1067 if (block->loop_end() != nullptr) {
1068 os << " range: [B" << block->rpo_number() << ", B"
1069 << block->loop_end()->rpo_number() << ")";
1071 if (block->loop_header() != nullptr) {
1072 os << " header: id:" << block->loop_header()->id();
1074 if (block->loop_depth() > 0) {
1075 os << " depth: " << block->loop_depth();
1101 BasicBlock* block = loop->start;
1102 DCHECK_EQ(header, block);
1105 if (block == nullptr || block == loop->end) {
1106 end_found = (loop->end == block);
1110 DCHECK(block->rpo_number() == links + header->rpo_number());
1112 block = block->rpo_next();
1129 block = order->at(j);
1130 DCHECK_EQ(block->rpo_number(), j);
1132 DCHECK(!header->LoopContains(block));
1134 DCHECK(header->LoopContains(block));
1135 DCHECK_GE(block->loop_depth(), loop_depth);
1262 void Scheduler::PropagateImmediateDominators(BasicBlock* block) {
1263 for (/*nop*/; block != nullptr; block = block->rpo_next()) {
1264 auto pred = block->predecessors().begin();
1265 auto end = block->predecessors().end();
1290 block->set_dominator(dominator);
1291 block->set_dominator_depth(dominator->dominator_depth() + 1);
1292 block->set_deferred(deferred | block->deferred());
1293 TRACE("Block id:%d's idom is id:%d, depth = %d\n", block->id().ToInt(),
1294 dominator->id().ToInt(), block->dominator_depth());
1299 // Seed start block to be the first dominator.
1302 // Build the block dominator tree resulting from the above seed.
1345 BasicBlock* block =
1348 : schedule_->block(NodeProperties::GetControlInput(node));
1349 DCHECK_NOT_NULL(block);
1350 schedule_->AddNode(block, node);
1427 data->minimum_block_ = schedule_->block(node);
1446 // Propagates {block} as another minimum position into the given {node}. This
1447 // has the net effect of computing the minimum dominator block of {node} that
1449 void PropagateMinimumPositionToNode(BasicBlock* block, Node* node) {
1458 PropagateMinimumPositionToNode(block, control);
1462 // current. Note that all inputs need to have minimum block position inside
1463 // the dominator chain of {node}'s minimum block position.
1464 DCHECK(InsideSameDominatorChain(block, data->minimum_block_));
1465 if (block->dominator_depth() > data->minimum_block_->dominator_depth()) {
1466 data->minimum_block_ = block;
1503 // Compute the minimum block for each node thereby determining the earliest
1562 // Determine the dominating block for all of the uses of this node. It is
1563 // the latest block that this node can be scheduled in.
1565 BasicBlock* block = GetCommonDominatorOfUses(node);
1566 DCHECK_NOT_NULL(block);
1568 // The schedule early block dominates the schedule late block.
1570 DCHECK_EQ(min_block, BasicBlock::GetCommonDominator(block, min_block));
1574 node->id(), node->op()->mnemonic(), block->id().ToInt(),
1575 block->loop_depth(), min_block->id().ToInt());
1580 BasicBlock* hoist_block = GetHoistBlock(block);
1585 TRACE(" hoisting #%d:%s to block id:%d\n", node->id(),
1587 DCHECK_LT(hoist_block->loop_depth(), block->loop_depth());
1588 block = hoist_block;
1593 // Split the {node} if beneficial and return the new {block} for it.
1594 block = SplitNode(block, node);
1599 ScheduleFloatingControl(block, node);
1601 ScheduleRegion(block, node);
1603 ScheduleNode(block, node);
1607 bool IsMarked(BasicBlock* block) const {
1608 DCHECK_LT(block->id().ToSize(), marked_.size());
1609 return marked_[block->id().ToSize()];
1612 void Mark(BasicBlock* block) { marked_[block->id().ToSize()] = true; }
1614 // Mark {block} and push its non-marked predecessor on the marking queue.
1615 void MarkBlock(BasicBlock* block) {
1616 DCHECK_LT(block->id().ToSize(), marked_.size());
1617 Mark(block);
1618 for (BasicBlock* pred_block : block->predecessors()) {
1624 BasicBlock* SplitNode(BasicBlock* block, Node* node) {
1626 if (!node->op()->HasProperty(Operator::kPure)) return block;
1628 if (node->opcode() == IrOpcode::kProjection) return block;
1630 // The {block} is common dominator of all uses of {node}, so we cannot
1631 // split anything unless the {block} has at least two successors.
1632 DCHECK_EQ(block, GetCommonDominatorOfUses(node));
1633 if (block->SuccessorCount() < 2) return block;
1640 // Check if the {node} has uses in {block}.
1645 if (use_block == block) {
1647 node->op()->mnemonic(), block->id().ToInt());
1649 return block;
1654 // Compute transitive marking closure; a block is marked if all its
1670 // If the (common dominator) {block} is marked, we know that all paths from
1671 // {block} to the end contain at least one use of {node}, and hence there's
1673 if (IsMarked(block)) {
1675 node->id(), node->op()->mnemonic(), block->id().ToInt());
1676 return block;
1695 block = use_block;
1698 node->op()->mnemonic(), block->id().ToInt());
1709 return block;
1712 BasicBlock* GetHoistBlock(BasicBlock* block) {
1714 if (block->IsLoopHeader()) return block->dominator();
1715 // We have to check to make sure that the {block} dominates all
1717 // out of the loop which does not execute this {block}, so we
1718 // can't hoist operations from this {block} out of the loop, as
1720 if (BasicBlock* header_block = block->loop_header()) {
1723 if (scheduler_->GetCommonDominator(block, outgoing_block) != block) {
1733 BasicBlock* block = nullptr;
1737 block = block == nullptr
1740 ? block
1741 : scheduler_->GetCommonDominator(block, use_block);
1743 return block;
1765 // predecessor block of the corresponding control input to the merge.
1776 // predecessor block of the current input to the merge.
1783 BasicBlock* result = schedule_->block(use);
1790 void ScheduleFloatingControl(BasicBlock* block, Node* node) {
1791 scheduler_->FuseFloatingControl(block, node);
1794 void ScheduleRegion(BasicBlock* block, Node* region_end) {
1801 ScheduleNode(block, region_end);
1814 ScheduleNode(block, node);
1819 ScheduleNode(block, node);
1822 void ScheduleNode(BasicBlock* block, Node* node) {
1823 schedule_->PlanNode(block, node);
1824 size_t block_id = block->id().ToSize();
1869 // Schedule: Places nodes in dominator block of all their uses.
1890 BasicBlock* block = schedule_->GetBlockById(id);
1893 schedule_->AddNode(block, node);
1903 void Scheduler::FuseFloatingControl(BasicBlock* block, Node* node) {
1910 control_flow_builder_->Run(block, node);
1913 special_rpo_->UpdateSpecialRPO(block, schedule_->block(node));
1915 for (BasicBlock* b = block->rpo_next(); b != nullptr; b = b->rpo_next()) {
1919 PropagateImmediateDominators(block->rpo_next());
1946 MovePlannedNodes(block, schedule_->block(node));