ops.h: rename OP_LOADI to OP_LOADI8

OP_LOADI stores an 8 bit integer to a register, so we renamed the
instruction name to describe the behavior more precisely, like
OP_LOADI16 and OP_LOADI32.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-12-01 19:16:54 +09:00
parent d6e23f3cdc
commit 77e08c9193
5 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ See also `OP_EXT1`, `OP_EXT2` and `OP_EXT3`.
| 0 | `OP_NOP` | `-` | `no operation`
| 1 | `OP_MOVE` | `BB` | `R(a) = R(b)`
| 2 | `OP_LOADL` | `BB` | `R(a) = Pool(b)`
| 3 | `OP_LOADI` | `BB` | `R(a) = mrb_int(b)`
| 3 | `OP_LOADI8` | `BB` | `R(a) = mrb_int(b)`
| 4 | `OP_LOADINEG` | `BB` | `R(a) = mrb_int(-b)`
| 5 | `OP_LOADI__1` | `B` | `R(a) = mrb_int(-1)`
| 6 | `OP_LOADI_0` | `B` | `R(a) = mrb_int(0)`
+1 -1
View File
@@ -15,7 +15,7 @@ operation code operands semantics
OPCODE(NOP, Z) /* no operation */
OPCODE(MOVE, BB) /* R[a] = R[b] */
OPCODE(LOADL, BB) /* R[a] = Pool[b] */
OPCODE(LOADI, BB) /* R[a] = mrb_int(b) */
OPCODE(LOADI8, BB) /* R[a] = mrb_int(b) */
OPCODE(LOADINEG, BB) /* R[a] = mrb_int(-b) */
OPCODE(LOADI__1, B) /* R[a] = mrb_int(-1) */
OPCODE(LOADI_0, B) /* R[a] = mrb_int(0) */
+4 -4
View File
@@ -549,7 +549,7 @@ genjmp2(codegen_scope *s, mrb_code i, uint16_t a, uint32_t pc, int val)
}
}
break;
case OP_LOADT: case OP_LOADI: case OP_LOADINEG: case OP_LOADI__1:
case OP_LOADT: case OP_LOADI8: case OP_LOADINEG: case OP_LOADI__1:
case OP_LOADI_0: case OP_LOADI_1: case OP_LOADI_2: case OP_LOADI_3:
case OP_LOADI_4: case OP_LOADI_5: case OP_LOADI_6: case OP_LOADI_7:
if (data.a == a || data.a > s->nlocals) {
@@ -623,7 +623,7 @@ gen_move(codegen_scope *s, uint16_t dst, uint16_t src, int nopeep)
case OP_HASH:
if (data.b != 0) goto normal;
/* fall through */
case OP_LOADI: case OP_LOADINEG:
case OP_LOADI8: case OP_LOADINEG:
case OP_LOADL: case OP_LOADSYM:
case OP_GETGV: case OP_GETSV: case OP_GETIV: case OP_GETCV:
case OP_GETCONST: case OP_STRING:
@@ -765,7 +765,7 @@ get_int_operand(codegen_scope *s, struct mrb_insn_data *data, mrb_int *n)
*n = data->insn - OP_LOADI_0;
return TRUE;
case OP_LOADI:
case OP_LOADI8:
case OP_LOADI16:
*n = (int16_t)data->b;
return TRUE;
@@ -1177,7 +1177,7 @@ gen_int(codegen_scope *s, uint16_t dst, mrb_int i)
else goto int_lit;
}
else if (i < 8) genop_1(s, OP_LOADI_0 + (uint8_t)i, dst);
else if (i <= 0xff) genop_2(s, OP_LOADI, dst, (uint16_t)i);
else if (i <= 0xff) genop_2(s, OP_LOADI8, dst, (uint16_t)i);
else if (i <= INT16_MAX) genop_2S(s, OP_LOADI16, dst, (uint16_t)i);
else if (i <= INT32_MAX) genop_2SS(s, OP_LOADI32, dst, (uint32_t)i);
else {
+2 -2
View File
@@ -185,8 +185,8 @@ codedump(mrb_state *mrb, const mrb_irep *irep, FILE *out)
}
print_lv_a(mrb, irep, a, out);
break;
CASE(OP_LOADI, BB):
fprintf(out, "LOADI\t\tR%d\t%d\t", a, b);
CASE(OP_LOADI8, BB):
fprintf(out, "LOADI8\tR%d\t%d\t", a, b);
print_lv_a(mrb, irep, a, out);
break;
CASE(OP_LOADINEG, BB):
+1 -1
View File
@@ -1471,7 +1471,7 @@ RETRY_TRY_BLOCK:
NEXT;
}
CASE(OP_LOADI, BB) {
CASE(OP_LOADI8, BB) {
SET_FIXNUM_VALUE(regs[a], b);
NEXT;
}