Lines Matching refs:instr
71 /* Flags used in the instr->pass_flags field for various instruction states */
82 nir_instr *instr;
107 nir_foreach_instr(instr, block) {
249 nir_instr *instr = &intrin->instr;
252 instr->pass_flags = GCM_INSTR_PINNED;
256 instr->pass_flags = 0;
275 instr->pass_flags = GCM_INSTR_PINNED;
278 instr->pass_flags = GCM_INSTR_PINNED;
287 instr->pass_flags = GCM_INSTR_PINNED;
292 instr->pass_flags = GCM_INSTR_PINNED;
302 * This function also serves to initialize the instr->pass_flags field.
312 nir_foreach_instr_safe(instr, block) {
314 instr->index = state->num_instrs++;
316 switch (instr->type) {
318 switch (nir_instr_as_alu(instr)->op) {
326 instr->pass_flags = GCM_INSTR_SCHEDULE_EARLIER_ONLY;
330 if (!is_src_scalarizable(&(nir_instr_as_alu(instr)->src[0].src))) {
331 instr->pass_flags = GCM_INSTR_PINNED;
337 instr->pass_flags = 0;
343 nir_tex_instr *tex = nir_instr_as_tex(instr);
345 instr->pass_flags = GCM_INSTR_SCHEDULE_EARLIER_ONLY;
352 instr->pass_flags = GCM_INSTR_PINNED;
356 instr->pass_flags = GCM_INSTR_PINNED;
361 instr->pass_flags = GCM_INSTR_PINNED;
366 instr->pass_flags = GCM_INSTR_PINNED;
377 instr->pass_flags = 0;
381 pin_intrinsic(nir_instr_as_intrinsic(instr));
385 instr->pass_flags = GCM_INSTR_PINNED;
391 instr->pass_flags = GCM_INSTR_PLACED;
398 if (!(instr->pass_flags & GCM_INSTR_PLACED)) {
410 exec_node_remove(&instr->node);
411 exec_list_push_tail(&state->instrs, &instr->node);
418 gcm_schedule_early_instr(nir_instr *instr, struct gcm_state *state);
431 nir_instr *instr = state->instr;
446 struct gcm_instr_info *info = &state->instr_infos[instr->index];
455 state->instr = instr;
469 gcm_schedule_early_instr(nir_instr *instr, struct gcm_state *state)
471 if (instr->pass_flags & GCM_INSTR_SCHEDULED_EARLY)
474 instr->pass_flags |= GCM_INSTR_SCHEDULED_EARLY;
480 if (instr->pass_flags & GCM_INSTR_PINNED ||
481 instr->pass_flags & GCM_INSTR_PLACED) {
482 state->instr_infos[instr->index].early_block = instr->block;
489 state->instr_infos[instr->index].early_block = nir_start_block(state->impl);
490 state->instr = instr;
492 nir_foreach_src(instr, gcm_schedule_early_src, state);
496 set_block_for_loop_instr(struct gcm_state *state, nir_instr *instr,
502 nir_loop *loop = state->blocks[instr->block->index].loop;
506 if (nir_block_dominates(instr->block, block))
531 if (state->blocks[instr->block->index].loop_instr_count < MAX_LOOP_INSTRUCTIONS)
534 if (instr->type == nir_instr_type_load_const ||
535 instr->type == nir_instr_type_tex)
542 set_block_to_if_block(struct gcm_state *state, nir_instr *instr,
545 if (instr->type == nir_instr_type_load_const)
556 gcm_choose_block_for_instr(nir_instr *instr, nir_block *early_block,
567 state->blocks[instr->block->index].loop_depth)
572 set_block_to_if_block(state, instr, block)) {
580 if (block == instr->block)
582 } else if (block == instr->block) {
599 if (set_block_for_loop_instr(state, instr, block)) {
601 } else if (block == instr->block) {
616 gcm_schedule_late_instr(nir_instr *instr, struct gcm_state *state);
706 * are "scheduled" by updating their instr->block field.
715 gcm_schedule_late_instr(nir_instr *instr, struct gcm_state *state)
717 if (instr->pass_flags & GCM_INSTR_SCHEDULED_LATE)
720 instr->pass_flags |= GCM_INSTR_SCHEDULED_LATE;
726 if (instr->pass_flags & GCM_INSTR_PLACED ||
727 instr->pass_flags & GCM_INSTR_PINNED)
730 nir_foreach_ssa_def(instr, gcm_schedule_late_def, state);
744 nir_instr_insert(nir_before_cf_list(&state->impl->body), &undef->instr);
762 gcm_place_instr(nir_instr *instr, struct gcm_state *state)
764 if (instr->pass_flags & GCM_INSTR_PLACED)
767 instr->pass_flags |= GCM_INSTR_PLACED;
769 if (instr->block == NULL) {
770 nir_foreach_ssa_def(instr, gcm_replace_def_with_undef, state);
771 nir_instr_remove(instr);
775 struct gcm_block_info *block_info = &state->blocks[instr->block->index];
776 exec_node_remove(&instr->node);
780 &instr->node);
783 nir_instr *jump_instr = nir_block_last_instr(instr->block);
785 exec_node_insert_node_before(&jump_instr->node, &instr->node);
787 exec_list_push_tail(&instr->block->instr_list, &instr->node);
791 block_info->last_instr = instr;
805 nir_foreach_instr(instr, block)
806 instr->pass_flags = 0;
811 state.instr = NULL;
825 foreach_list_typed_safe(nir_instr, instr, node, &state.instrs) {
826 if (instr->pass_flags & GCM_INSTR_PINNED)
829 if (nir_instr_set_add_or_rewrite(gvn_set, instr, NULL))
835 foreach_list_typed(nir_instr, instr, node, &state.instrs)
836 gcm_schedule_early_instr(instr, &state);
838 foreach_list_typed(nir_instr, instr, node, &state.instrs)
839 gcm_schedule_late_instr(instr, &state);
842 nir_instr *instr = exec_node_data(nir_instr,
844 gcm_place_instr(instr, &state);