Lines Matching refs:blocks
69 ir_block *blocks, *bb; in ir_build_cfg() local
176 blocks = ir_mem_malloc((bb_count + 1) * sizeof(ir_block)); in ir_build_cfg()
178 bb = blocks + 1; in ir_build_cfg()
237 bb = blocks + 1; in ir_build_cfg()
247 ir_block *pred_bb = &blocks[pred_b]; in ir_build_cfg()
257 ir_block *pred_bb = &blocks[pred_b]; in ir_build_cfg()
265 ctx->cfg_blocks = blocks; in ir_build_cfg()
280 bb = &blocks[b]; in ir_build_cfg()
531 ir_block *blocks, *bb;
541 blocks = ctx->cfg_blocks;
544 blocks[1].idom = 1;
548 for (b = 2, bb = &blocks[2]; b <= blocks_count; b++, bb++) {
553 if (blocks[pred_b].idom <= 0) {
566 ir_block *pred_bb = &blocks[pred_b];
571 idom_bb = &blocks[idom];
575 pred_bb = &blocks[pred_b];
580 pred_bb = &blocks[pred_b];
584 idom_bb = &blocks[idom];
601 blocks[1].idom = 0;
602 blocks[1].dom_depth = 0;
605 for (b = 2, bb = &blocks[2]; b <= blocks_count; b++, bb++) {
608 ir_block *idom_bb = &blocks[bb->idom];
619 ir_block *child_bb = &blocks[child];
623 child_bb = &blocks[child];
641 ir_block *blocks, *bb; in ir_build_dominators_tree() local
650 blocks = ctx->cfg_blocks; in ir_build_dominators_tree()
653 blocks[1].idom = 1; in ir_build_dominators_tree()
654 blocks[1].dom_depth = 0; in ir_build_dominators_tree()
657 for (b = 2, bb = &blocks[2]; b <= blocks_count; b++, bb++) { in ir_build_dominators_tree()
681 IR_ASSERT(blocks[idom].idom > 0); in ir_build_dominators_tree()
688 IR_ASSERT(blocks[pred_b].idom > 0); in ir_build_dominators_tree()
691 pred_b = blocks[pred_b].idom; in ir_build_dominators_tree()
694 idom = blocks[idom].idom; in ir_build_dominators_tree()
704 idom_bb = &blocks[idom]; in ir_build_dominators_tree()
715 ir_block *child_bb = &blocks[child]; in ir_build_dominators_tree()
719 child_bb = &blocks[child]; in ir_build_dominators_tree()
726 blocks[1].idom = 0; in ir_build_dominators_tree()
736 bb = &blocks[b]; in ir_build_dominators_tree()
741 if (blocks[succ_b].flags & IR_BB_ENTRY) { in ir_build_dominators_tree()
744 IR_ASSERT(blocks[ctx->cfg_edges[bb->successors + 1]].flags & IR_BB_ENTRY); in ir_build_dominators_tree()
747 dom_depth = blocks[succ_b].dom_depth;; in ir_build_dominators_tree()
750 bb = &blocks[b]; in ir_build_dominators_tree()
773 ir_block *blocks, *bb; in ir_build_dominators_tree_iterative() local
777 blocks = ctx->cfg_blocks; in ir_build_dominators_tree_iterative()
782 for (b = 0, bb = &blocks[0]; b <= blocks_count; b++, bb++) { in ir_build_dominators_tree_iterative()
789 blocks[1].idom = 1; in ir_build_dominators_tree_iterative()
793 for (b = 2, bb = &blocks[2]; b <= blocks_count; b++, bb++) { in ir_build_dominators_tree_iterative()
800 if (blocks[idom].idom == 0) { in ir_build_dominators_tree_iterative()
805 if (blocks[idom].idom > 0) { in ir_build_dominators_tree_iterative()
815 if (blocks[pred_b].idom > 0) { in ir_build_dominators_tree_iterative()
816 IR_ASSERT(blocks[pred_b].idom > 0); in ir_build_dominators_tree_iterative()
819 pred_b = blocks[pred_b].idom; in ir_build_dominators_tree_iterative()
822 idom = blocks[idom].idom; in ir_build_dominators_tree_iterative()
835 blocks[1].idom = 0; in ir_build_dominators_tree_iterative()
836 blocks[1].dom_depth = 0; in ir_build_dominators_tree_iterative()
837 for (b = 2, bb = &blocks[2]; b <= blocks_count; b++, bb++) { in ir_build_dominators_tree_iterative()
839 ir_block *idom_bb = &blocks[idom]; in ir_build_dominators_tree_iterative()
850 ir_block *child_bb = &blocks[child]; in ir_build_dominators_tree_iterative()
854 child_bb = &blocks[child]; in ir_build_dominators_tree_iterative()
865 static bool ir_dominates(const ir_block *blocks, uint32_t b1, uint32_t b2) in ir_dominates() argument
867 uint32_t b1_depth = blocks[b1].dom_depth; in ir_dominates()
868 const ir_block *bb2 = &blocks[b2]; in ir_dominates()
872 bb2 = &blocks[b2]; in ir_dominates()
881 ir_block *blocks = ctx->cfg_blocks; in ir_find_loops() local
910 bb = &blocks[i]; in ir_find_loops()
911 for (child = bb->dom_child; child > 0; child = blocks[child].dom_next_child) { in ir_find_loops()
923 if (blocks[succ].idom == i) { in ir_find_loops()
943 …for (child = blocks[sorted_blocks[i]].dom_child; child > 0; child = blocks[child].dom_next_child) { in ir_find_loops()
953 ir_block *bb = &blocks[i]; in ir_find_loops()
968 if (ir_dominates(blocks, i, pred)) { in ir_find_loops()
972 blocks[pred].loop_header = 0; /* support for merged loops */ in ir_find_loops()
998 while (blocks[j].loop_header > 0) { in ir_find_loops()
999 j = blocks[j].loop_header; in ir_find_loops()
1002 ir_block *bb = &blocks[j]; in ir_find_loops()
1025 ir_block *bb = &blocks[i]; in ir_find_loops()
1027 ir_block *loop = &blocks[bb->loop_header]; in ir_find_loops()
1038 bb = &blocks[loop->loop_header]; in ir_find_loops()
1047 bb = &blocks[loop->loop_header]; in ir_find_loops()
1675 ir_bitqueue blocks; in ir_schedule_blocks_top_down() local
1682 ir_bitqueue_init(&blocks, ctx->cfg_blocks_count + 1); in ir_schedule_blocks_top_down()
1683 blocks.pos = 0; in ir_schedule_blocks_top_down()
1688 ir_bitset_incl(blocks.set, b); in ir_schedule_blocks_top_down()
1691 while ((b = ir_bitqueue_pop(&blocks)) != (uint32_t)-1) { in ir_schedule_blocks_top_down()
1696 if (UNEXPECTED(bb->flags & IR_BB_PREV_EMPTY_ENTRY) && ir_bitqueue_in(&blocks, b - 1)) { in ir_schedule_blocks_top_down()
1700 ir_bitqueue_del(&blocks, predecessor); in ir_schedule_blocks_top_down()
1716 if (ir_bitqueue_in(&blocks, best_successor)) { in ir_schedule_blocks_top_down()
1726 if (ir_bitqueue_in(&blocks, successor)) { in ir_schedule_blocks_top_down()
1773 if (!ir_bitqueue_in(&blocks, b)) { in ir_schedule_blocks_top_down()
1776 if (ir_bitqueue_in(&blocks, b)) { in ir_schedule_blocks_top_down()
1778 ir_bitqueue_del(&blocks, b); in ir_schedule_blocks_top_down()
1788 ir_bitqueue_del(&blocks, b); in ir_schedule_blocks_top_down()
1794 ir_bitqueue_free(&blocks); in ir_schedule_blocks_top_down()