Lines Matching defs:block
59 * of the block. So, for example, a value that's defined in cycle 5 of the
60 * block and used 6 cycles later will always have a next_use_distance of 11
93 /* Map from SSA def to reg_or_immed it is mapped to at the end of the block.
95 * a record of the new live-out set for this block.
211 compute_block_next_distance(struct ra_spill_ctx *ctx, struct ir3_block *block,
214 struct ra_spill_block_state *state = &ctx->blocks[block->index];
219 foreach_instr_rev (instr, &block->instr_list) {
255 for (unsigned i = 0; i < block->predecessors_count; i++) {
256 const struct ir3_block *pred = block->predecessors[i];
264 bool loop_exit = pred->loop_depth < block->loop_depth;
277 foreach_instr (phi, &block->instr_list) {
311 foreach_block (block, &ir->block_list) {
312 struct ra_spill_block_state *state = &ctx->blocks[block->index];
314 foreach_instr (instr, &block->instr_list) {
328 foreach_block_rev (block, &ir->block_list) {
329 progress |= compute_block_next_distance(ctx, block, tmp_next_use);
350 struct ir3_block *block)
355 ir3_instr_create(block, reg->instr->opc, 1, reg->instr->srcs_count);
709 struct ir3_block *block)
711 struct ir3_instruction *mov = ir3_instr_create(block, OPC_MOV, 1, 1);
726 unsigned spill_slot, struct ir3_instruction *instr, struct ir3_block *block)
734 reg = materialize_pcopy_src(val, instr, block);
745 ir3_instr_create(block, OPC_SPILL_MACRO, 0, 3);
770 struct ir3_instruction *instr, struct ir3_block *block)
776 instr, block);
792 spill_interval(ctx, interval, instr, instr->block);
811 spill_interval(ctx, interval, instr, instr->block);
847 struct ir3_instruction *after, struct ir3_block *block)
857 ir3_instr_create(block, OPC_META_SPLIT, 1, 1);
872 struct ir3_instruction *after, struct ir3_block *block)
879 srcs[i] = split(parent_def, offset + i, after, block);
883 ir3_instr_create(block, OPC_META_COLLECT, 1, elems);
900 struct ir3_instruction *after, struct ir3_block *block)
909 ir3_instr_create(block, OPC_RELOAD_MACRO, 1, 3);
951 struct ir3_block *block)
963 reg_elems(child_reg), instr, block);
964 rewrite_src_interval(ctx, child, child_def, instr, block);
970 struct ir3_instruction *instr, struct ir3_block *block)
984 reg_elem_size(def), elems, instr, block);
991 dst = rematerialize(def, instr, block);
993 dst = reload(ctx, def, instr, block);
995 rewrite_src_interval(ctx, interval, dst, instr, block);
1005 reload_def(ctx, src->def, instr, instr->block);
1190 * successor block.
1312 handle_live_in(struct ra_spill_ctx *ctx, struct ir3_block *block,
1319 ctx->blocks[block->index].next_use_start[def->name];
1326 is_live_in_phi(struct ir3_register *def, struct ir3_block *block)
1328 return def->instr->opc == OPC_META_PHI && def->instr->block == block;
1333 struct ir3_block *block, unsigned pred_idx)
1335 struct ir3_block *pred = block->predecessors[pred_idx];
1337 if (is_live_in_phi(def, block)) {
1348 struct ir3_block *block, unsigned pred_idx)
1350 if (!is_live_in_phi(def, block))
1358 struct ir3_block *block, unsigned pred_idx)
1360 struct ir3_block *pred = block->predecessors[pred_idx];
1363 if (is_live_in_phi(def, block)) {
1378 struct ir3_block *block)
1380 for (unsigned i = 0; i < block->predecessors_count; i++) {
1381 if (!is_live_in_pred(ctx, def, block, i))
1390 struct ir3_block *block)
1392 for (unsigned i = 0; i < block->predecessors_count; i++) {
1393 struct ir3_block *pred = block->predecessors[i];
1399 struct reg_or_immed *pred_def = read_live_in(ctx, def, block, i);
1407 spill_live_ins(struct ra_spill_ctx *ctx, struct ir3_block *block)
1410 for (unsigned i = 0; i < block->predecessors_count; i++) {
1411 struct ir3_block *pred = block->predecessors[i];
1423 * TODO: Keep track of pressure in each block and preemptively spill
1432 is_live_in_all_preds(ctx, interval->interval.reg, block))
1436 spill_live_in(ctx, interval->interval.reg, block);
1447 is_live_in_all_preds(ctx, interval->interval.reg, block))
1449 spill_live_in(ctx, interval->interval.reg, block);
1461 struct ir3_block *block, unsigned pred_idx)
1463 struct ir3_block *pred = block->predecessors[pred_idx];
1466 if (is_live_in_phi(def, block)) {
1484 live_in_rewrite(ctx, child, child_val, block, pred_idx);
1490 struct ir3_block *block)
1493 for (unsigned i = 0; i < block->predecessors_count; i++) {
1494 struct ir3_block *pred = block->predecessors[i];
1499 if (is_live_in_undef(def, block, i))
1502 struct reg_or_immed *new_val = read_live_in(ctx, def, block, i);
1512 live_in_rewrite(ctx, interval, new_val, block, i);
1517 reload_live_ins(struct ra_spill_ctx *ctx, struct ir3_block *block)
1521 reload_live_in(ctx, interval->interval.reg, block);
1527 struct ir3_block *block)
1535 for (unsigned i = 0; i < block->predecessors_count; i++) {
1536 struct ir3_block *pred = block->predecessors[i];
1564 ir3_instr_create(block, OPC_META_PHI, 1, block->predecessors_count);
1575 for (unsigned i = 0; i < block->predecessors_count; i++) {
1576 struct ir3_block *pred = block->predecessors[i];
1596 ir3_instr_move_before_block(phi, block);
1599 /* When spilling a block with a single predecessors, the pred may have other
1607 struct ir3_block *block)
1610 BITSET_FOREACH_SET (name, ctx->live->live_in[block->index],
1614 struct reg_or_immed *val = read_live_in(ctx, reg, block, 0);
1624 struct ir3_block *block)
1631 for (unsigned i = 0; i < block->predecessors_count; i++) {
1632 struct ir3_block *pred = block->predecessors[i];
1652 struct ir3_block *block)
1658 spill(ctx, &interval->dst, get_spill_slot(ctx, def), NULL, block);
1663 spill_live_outs(struct ra_spill_ctx *ctx, struct ir3_block *block)
1665 struct ra_spill_block_state *state = &ctx->blocks[block->index];
1669 spill_live_out(ctx, interval, block);
1676 struct ir3_block *block)
1681 reload_def(ctx, def, NULL, block);
1685 reload_live_outs(struct ra_spill_ctx *ctx, struct ir3_block *block)
1687 struct ra_spill_block_state *state = &ctx->blocks[block->index];
1693 reload_live_out(ctx, reg, block);
1698 update_live_out_phis(struct ra_spill_ctx *ctx, struct ir3_block *block)
1700 assert(!block->successors[1]);
1701 struct ir3_block *succ = block->successors[0];
1702 unsigned pred_idx = ir3_block_get_pred_index(succ, block);
1722 struct ir3_block *block, unsigned pred_idx)
1724 struct ir3_block *pred = block->predecessors[pred_idx];
1728 if (is_live_in_phi(def, block)) {
1735 record_pred_live_out(ctx, child, block, pred_idx);
1740 record_pred_live_outs(struct ra_spill_ctx *ctx, struct ir3_block *block)
1742 for (unsigned i = 0; i < block->predecessors_count; i++) {
1743 struct ir3_block *pred = block->predecessors[i];
1754 record_pred_live_out(ctx, interval, block, i);
1777 record_live_outs(struct ra_spill_ctx *ctx, struct ir3_block *block)
1779 struct ra_spill_block_state *state = &ctx->blocks[block->index];
1789 handle_block(struct ra_spill_ctx *ctx, struct ir3_block *block)
1797 BITSET_FOREACH_SET (name, ctx->live->live_in[block->index],
1800 handle_live_in(ctx, block, reg);
1803 foreach_instr (instr, &block->instr_list) {
1811 if (block->predecessors_count == 1) {
1812 spill_single_pred_live_in(ctx, block);
1814 spill_live_ins(ctx, block);
1815 reload_live_ins(ctx, block);
1816 record_pred_live_outs(ctx, block);
1817 foreach_instr (instr, &block->instr_list) {
1820 rewrite_phi(ctx, instr, block);
1822 BITSET_FOREACH_SET (name, ctx->live->live_in[block->index],
1825 add_live_in_phi(ctx, reg, block);
1832 foreach_instr (instr, &block->instr_list) {
1847 if (ctx->spilling && block->successors[0]) {
1849 &ctx->blocks[block->successors[0]->index];
1851 assert(!block->successors[1]);
1853 spill_live_outs(ctx, block);
1854 reload_live_outs(ctx, block);
1855 update_live_out_phis(ctx, block);
1860 record_live_outs(ctx, block);
1861 ctx->blocks[block->index].visited = true;
1919 foreach_block (block, &ir->block_list) {
1920 foreach_instr (instr, &block->instr_list) {
1930 foreach_block (block, &ir->block_list) {
1931 foreach_instr (instr, &block->instr_list) {
1943 struct ir3_block *succ = block->successors[i];
1965 foreach_block (block, &ir->block_list) {
1966 foreach_instr (instr, &block->instr_list) {
1978 foreach_block (block, &ir->block_list) {
1979 foreach_instr_safe (instr, &block->instr_list) {
2031 foreach_block (block, &ir->block_list) {
2032 foreach_instr (instr, &block->instr_list) {
2040 foreach_block (block, &ir->block_list) {
2041 foreach_instr (instr, &block->instr_list) {
2068 foreach_block (block, &v->ir->block_list) {
2069 handle_block(ctx, block);
2104 foreach_block (block, &ir->block_list) {
2105 handle_block(ctx, block);