Lines Matching defs:ctx

152    struct sanity_check_ctx *ctx,
158 if (!ctx->print)
166 ctx->errors++;
171 struct sanity_check_ctx *ctx,
177 if (!ctx->print)
185 ctx->warnings++;
190 struct sanity_check_ctx *ctx,
194 report_error( ctx, "(%u): Invalid register file name", file );
202 struct sanity_check_ctx *ctx,
206 &ctx->regs_decl, scan_register_key(reg),
213 struct sanity_check_ctx *ctx,
217 cso_hash_first_node(&ctx->regs_decl);
231 struct sanity_check_ctx *ctx,
235 &ctx->regs_used, scan_register_key(reg),
243 struct sanity_check_ctx *ctx,
246 return cso_hash_contains(&ctx->regs_ind_used, reg->file);
265 struct sanity_check_ctx *ctx,
270 if (!check_file_name( ctx, reg->file )) {
280 if (!is_any_register_declared( ctx, reg->file ))
281 report_error( ctx, "%s: Undeclared %s register", file_names[reg->file], name );
282 if (!is_ind_register_used(ctx, reg))
283 cso_hash_insert(&ctx->regs_ind_used, reg->file, reg);
288 if (!is_register_declared( ctx, reg )) {
290 report_error( ctx, "%s[%d][%d]: Undeclared %s register", file_names[reg->file],
294 report_error( ctx, "%s[%d]: Undeclared %s register", file_names[reg->file],
298 if (!is_register_used( ctx, reg ))
299 cso_hash_insert(&ctx->regs_used, scan_register_key(reg), reg);
311 struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
316 if (ctx->index_of_END != ~0u) {
317 report_error( ctx, "Too many END instructions" );
319 ctx->index_of_END = ctx->num_instructions;
324 report_error( ctx, "(%u): Invalid instruction opcode", inst->Instruction.Opcode );
329 report_error( ctx, "%s: Invalid number of destination operands, should be %u",
333 report_error( ctx, "%s: Invalid number of source operands, should be %u",
343 ctx,
348 report_error(ctx, "Destination register has empty writemask");
354 ctx,
365 ctx,
372 ctx->num_instructions++;
378 check_and_declare(struct sanity_check_ctx *ctx,
381 if (is_register_declared( ctx, reg))
382 report_error( ctx, "%s[%u]: The same register declared more than once",
384 cso_hash_insert(&ctx->regs_decl,
395 struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
401 if (ctx->num_instructions > 0)
402 report_error( ctx, "Instruction expected but declaration found" );
408 if (!check_file_name( ctx, file ))
413 uint processor = ctx->iter.processor.Processor;
422 for (vert = 0; vert < ctx->implied_array_size; ++vert) {
425 check_and_declare(ctx, reg);
430 for (vert = 0; vert < ctx->implied_out_array_size; ++vert) {
433 check_and_declare(ctx, reg);
442 check_and_declare(ctx, reg);
454 struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
459 if (ctx->num_instructions > 0)
460 report_error( ctx, "Instruction expected but immediate found" );
465 fill_scan_register1d(reg, TGSI_FILE_IMMEDIATE, ctx->num_imms);
466 cso_hash_insert(&ctx->regs_decl, scan_register_key(reg), reg);
467 ctx->num_imms++;
474 report_error( ctx, "(%u): Invalid immediate data type", imm->Immediate.DataType );
487 struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
491 ctx->implied_array_size = u_vertices_per_prim(prop->u[0].Data);
495 ctx->implied_out_array_size = prop->u[0].Data;
502 struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
505 ctx->implied_array_size = 32;
513 struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
517 if (ctx->index_of_END == ~0u) {
518 report_error( ctx, "Missing END instruction" );
525 cso_hash_first_node(&ctx->regs_decl);
529 if (!is_register_used(ctx, reg) && !is_ind_register_used(ctx, reg)) {
530 report_warning( ctx, "%s[%u]: Register never used",
539 if (ctx->errors || ctx->warnings)
540 debug_printf( "%u errors, %u warnings\n", ctx->errors, ctx->warnings );
562 struct sanity_check_ctx ctx;
565 ctx.iter.prolog = prolog;
566 ctx.iter.iterate_instruction = iter_instruction;
567 ctx.iter.iterate_declaration = iter_declaration;
568 ctx.iter.iterate_immediate = iter_immediate;
569 ctx.iter.iterate_property = iter_property;
570 ctx.iter.epilog = epilog;
572 cso_hash_init(&ctx.regs_decl);
573 cso_hash_init(&ctx.regs_used);
574 cso_hash_init(&ctx.regs_ind_used);
576 ctx.num_imms = 0;
577 ctx.num_instructions = 0;
578 ctx.index_of_END = ~0;
580 ctx.errors = 0;
581 ctx.warnings = 0;
582 ctx.implied_array_size = 0;
583 ctx.print = debug_get_option_print_sanity();
585 retval = tgsi_iterate_shader( tokens, &ctx.iter );
586 regs_hash_destroy(&ctx.regs_decl);
587 regs_hash_destroy(&ctx.regs_used);
588 regs_hash_destroy(&ctx.regs_ind_used);
592 return ctx.errors == 0;