Lines Matching refs: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);
266 struct sanity_check_ctx *ctx,
271 if (!check_file_name( ctx, reg->file )) {
281 if (!is_any_register_declared( ctx, reg->file ))
282 report_error( ctx, "%s: Undeclared %s register", file_names[reg->file], name );
283 if (!is_ind_register_used(ctx, reg))
284 cso_hash_insert(ctx->regs_ind_used, reg->file, reg);
289 if (!is_register_declared( ctx, reg )) {
291 report_error( ctx, "%s[%d][%d]: Undeclared %s register", file_names[reg->file],
295 report_error( ctx, "%s[%d]: Undeclared %s register", file_names[reg->file],
299 if (!is_register_used( ctx, reg ))
300 cso_hash_insert(ctx->regs_used, scan_register_key(reg), reg);
312 struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
317 if (ctx->index_of_END != ~0) {
318 report_error( ctx, "Too many END instructions" );
320 ctx->index_of_END = ctx->num_instructions;
325 report_error( ctx, "(%u): Invalid instruction opcode", inst->Instruction.Opcode );
330 report_error( ctx, "%s: Invalid number of destination operands, should be %u", info->mnemonic, info->num_dst );
333 report_error( ctx, "%s: Invalid number of source operands, should be %u", info->mnemonic, info->num_src );
342 ctx,
347 report_error(ctx, "Destination register has empty writemask");
353 ctx,
364 ctx,
371 ctx->num_instructions++;
377 check_and_declare(struct sanity_check_ctx *ctx,
380 if (is_register_declared( ctx, reg))
381 report_error( ctx, "%s[%u]: The same register declared more than once",
383 cso_hash_insert(ctx->regs_decl,
394 struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
400 if (ctx->num_instructions > 0)
401 report_error( ctx, "Instruction expected but declaration found" );
407 if (!check_file_name( ctx, file ))
412 uint processor = ctx->iter.processor.Processor;
421 for (vert = 0; vert < ctx->implied_array_size; ++vert) {
424 check_and_declare(ctx, reg);
429 for (vert = 0; vert < ctx->implied_out_array_size; ++vert) {
432 check_and_declare(ctx, reg);
441 check_and_declare(ctx, reg);
453 struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
458 if (ctx->num_instructions > 0)
459 report_error( ctx, "Instruction expected but immediate found" );
464 fill_scan_register1d(reg, TGSI_FILE_IMMEDIATE, ctx->num_imms);
465 cso_hash_insert(ctx->regs_decl, scan_register_key(reg), reg);
466 ctx->num_imms++;
473 report_error( ctx, "(%u): Invalid immediate data type", imm->Immediate.DataType );
486 struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
490 ctx->implied_array_size = u_vertices_per_prim(prop->u[0].Data);
494 ctx->implied_out_array_size = prop->u[0].Data;
501 struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
504 ctx->implied_array_size = 32;
512 struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
516 if (ctx->index_of_END == ~0) {
517 report_error( ctx, "Missing END instruction" );
524 cso_hash_first_node(ctx->regs_decl);
528 if (!is_register_used(ctx, reg) && !is_ind_register_used(ctx, reg)) {
529 report_warning( ctx, "%s[%u]: Register never used",
538 if (ctx->errors || ctx->warnings)
539 debug_printf( "%u errors, %u warnings\n", ctx->errors, ctx->warnings );
561 struct sanity_check_ctx ctx;
564 ctx.iter.prolog = prolog;
565 ctx.iter.iterate_instruction = iter_instruction;
566 ctx.iter.iterate_declaration = iter_declaration;
567 ctx.iter.iterate_immediate = iter_immediate;
568 ctx.iter.iterate_property = iter_property;
569 ctx.iter.epilog = epilog;
571 ctx.regs_decl = cso_hash_create();
572 ctx.regs_used = cso_hash_create();
573 ctx.regs_ind_used = cso_hash_create();
575 ctx.num_imms = 0;
576 ctx.num_instructions = 0;
577 ctx.index_of_END = ~0;
579 ctx.errors = 0;
580 ctx.warnings = 0;
581 ctx.implied_array_size = 0;
582 ctx.print = debug_get_option_print_sanity();
584 retval = tgsi_iterate_shader( tokens, &ctx.iter );
585 regs_hash_destroy(ctx.regs_decl);
586 regs_hash_destroy(ctx.regs_used);
587 regs_hash_destroy(ctx.regs_ind_used);
591 return ctx.errors == 0;