mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
codegen.c: allow OP_EXT before OP_ADDI and OP_SUBI.
This is preparation for integer constant folding.
This commit is contained in:
@@ -584,14 +584,14 @@ gen_addsub(codegen_scope *s, uint8_t op, uint16_t dst)
|
||||
data.b = data.insn - OP_LOADI_0;
|
||||
/* fall through */
|
||||
case OP_LOADI:
|
||||
case OP_LOADI16:
|
||||
replace:
|
||||
if (data.b >= 128) goto normal;
|
||||
s->pc = s->lastpc;
|
||||
if (op == OP_ADD) {
|
||||
genop_2(s, OP_ADDI, dst, (uint8_t)data.b);
|
||||
genop_2(s, OP_ADDI, dst, data.b);
|
||||
}
|
||||
else {
|
||||
genop_2(s, OP_SUBI, dst, (uint8_t)data.b);
|
||||
genop_2(s, OP_SUBI, dst, data.b);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user