mirror of
https://github.com/danog/ir.git
synced 2024-12-02 09:38:29 +01:00
Validate opcode
This commit is contained in:
parent
091907f4a4
commit
ec58853788
@ -95,6 +95,11 @@ bool ir_check(const ir_ctx *ctx)
|
|||||||
bool ok = 1;
|
bool ok = 1;
|
||||||
|
|
||||||
for (i = IR_UNUSED + 1, insn = ctx->ir_base + i; i < ctx->insns_count;) {
|
for (i = IR_UNUSED + 1, insn = ctx->ir_base + i; i < ctx->insns_count;) {
|
||||||
|
if (insn->op >= IR_LAST_OP) {
|
||||||
|
fprintf(stderr, "ir_base[%d].op invalid opcode (%d)\n", i, insn->op);
|
||||||
|
ok = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
flags = ir_op_flags[insn->op];
|
flags = ir_op_flags[insn->op];
|
||||||
n = ir_input_edges_count(ctx, insn);
|
n = ir_input_edges_count(ctx, insn);
|
||||||
for (j = 1, p = insn->ops + 1; j <= n; j++, p++) {
|
for (j = 1, p = insn->ops + 1; j <= n; j++, p++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user