Lines Matching defs:state

133 gcm_build_block_info(struct exec_list *cf_list, struct gcm_state *state,
141 state->blocks[block->index].if_depth = if_depth;
142 state->blocks[block->index].loop_depth = loop_depth;
143 state->blocks[block->index].loop_instr_count = loop_instr_count;
144 state->blocks[block->index].loop = loop;
149 gcm_build_block_info(&if_stmt->then_list, state, loop, loop_depth,
151 gcm_build_block_info(&if_stmt->else_list, state, loop, loop_depth,
157 gcm_build_block_info(&loop->body, state, loop, loop_depth + 1, if_depth,
307 gcm_pin_instructions(nir_function_impl *impl, struct gcm_state *state)
309 state->num_instrs = 0;
314 instr->index = state->num_instrs++;
411 exec_list_push_tail(&state->instrs, &instr->node);
418 gcm_schedule_early_instr(nir_instr *instr, struct gcm_state *state);
430 struct gcm_state *state = void_state;
431 nir_instr *instr = state->instr;
445 &state->instr_infos[src->ssa->parent_instr->index];
446 struct gcm_instr_info *info = &state->instr_infos[instr->index];
450 /* We need to restore the state instruction because it may have been
455 state->instr = instr;
469 gcm_schedule_early_instr(nir_instr *instr, struct gcm_state *state)
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;
531 if (state->blocks[instr->block->index].loop_instr_count < MAX_LOOP_INSTRUCTIONS)
542 set_block_to_if_block(struct gcm_state *state, nir_instr *instr,
557 nir_block *late_block, struct gcm_state *state)
566 if (state->blocks[block->index].loop_depth >
567 state->blocks[instr->block->index].loop_depth)
570 if (state->blocks[block->index].if_depth >=
571 state->blocks[best->index].if_depth &&
572 set_block_to_if_block(state, instr, block)) {
597 if (state->blocks[block->index].loop_depth <
598 state->blocks[best->index].loop_depth) {
599 if (set_block_for_loop_instr(state, instr, block)) {
616 gcm_schedule_late_instr(nir_instr *instr, struct gcm_state *state);
628 struct gcm_state *state = void_state;
635 gcm_schedule_late_instr(use_instr, state);
669 state->instr_infos[def->parent_instr->index].early_block;
691 gcm_choose_block_for_instr(def->parent_instr, early_block, lca, state);
694 state->progress = true;
715 gcm_schedule_late_instr(nir_instr *instr, struct gcm_state *state)
730 nir_foreach_ssa_def(instr, gcm_schedule_late_def, state);
736 struct gcm_state *state = void_state;
742 nir_ssa_undef_instr_create(state->impl->function->shader,
744 nir_instr_insert(nir_before_cf_list(&state->impl->body), &undef->instr);
762 gcm_place_instr(nir_instr *instr, struct gcm_state *state)
770 nir_foreach_ssa_def(instr, gcm_replace_def_with_undef, state);
775 struct gcm_block_info *block_info = &state->blocks[instr->block->index];
808 struct gcm_state state;
810 state.impl = impl;
811 state.instr = NULL;
812 state.progress = false;
813 exec_list_make_empty(&state.instrs);
814 state.blocks = rzalloc_array(NULL, struct gcm_block_info, impl->num_blocks);
816 gcm_build_block_info(&impl->body, &state, NULL, 0, 0, ~0u);
818 gcm_pin_instructions(impl, &state);
820 state.instr_infos =
821 rzalloc_array(NULL, struct gcm_instr_info, state.num_instrs);
825 foreach_list_typed_safe(nir_instr, instr, node, &state.instrs) {
830 state.progress = true;
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);
841 while (!exec_list_is_empty(&state.instrs)) {
843 state.instrs.tail_sentinel.prev, node);
844 gcm_place_instr(instr, &state);
847 ralloc_free(state.blocks);
848 ralloc_free(state.instr_infos);
854 return state.progress;