Lines Matching defs:instr
151 foreach_instr (instr, &start->instr_list) {
152 if (instr->opc != OPC_META_INPUT &&
153 instr->opc != OPC_META_TEX_PREFETCH) {
154 after = instr;
178 instr_cycles(struct ir3_instruction *instr)
180 if (instr->opc == OPC_META_PARALLEL_COPY) {
182 for (unsigned i = 0; i < instr->dsts_count; i++) {
183 if (!instr->srcs[i]->def ||
184 instr->srcs[i]->def->merge_set != instr->dsts[i]->merge_set) {
185 cycles += reg_elems(instr->srcs[i]);
192 if (instr->opc == OPC_META_COLLECT) {
194 for (unsigned i = 0; i < instr->srcs_count; i++) {
195 if (!instr->srcs[i]->def ||
196 instr->srcs[i]->def->merge_set != instr->dsts[0]->merge_set) {
204 if (is_meta(instr))
207 return 1 + instr->repeat;
219 foreach_instr_rev (instr, &block->instr_list) {
220 ra_foreach_dst (dst, instr) {
224 ra_foreach_src (src, instr) {
228 cycle -= instr_cycles(instr);
230 if (instr->opc == OPC_META_PARALLEL_COPY) {
231 ra_foreach_src_n (src, i, instr) {
232 if (src->def->merge_set == instr->dsts[i]->merge_set &&
233 src->def->merge_set_offset == instr->dsts[i]->merge_set_offset) {
235 tmp_next_use[instr->dsts[i]->name];
240 } else if (instr->opc != OPC_META_PHI) {
241 ra_foreach_src (src, instr) {
246 ra_foreach_dst (dst, instr) {
314 foreach_instr (instr, &block->instr_list) {
315 state->cycles += instr_cycles(instr);
316 foreach_dst (dst, instr) {
339 if (reg->instr->opc != OPC_MOV)
341 if (!(reg->instr->srcs[0]->flags & (IR3_REG_IMMED | IR3_REG_CONST)))
343 if (reg->instr->srcs[0]->flags & IR3_REG_RELATIV)
352 d("rematerializing ssa_%u:%u", reg->instr->serialno, reg->name);
355 ir3_instr_create(block, reg->instr->opc, 1, reg->instr->srcs_count);
358 for (unsigned i = 0; i < reg->instr->srcs_count; i++) {
360 ir3_src_create(remat, INVALID_REG, reg->instr->srcs[i]->flags);
361 *src = *reg->instr->srcs[i];
364 remat->cat1 = reg->instr->cat1;
553 dst->instr->flags |= IR3_INSTR_UNUSED;
573 if (dst->instr->opc == OPC_META_INPUT && dst->num != INVALID_REG) {
602 remove_src_early(struct ra_spill_ctx *ctx, struct ir3_instruction *instr,
615 remove_src(struct ra_spill_ctx *ctx, struct ir3_instruction *instr,
702 val->def->instr->flags &= ~IR3_INSTR_UNUSED;
708 struct ir3_instruction *instr,
719 if (instr)
720 ir3_instr_move_before(mov, instr);
726 unsigned spill_slot, struct ir3_instruction *instr, struct ir3_block *block)
734 reg = materialize_pcopy_src(val, instr, block);
737 reg->instr->flags &= ~IR3_INSTR_UNUSED;
740 d("spilling ssa_%u:%u to %u", reg->instr->serialno, reg->name,
764 if (instr)
765 ir3_instr_move_before(spill, instr);
770 struct ir3_instruction *instr, struct ir3_block *block)
776 instr, block);
781 limit(struct ra_spill_ctx *ctx, struct ir3_instruction *instr)
788 d("trying ssa_%u:%u", interval->interval.reg->instr->serialno,
792 spill_interval(ctx, interval, instr, instr->block);
807 d("trying ssa_%u:%u", interval->interval.reg->instr->serialno,
811 spill_interval(ctx, interval, instr, instr->block);
904 d("reloading ssa_%u:%u from %u", reg->instr->serialno, reg->name,
950 struct ir3_instruction *instr,
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);
999 reload_src(struct ra_spill_ctx *ctx, struct ir3_instruction *instr,
1005 reload_def(ctx, src->def, instr, instr->block);
1012 rewrite_src(struct ra_spill_ctx *ctx, struct ir3_instruction *instr,
1037 handle_instr(struct ra_spill_ctx *ctx, struct ir3_instruction *instr)
1039 ra_foreach_dst (dst, instr) {
1044 ra_foreach_src (src, instr)
1055 ra_foreach_dst (dst, instr) {
1063 limit(ctx, instr);
1068 ra_foreach_src (src, instr) {
1069 reload_src(ctx, instr, src);
1074 ra_foreach_src (src, instr) {
1076 remove_src_early(ctx, instr, src);
1079 ra_foreach_dst (dst, instr) {
1084 limit(ctx, instr);
1091 ra_foreach_src (src, instr) {
1093 remove_src(ctx, instr, src);
1097 ra_foreach_src (src, instr) {
1098 rewrite_src(ctx, instr, src);
1102 ra_foreach_dst (dst, instr) {
1106 for (unsigned i = 0; i < instr->dsts_count; i++) {
1107 if (ra_reg_is_dst(instr->dsts[i]) &&
1108 (instr->dsts[i]->flags & IR3_REG_UNUSED))
1109 remove_dst(ctx, instr->dsts[i]);
1293 handle_input_phi(struct ra_spill_ctx *ctx, struct ir3_instruction *instr)
1295 init_dst(ctx, instr->dsts[0]);
1296 insert_dst(ctx, instr->dsts[0]);
1297 finish_dst(ctx, instr->dsts[0]);
1301 remove_input_phi(struct ra_spill_ctx *ctx, struct ir3_instruction *instr)
1303 if (instr->opc == OPC_META_TEX_PREFETCH) {
1304 ra_foreach_src (src, instr)
1305 remove_src(ctx, instr, src);
1307 if (instr->dsts[0]->flags & IR3_REG_UNUSED)
1308 remove_dst(ctx, instr->dsts[0]);
1328 return def->instr->opc == OPC_META_PHI && def->instr->block == block;
1338 def = def->instr->srcs[pred_idx]->def;
1353 return !def->instr->srcs[pred_idx]->def;
1364 def = def->instr->srcs[pred_idx]->def;
1467 def = def->instr->srcs[pred_idx]->def;
1704 foreach_instr (instr, &succ->instr_list) {
1705 if (instr->opc != OPC_META_PHI)
1708 struct ir3_register *def = instr->srcs[pred_idx]->def;
1715 set_src_val(instr->srcs[pred_idx], &interval->dst);
1729 def = def->instr->srcs[pred_idx]->def;
1803 foreach_instr (instr, &block->instr_list) {
1804 if (instr->opc != OPC_META_PHI && instr->opc != OPC_META_INPUT &&
1805 instr->opc != OPC_META_TEX_PREFETCH)
1807 handle_input_phi(ctx, instr);
1817 foreach_instr (instr, &block->instr_list) {
1818 if (instr->opc != OPC_META_PHI)
1820 rewrite_phi(ctx, instr, block);
1832 foreach_instr (instr, &block->instr_list) {
1833 di(instr, "processing");
1835 if (instr->opc == OPC_META_PHI || instr->opc == OPC_META_INPUT ||
1836 instr->opc == OPC_META_TEX_PREFETCH)
1837 remove_input_phi(ctx, instr);
1838 else if (ctx->spilling && instr->opc == OPC_META_PARALLEL_COPY)
1839 handle_pcopy(ctx, instr);
1840 else if (ctx->spilling && instr->opc == OPC_MOV &&
1841 instr->dsts[0] == ctx->base_reg)
1844 handle_instr(ctx, instr);
1887 if (def->instr->opc == OPC_META_PHI) {
1888 struct ir3_instruction *phi = def->instr;
1904 simplify_phi_srcs(struct ir3_instruction *instr)
1906 foreach_src (src, instr) {
1920 foreach_instr (instr, &block->instr_list) {
1921 if (instr->opc != OPC_META_PHI)
1923 instr->data = NULL;
1931 foreach_instr (instr, &block->instr_list) {
1932 if (instr->opc == OPC_META_PHI || (instr->flags & IR3_INSTR_UNUSED))
1935 simplify_phi_srcs(instr);
1946 foreach_instr (instr, &succ->instr_list) {
1947 if (instr->opc != OPC_META_PHI)
1949 if (instr->flags & IR3_INSTR_UNUSED) {
1950 if (instr->data)
1951 instr->data = simplify_phi_def(instr->data);
1953 simplify_phi_srcs(instr);
1954 progress |= simplify_phi_node(instr);
1966 foreach_instr (instr, &block->instr_list) {
1967 instr->flags &= ~IR3_INSTR_UNUSED;
1979 foreach_instr_safe (instr, &block->instr_list) {
1980 if (instr->flags & IR3_INSTR_UNUSED)
1981 list_delinit(&instr->node);
2032 foreach_instr (instr, &block->instr_list) {
2033 ra_foreach_dst (dst, instr) {
2041 foreach_instr (instr, &block->instr_list) {
2042 if (instr->opc != OPC_META_SPLIT &&
2043 instr->opc != OPC_META_COLLECT)
2046 struct ir3_register *dst = instr->dsts[0];
2047 ra_foreach_src (src, instr) {