remove OP_MINUS

This commit is contained in:
Yuichi Nishiwaki 2015-07-03 23:12:28 +09:00
parent a6dbf0067b
commit b01042505f
3 changed files with 1 additions and 24 deletions

View File

@ -971,7 +971,6 @@ codegen_call_vm(pic_state *pic, codegen_context *cxt, pic_value proc, size_t len
VM(pic->uNILP, OP_NILP) VM(pic->uNILP, OP_NILP)
VM(pic->uSYMBOLP, OP_SYMBOLP) VM(pic->uSYMBOLP, OP_SYMBOLP)
VM(pic->uPAIRP, OP_PAIRP) VM(pic->uPAIRP, OP_PAIRP)
VM(pic->uSUB, OP_MINUS)
VM(pic->uNOT, OP_NOT) VM(pic->uNOT, OP_NOT)
} }
} }

View File

@ -42,7 +42,6 @@ enum pic_opcode {
OP_SUB, OP_SUB,
OP_MUL, OP_MUL,
OP_DIV, OP_DIV,
OP_MINUS,
OP_EQ, OP_EQ,
OP_LT, OP_LT,
OP_LE, OP_LE,
@ -185,9 +184,6 @@ pic_dump_code(pic_code c)
case OP_DIV: case OP_DIV:
puts("OP_DIV"); puts("OP_DIV");
break; break;
case OP_MINUS:
puts("OP_MINUS");
break;
case OP_EQ: case OP_EQ:
puts("OP_EQ"); puts("OP_EQ");
break; break;

View File

@ -552,7 +552,7 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value args)
&&L_OP_JMP, &&L_OP_JMPIF, &&L_OP_NOT, &&L_OP_CALL, &&L_OP_TAILCALL, &&L_OP_RET, &&L_OP_JMP, &&L_OP_JMPIF, &&L_OP_NOT, &&L_OP_CALL, &&L_OP_TAILCALL, &&L_OP_RET,
&&L_OP_LAMBDA, &&L_OP_CONS, &&L_OP_CAR, &&L_OP_CDR, &&L_OP_NILP, &&L_OP_LAMBDA, &&L_OP_CONS, &&L_OP_CAR, &&L_OP_CDR, &&L_OP_NILP,
&&L_OP_SYMBOLP, &&L_OP_PAIRP, &&L_OP_SYMBOLP, &&L_OP_PAIRP,
&&L_OP_ADD, &&L_OP_SUB, &&L_OP_MUL, &&L_OP_DIV, &&L_OP_MINUS, &&L_OP_ADD, &&L_OP_SUB, &&L_OP_MUL, &&L_OP_DIV,
&&L_OP_EQ, &&L_OP_LT, &&L_OP_LE, &&L_OP_STOP &&L_OP_EQ, &&L_OP_LT, &&L_OP_LE, &&L_OP_STOP
}; };
#endif #endif
@ -978,24 +978,6 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value args)
DEFINE_ARITH_OP2(OP_DIV, /); DEFINE_ARITH_OP2(OP_DIV, /);
#endif #endif
CASE(OP_MINUS) {
pic_value n;
n = POP();
(void)POP();
if (pic_int_p(n)) {
PUSH(pic_int_value(-pic_int(n)));
}
#if PIC_ENABLE_FLOAT
else if (pic_float_p(n)) {
PUSH(pic_float_value(-pic_float(n)));
}
#endif
else {
pic_errorf(pic, "unary - got a non-number operand");
}
NEXT;
}
#define DEFINE_COMP_OP(opcode, op) \ #define DEFINE_COMP_OP(opcode, op) \
CASE(opcode) { \ CASE(opcode) { \
pic_value a, b; \ pic_value a, b; \