Lines Matching refs:instr
79 nir_instr *instr; member
104 nir_foreach_instr(instr, block) { in get_loop_instr_count()
243 nir_instr *instr = &intrin->instr; in pin_intrinsic() local
246 instr->pass_flags = GCM_INSTR_PINNED; in pin_intrinsic()
250 instr->pass_flags = 0; in pin_intrinsic()
269 instr->pass_flags = GCM_INSTR_PINNED; in pin_intrinsic()
272 instr->pass_flags = GCM_INSTR_PINNED; in pin_intrinsic()
281 instr->pass_flags = GCM_INSTR_PINNED; in pin_intrinsic()
286 instr->pass_flags = GCM_INSTR_PINNED; in pin_intrinsic()
306 nir_foreach_instr_safe(instr, block) { in gcm_pin_instructions()
308 instr->index = state->num_instrs++; in gcm_pin_instructions()
310 switch (instr->type) { in gcm_pin_instructions()
312 switch (nir_instr_as_alu(instr)->op) { in gcm_pin_instructions()
320 instr->pass_flags = GCM_INSTR_SCHEDULE_EARLIER_ONLY; in gcm_pin_instructions()
324 if (!is_src_scalarizable(&(nir_instr_as_alu(instr)->src[0].src))) { in gcm_pin_instructions()
325 instr->pass_flags = GCM_INSTR_PINNED; in gcm_pin_instructions()
331 instr->pass_flags = 0; in gcm_pin_instructions()
337 nir_tex_instr *tex = nir_instr_as_tex(instr); in gcm_pin_instructions()
339 instr->pass_flags = GCM_INSTR_SCHEDULE_EARLIER_ONLY; in gcm_pin_instructions()
346 instr->pass_flags = GCM_INSTR_PINNED; in gcm_pin_instructions()
350 instr->pass_flags = GCM_INSTR_PINNED; in gcm_pin_instructions()
355 instr->pass_flags = GCM_INSTR_PINNED; in gcm_pin_instructions()
360 instr->pass_flags = GCM_INSTR_PINNED; in gcm_pin_instructions()
371 instr->pass_flags = 0; in gcm_pin_instructions()
375 pin_intrinsic(nir_instr_as_intrinsic(instr)); in gcm_pin_instructions()
381 instr->pass_flags = GCM_INSTR_PLACED; in gcm_pin_instructions()
388 if (!(instr->pass_flags & GCM_INSTR_PLACED)) { in gcm_pin_instructions()
400 exec_node_remove(&instr->node); in gcm_pin_instructions()
401 exec_list_push_tail(&state->instrs, &instr->node); in gcm_pin_instructions()
408 gcm_schedule_early_instr(nir_instr *instr, struct gcm_state *state);
421 nir_instr *instr = state->instr; in gcm_schedule_early_src() local
436 struct gcm_instr_info *info = &state->instr_infos[instr->index]; in gcm_schedule_early_src()
445 state->instr = instr; in gcm_schedule_early_src()
459 gcm_schedule_early_instr(nir_instr *instr, struct gcm_state *state) in gcm_schedule_early_instr() argument
461 if (instr->pass_flags & GCM_INSTR_SCHEDULED_EARLY) in gcm_schedule_early_instr()
464 instr->pass_flags |= GCM_INSTR_SCHEDULED_EARLY; in gcm_schedule_early_instr()
470 if (instr->pass_flags & GCM_INSTR_PINNED || in gcm_schedule_early_instr()
471 instr->pass_flags & GCM_INSTR_PLACED) { in gcm_schedule_early_instr()
472 state->instr_infos[instr->index].early_block = instr->block; in gcm_schedule_early_instr()
479 state->instr_infos[instr->index].early_block = nir_start_block(state->impl); in gcm_schedule_early_instr()
480 state->instr = instr; in gcm_schedule_early_instr()
482 nir_foreach_src(instr, gcm_schedule_early_src, state); in gcm_schedule_early_instr()
486 set_block_for_loop_instr(struct gcm_state *state, nir_instr *instr, in set_block_for_loop_instr() argument
492 nir_loop *loop = state->blocks[instr->block->index].loop; in set_block_for_loop_instr()
496 if (nir_block_dominates(instr->block, block)) in set_block_for_loop_instr()
521 if (state->blocks[instr->block->index].loop_instr_count < MAX_LOOP_INSTRUCTIONS) in set_block_for_loop_instr()
524 if (instr->type == nir_instr_type_load_const || in set_block_for_loop_instr()
525 instr->type == nir_instr_type_tex) in set_block_for_loop_instr()
532 gcm_choose_block_for_instr(nir_instr *instr, nir_block *early_block, in gcm_choose_block_for_instr() argument
541 set_block_for_loop_instr(state, instr, block)) in gcm_choose_block_for_instr()
543 else if (block == instr->block) in gcm_choose_block_for_instr()
554 gcm_schedule_late_instr(nir_instr *instr, struct gcm_state *state);
653 gcm_schedule_late_instr(nir_instr *instr, struct gcm_state *state) in gcm_schedule_late_instr() argument
655 if (instr->pass_flags & GCM_INSTR_SCHEDULED_LATE) in gcm_schedule_late_instr()
658 instr->pass_flags |= GCM_INSTR_SCHEDULED_LATE; in gcm_schedule_late_instr()
664 if (instr->pass_flags & GCM_INSTR_PLACED || in gcm_schedule_late_instr()
665 instr->pass_flags & GCM_INSTR_PINNED) in gcm_schedule_late_instr()
668 nir_foreach_ssa_def(instr, gcm_schedule_late_def, state); in gcm_schedule_late_instr()
682 nir_instr_insert(nir_before_cf_list(&state->impl->body), &undef->instr); in gcm_replace_def_with_undef()
700 gcm_place_instr(nir_instr *instr, struct gcm_state *state) in gcm_place_instr() argument
702 if (instr->pass_flags & GCM_INSTR_PLACED) in gcm_place_instr()
705 instr->pass_flags |= GCM_INSTR_PLACED; in gcm_place_instr()
707 if (instr->block == NULL) { in gcm_place_instr()
708 nir_foreach_ssa_def(instr, gcm_replace_def_with_undef, state); in gcm_place_instr()
709 nir_instr_remove(instr); in gcm_place_instr()
713 struct gcm_block_info *block_info = &state->blocks[instr->block->index]; in gcm_place_instr()
714 exec_node_remove(&instr->node); in gcm_place_instr()
718 &instr->node); in gcm_place_instr()
721 nir_instr *jump_instr = nir_block_last_instr(instr->block); in gcm_place_instr()
723 exec_node_insert_node_before(&jump_instr->node, &instr->node); in gcm_place_instr()
725 exec_list_push_tail(&instr->block->instr_list, &instr->node); in gcm_place_instr()
729 block_info->last_instr = instr; in gcm_place_instr()
742 nir_foreach_instr(instr, block) in opt_gcm_impl()
743 instr->pass_flags = 0; in opt_gcm_impl()
748 state.instr = NULL; in opt_gcm_impl()
762 foreach_list_typed_safe(nir_instr, instr, node, &state.instrs) { in opt_gcm_impl()
763 if (instr->pass_flags & GCM_INSTR_PINNED) in opt_gcm_impl()
766 if (nir_instr_set_add_or_rewrite(gvn_set, instr, NULL)) in opt_gcm_impl()
772 foreach_list_typed(nir_instr, instr, node, &state.instrs) in opt_gcm_impl()
773 gcm_schedule_early_instr(instr, &state); in opt_gcm_impl()
775 foreach_list_typed(nir_instr, instr, node, &state.instrs) in opt_gcm_impl()
776 gcm_schedule_late_instr(instr, &state); in opt_gcm_impl()
779 nir_instr *instr = exec_node_data(nir_instr, in opt_gcm_impl() local
781 gcm_place_instr(instr, &state); in opt_gcm_impl()