Lines Matching refs:ctx
46 validate_error(struct ir3_validate_ctx *ctx, const char *condstr)
49 if (ctx->current_instr) {
51 ir3_print_instr(ctx->current_instr);
53 fprintf(stderr, " -> for block%u\n", block_id(ctx->current_block));
58 #define validate_assert(ctx, cond) \
61 validate_error(ctx, #cond); \
72 validate_src(struct ir3_validate_ctx *ctx, struct ir3_instruction *instr,
76 validate_assert(ctx, ir3_valid_immediate(instr, reg->iim_val));
83 validate_assert(ctx, _mesa_set_search(ctx->defs, src->instr));
84 validate_assert(ctx, src->wrmask == reg->wrmask);
85 validate_assert(ctx, reg_class_flags(src) == reg_class_flags(reg));
88 validate_assert(ctx, reg->tied->tied == reg);
96 validate_assert(ctx,
106 validate_phi_src(struct ir3_validate_ctx *ctx, struct ir3_block *block,
115 ctx->current_instr = phi;
116 validate_assert(ctx, phi->srcs_count == block->predecessors_count);
117 validate_src(ctx, phi, phi->srcs[pred_idx]);
122 validate_phi(struct ir3_validate_ctx *ctx, struct ir3_instruction *phi)
124 _mesa_set_add(ctx->defs, phi);
125 validate_assert(ctx, phi->dsts_count == 1);
126 validate_assert(ctx, is_dest_gpr(phi->dsts[0]));
130 validate_dst(struct ir3_validate_ctx *ctx, struct ir3_instruction *instr,
134 validate_assert(ctx, reg->tied->tied == reg);
135 validate_assert(ctx, reg_class_flags(reg->tied) == reg_class_flags(reg));
136 validate_assert(ctx, reg->tied->wrmask == reg->wrmask);
138 validate_assert(ctx, reg->tied->array.base == reg->array.base);
139 validate_assert(ctx, reg->tied->size == reg->size);
148 validate_assert(ctx,
153 validate_assert(ctx, reg->instr == instr);
156 validate_assert(ctx, instr->address);
159 #define validate_reg_size(ctx, reg, type) \
161 ctx, (type_size(type) <= 16) == !!((reg)->flags & IR3_REG_HALF))
164 validate_instr(struct ir3_validate_ctx *ctx, struct ir3_instruction *instr)
170 validate_assert(ctx, instr->address);
172 validate_src(ctx, instr, reg);
186 validate_assert(ctx, reg->flags & IR3_REG_HALF);
190 validate_assert(ctx, !(reg->flags & IR3_REG_HALF));
192 validate_assert(ctx, reg->flags & IR3_REG_HALF);
207 validate_assert(ctx, (last_reg->flags & IR3_REG_HALF) ==
217 validate_dst(ctx, instr, reg);
220 _mesa_set_add(ctx->defs, instr);
229 validate_assert(ctx, instr->dsts_count == 1);
230 validate_assert(ctx, instr->dsts[0]->flags & IR3_REG_SHARED);
231 validate_assert(ctx, !(instr->dsts[0]->flags & IR3_REG_HALF));
233 ctx, util_is_power_of_two_or_zero(instr->dsts[0]->wrmask + 1));
239 validate_assert(ctx, instr->dsts_count == 1);
240 validate_assert(ctx, !(instr->dsts[0]->flags & IR3_REG_SHARED));
242 validate_assert(ctx, instr->dsts_count == 3);
243 validate_assert(ctx, instr->srcs_count == 2);
244 validate_assert(ctx, reg_class_flags(instr->dsts[0]) ==
246 validate_assert(ctx, reg_class_flags(instr->dsts[1]) ==
248 validate_assert(ctx, reg_class_flags(instr->dsts[2]) == IR3_REG_SHARED);
251 validate_reg_size(ctx, dst, instr->cat1.dst_type);
254 validate_reg_size(ctx, src, instr->cat1.src_type);
259 validate_assert(ctx, instr->srcs_count == 2);
260 validate_assert(ctx, instr->dsts_count == 2);
263 validate_assert(ctx, instr->srcs_count == 4);
264 validate_assert(ctx, instr->dsts_count == 1);
267 validate_assert(ctx, instr->srcs_count == 1);
268 validate_assert(ctx, instr->dsts_count == 4);
276 validate_assert(ctx, !instr->address);
284 validate_assert(ctx, instr->opc == cat3_half_opc(instr->opc));
286 validate_assert(ctx, instr->opc == cat3_full_opc(instr->opc));
292 validate_assert(ctx, instr->opc == cat4_half_opc(instr->opc));
294 validate_assert(ctx, instr->opc == cat4_full_opc(instr->opc));
298 validate_reg_size(ctx, instr->dsts[0], instr->cat5.type);
304 validate_reg_size(ctx, instr->dsts[0], instr->cat6.type);
305 validate_reg_size(ctx, instr->srcs[0], instr->cat6.type);
309 validate_assert(ctx, !(instr->dsts[0]->flags & IR3_REG_HALF));
310 validate_assert(ctx, !(instr->srcs[0]->flags & IR3_REG_HALF));
313 validate_assert(ctx, !(instr->srcs[0]->flags & IR3_REG_HALF));
314 validate_assert(ctx, !(instr->srcs[1]->flags & IR3_REG_HALF));
315 validate_reg_size(ctx, instr->srcs[2], instr->cat6.type);
316 validate_assert(ctx, !(instr->srcs[3]->flags & IR3_REG_HALF));
319 validate_assert(ctx, !(instr->srcs[0]->flags & IR3_REG_HALF));
320 validate_assert(ctx, !(instr->srcs[2]->flags & IR3_REG_HALF));
321 validate_assert(ctx, !(instr->srcs[3]->flags & IR3_REG_HALF));
322 validate_reg_size(ctx, instr->srcs[4], instr->cat6.type);
323 validate_assert(ctx, !(instr->srcs[5]->flags & IR3_REG_HALF));
329 validate_assert(ctx, !(instr->srcs[0]->flags & IR3_REG_HALF));
330 validate_reg_size(ctx, instr->srcs[1], instr->cat6.type);
331 validate_assert(ctx, !(instr->srcs[2]->flags & IR3_REG_HALF));
334 validate_assert(ctx, !(instr->srcs[0]->flags & IR3_REG_HALF));
335 validate_assert(ctx, !(instr->srcs[1]->flags & IR3_REG_HALF));
336 validate_reg_size(ctx, instr->srcs[2], instr->cat6.type);
341 validate_reg_size(ctx, instr->dsts[0], instr->cat6.type);
344 validate_reg_size(ctx, instr->srcs[0], instr->cat6.type);
345 validate_assert(ctx, !(instr->srcs[1]->flags & IR3_REG_HALF));
348 validate_assert(ctx, !(instr->srcs[0]->flags & IR3_REG_HALF));
349 validate_assert(ctx, !(instr->srcs[1]->flags & IR3_REG_HALF));
352 validate_reg_size(ctx, instr->dsts[0], instr->cat6.type);
353 validate_assert(ctx, !(instr->srcs[0]->flags & IR3_REG_HALF));
355 validate_assert(ctx, !(instr->srcs[1]->flags & IR3_REG_HALF));
362 validate_assert(ctx, reg_class_flags(src) ==
389 struct ir3_validate_ctx *ctx = ralloc_size(NULL, sizeof(*ctx));
391 ctx->ir = ir;
392 ctx->defs = _mesa_pointer_set_create(ctx);
395 ctx->current_block = block;
396 ctx->current_instr = NULL;
403 ctx, block != ir3_start_block(ir) || block->predecessors_count == 0);
407 ctx->current_instr = instr;
410 validate_assert(ctx, prev == NULL || prev->opc == OPC_META_PHI);
411 validate_phi(ctx, instr);
413 validate_instr(ctx, instr);
420 validate_phi_src(ctx, block->successors[i], block);
422 ctx->current_instr = NULL;
425 validate_assert(ctx, is_physical_successor(block, block->successors[i]));
429 validate_assert(ctx, block->successors[0] || !block->successors[1]);
430 validate_assert(ctx, block->physical_successors[0] || !block->physical_successors[1]);
433 ralloc_free(ctx);