static boolean epilog( struct tgsi_iterate_context *iter ) { struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter; uint file; /* There must be an END instruction somewhere. */ if (ctx->index_of_END == ~0) { report_error( ctx, "Missing END instruction" ); } /* Check if all declared registers were used. */ for (file = TGSI_FILE_NULL; file < TGSI_FILE_COUNT; file++) { uint i; for (i = 0; i < MAX_REGISTERS; i++) { if (is_register_declared( ctx, file, i ) && !is_register_used( ctx, file, i ) && !ctx->regs_ind_used[file]) { report_warning( ctx, "%s[%u]: Register never used", file_names[file], i ); } } } /* Print totals, if any. */ if (ctx->errors || ctx->warnings) debug_printf( "%u errors, %u warnings\n", ctx->errors, ctx->warnings ); return TRUE; }
static boolean epilog( struct tgsi_iterate_context *iter ) { struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter; /* There must be an END instruction somewhere. */ if (ctx->index_of_END == ~0) { report_error( ctx, "Missing END instruction" ); } /* Check if all declared registers were used. */ { struct cso_hash_iter iter = cso_hash_first_node(ctx->regs_decl); while (!cso_hash_iter_is_null(iter)) { scan_register *reg = (scan_register *)cso_hash_iter_data(iter); if (!is_register_used(ctx, reg) && !is_ind_register_used(ctx, reg)) { report_warning( ctx, "%s[%u]: Register never used", file_names[reg->file], reg->indices[0] ); } iter = cso_hash_iter_next(iter); } } /* Print totals, if any. */ if (ctx->errors || ctx->warnings) debug_printf( "%u errors, %u warnings\n", ctx->errors, ctx->warnings ); return TRUE; }
static boolean check_register_usage( struct sanity_check_ctx *ctx, scan_register *reg, const char *name, boolean indirect_access ) { if (!check_file_name( ctx, reg->file )) { FREE(reg); return FALSE; } if (indirect_access) { /* Note that 'index' is an offset relative to the value of the * address register. No range checking done here.*/ reg->indices[0] = 0; reg->indices[1] = 0; if (!is_any_register_declared( ctx, reg->file )) report_error( ctx, "%s: Undeclared %s register", file_names[reg->file], name ); if (!is_ind_register_used(ctx, reg)) cso_hash_insert(ctx->regs_ind_used, reg->file, reg); else FREE(reg); } else { if (!is_register_declared( ctx, reg )) { if (reg->dimensions == 2) { report_error( ctx, "%s[%d][%d]: Undeclared %s register", file_names[reg->file], reg->indices[0], reg->indices[1], name ); } else { report_error( ctx, "%s[%d]: Undeclared %s register", file_names[reg->file], reg->indices[0], name ); } } if (!is_register_used( ctx, reg )) cso_hash_insert(ctx->regs_used, scan_register_key(reg), reg); else FREE(reg); } return TRUE; }
static void remove_from_flowlist P2 (FLOWLISTENTRY **, dest, REG, reg) { FLOWLISTENTRY *Last = NULL; FLOWLISTENTRY *p; if (reg == REG_MEMORY) { for (p = *dest; p != NULL; p = p->next) { if ((p->ap->mode == am_indx) || (p->ap->mode == am_ind) /* || (p->ap->mode == am_const_ind) */ || (p->ap->mode == am_direct) /* || (p->ap->mode == am_const_direct) */ || (p->ap->mode == am_ainc) || (p->ap->mode == am_adec) || (p->ap->mode == am_preinc) || (p->ap->mode == am_predec) || (p->ap->mode == am_indx2) || (p->ap->mode == am_indxs)) { if (Last == NULL) { *dest = p->next; } else { Last->next = p->next; } } Last = p; } } else { for (p = *dest; p != NULL; p = p->next) { if (is_register_used (reg, p->ap)) { if (Last == NULL) { *dest = p->next; } else { Last->next = p->next; } } Last = p; } } }