Lines Matching defs:block

70    /* If they're in the same block, we can rely on whichever instruction
71 * comes first in the block.
73 if (a->parent_instr->block == b->parent_instr->block)
77 return a->parent_instr->block->dom_pre_index >
78 b->parent_instr->block->dom_pre_index;
90 } else if (a->parent_instr->block == b->parent_instr->block) {
93 return nir_block_dominates(a->parent_instr->block,
94 b->parent_instr->block);
304 add_parallel_copy_to_end_of_block(nir_shader *shader, nir_block *block, void *dead_ctx)
307 if (block->successors[0]) {
308 nir_instr *instr = nir_block_first_instr(block->successors[0]);
313 if (block->successors[1]) {
314 nir_instr *instr = nir_block_first_instr(block->successors[1]);
321 * create a parallel copy at the end of the block but before the jump
327 nir_instr_insert(nir_after_block_before_jump(block), &pcopy->instr);
334 get_parallel_copy_at_end_of_block(nir_block *block)
336 nir_instr *last_instr = nir_block_last_instr(block);
356 * copies to the beginnings and ends of basic blocks. For every block with
359 * values. We also add a parallel copy to the end of every block that has
368 * the predecessor block, the sources of phi nodes are are the only use of
381 isolate_phi_nodes_block(nir_shader *shader, nir_block *block, void *dead_ctx)
384 nir_foreach_instr(instr, block) {
385 /* Phi nodes only ever come at the start of a block */
397 * start of this block but after the phi nodes.
403 nir_foreach_instr(instr, block) {
404 /* Phi nodes only ever come at the start of a block */
452 coalesce_phi_nodes_block(nir_block *block, struct from_ssa_state *state)
454 nir_foreach_instr(instr, block) {
455 /* Phi nodes only ever come at the start of a block */
514 aggressive_coalesce_block(nir_block *block, struct from_ssa_state *state)
517 nir_foreach_instr(instr, block) {
518 /* Phi nodes only ever come at the start of a block */
532 get_parallel_copy_at_end_of_block(block);
617 resolve_registers_block(nir_block *block, struct from_ssa_state *state)
619 nir_foreach_instr_safe(instr, block) {
838 /* Resolves the parallel copies in a block. Each block can have at most
843 resolve_parallel_copies_block(nir_block *block, struct from_ssa_state *state)
846 * copy existed right after the phi nodes in this block, it is now the
849 nir_instr *first_instr = nir_block_first_instr(block);
865 get_parallel_copy_at_end_of_block(block);
886 nir_foreach_block(block, impl) {
887 add_parallel_copy_to_end_of_block(shader, block, state.dead_ctx);
890 nir_foreach_block(block, impl) {
891 isolate_phi_nodes_block(shader, block, state.dead_ctx);
902 nir_foreach_block(block, impl) {
903 coalesce_phi_nodes_block(block, &state);
906 nir_foreach_block(block, impl) {
907 aggressive_coalesce_block(block, &state);
910 nir_foreach_block(block, impl) {
911 resolve_registers_block(block, &state);
914 nir_foreach_block(block, impl) {
915 resolve_parallel_copies_block(block, &state);
944 nir_ssa_def *def, nir_block *block, struct set *visited_blocks)
947 if (_mesa_set_search(visited_blocks, block) == NULL) {
950 set_foreach(block->predecessors, entry) {
959 /* All predecessors of this block have exactly one successor and it
960 * is this block so they must eventually lead here without
962 * instead of this block.
964 _mesa_set_add(visited_blocks, block);
966 set_foreach(block->predecessors, entry) {
973 b->cursor = nir_after_block_before_jump(block);
977 /** Lower all of the phi nodes in a block to movs to and from a register
980 * single block to convert all of its phis to a register and some movs.
986 * 1. For each phi instruction in the block, create a new nir_register
988 * 2. Insert movs at the top of the destination block for each phi and
991 * 3. For each phi source, insert movs in the predecessor block from the phi
997 * temporary for each phi, all movs inserted in any particular block have
1007 nir_lower_phis_to_regs_block(nir_block *block)
1010 nir_builder_init(&b, nir_cf_node_get_function(&block->cf_node));
1015 nir_foreach_instr_safe(instr, block) {
1031 _mesa_set_add(visited_blocks, src->src.ssa->parent_instr->block);
1082 nir_block *block = def->parent_instr->block;
1084 if (use_src->parent_instr->block != block ||
1096 /** Lower all of the SSA defs in a block to registers
1099 * defs in the given block with registers. If not used carefully, this may
1104 nir_lower_ssa_defs_to_regs_block(nir_block *block)
1106 nir_function_impl *impl = nir_cf_node_get_function(&block->cf_node);
1114 nir_foreach_instr(instr, block) {
1132 /* If the SSA def produced by this instruction is only in the block