remove redundant f2i & i2f aType parameter

This commit is contained in:
Joshua Warner 2014-05-03 20:00:10 -06:00 committed by Joshua Warner
parent c9313d5802
commit b853f1a594
3 changed files with 14 additions and 19 deletions

View File

@ -137,8 +137,8 @@ class Compiler {
virtual void nullaryOp(lir::Operation op) = 0; virtual void nullaryOp(lir::Operation op) = 0;
virtual ir::Value* f2f(ir::Type resType, ir::Value* a) = 0; virtual ir::Value* f2f(ir::Type resType, ir::Value* a) = 0;
virtual ir::Value* f2i(ir::Type aType, ir::Type resType, ir::Value* a) = 0; virtual ir::Value* f2i(ir::Type resType, ir::Value* a) = 0;
virtual ir::Value* i2f(ir::Type aType, ir::Type resType, ir::Value* a) = 0; virtual ir::Value* i2f(ir::Type resType, ir::Value* a) = 0;
virtual void compile(uintptr_t stackOverflowHandler, virtual void compile(uintptr_t stackOverflowHandler,
unsigned stackLimitOffset) = 0; unsigned stackLimitOffset) = 0;

View File

@ -2696,7 +2696,6 @@ class MyCompiler: public Compiler {
{ {
assert(&c, isFloatValue(a)); assert(&c, isFloatValue(a));
assert(&c, resType.flavor() == ir::Type::Float); assert(&c, resType.flavor() == ir::Type::Float);
assert(&c, a->type.flavor() == ir::Type::Float);
Value* result = value(&c, resType); Value* result = value(&c, resType);
appendTranslate(&c, appendTranslate(&c,
lir::Float2Float, lir::Float2Float,
@ -2707,32 +2706,28 @@ class MyCompiler: public Compiler {
return result; return result;
} }
virtual ir::Value* f2i(ir::Type aType, ir::Type resType, ir::Value* a) virtual ir::Value* f2i(ir::Type resType, ir::Value* a)
{ {
assert(&c, aType == a->type);
assert(&c, isFloatValue(a)); assert(&c, isFloatValue(a));
assert(&c, resType.flavor() != ir::Type::Float); assert(&c, resType.flavor() != ir::Type::Float);
assert(&c, aType.flavor() == ir::Type::Float);
Value* result = value(&c, resType); Value* result = value(&c, resType);
appendTranslate(&c, appendTranslate(&c,
lir::Float2Int, lir::Float2Int,
aType.size(), a->type.size(),
static_cast<Value*>(a), static_cast<Value*>(a),
resType.size(), resType.size(),
result); result);
return result; return result;
} }
virtual ir::Value* i2f(ir::Type aType, ir::Type resType, ir::Value* a) virtual ir::Value* i2f(ir::Type resType, ir::Value* a)
{ {
assert(&c, aType == a->type);
assert(&c, isGeneralValue(a)); assert(&c, isGeneralValue(a));
assert(&c, resType.flavor() == ir::Type::Float); assert(&c, resType.flavor() == ir::Type::Float);
assert(&c, aType.flavor() != ir::Type::Float);
Value* result = value(&c, resType); Value* result = value(&c, resType);
appendTranslate(&c, appendTranslate(&c,
lir::Int2Float, lir::Int2Float,
aType.size(), a->type.size(),
static_cast<Value*>(a), static_cast<Value*>(a),
resType.size(), resType.size(),
result); result);

View File

@ -4432,11 +4432,11 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
} break; } break;
case d2i: { case d2i: {
frame->pushInt(c->f2i(types.f8, types.i4, frame->popLong())); frame->pushInt(c->f2i(types.i4, frame->popLong()));
} break; } break;
case d2l: { case d2l: {
frame->pushLong(c->f2i(types.f8, types.i8, frame->popLong())); frame->pushLong(c->f2i(types.i8, frame->popLong()));
} break; } break;
case dadd: case dadd:
@ -4533,11 +4533,11 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
} break; } break;
case f2i: { case f2i: {
frame->pushInt(c->f2i(types.f4, types.i4, frame->popInt())); frame->pushInt(c->f2i(types.i4, frame->popInt()));
} break; } break;
case f2l: { case f2l: {
frame->pushLong(c->f2i(types.f4, types.i8, frame->popInt())); frame->pushLong(c->f2i(types.i8, frame->popInt()));
} break; } break;
case fadd: case fadd:
@ -4816,11 +4816,11 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
} break; } break;
case i2d: { case i2d: {
frame->pushDouble(c->i2f(types.i4, types.f8, frame->popInt())); frame->pushDouble(c->i2f(types.f8, frame->popInt()));
} break; } break;
case i2f: { case i2f: {
frame->pushFloat(c->i2f(types.i4, types.f4, frame->popInt())); frame->pushFloat(c->i2f(types.f4, frame->popInt()));
} break; } break;
case i2l: case i2l:
@ -5321,11 +5321,11 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
} break; } break;
case l2d: { case l2d: {
frame->pushDouble(c->i2f(types.i8, types.f8, frame->popLong())); frame->pushDouble(c->i2f(types.f8, frame->popLong()));
} break; } break;
case l2f: { case l2f: {
frame->pushFloat(c->i2f(types.i8, types.f4, frame->popLong())); frame->pushFloat(c->i2f(types.f4, frame->popLong()));
} break; } break;
case l2i: case l2i: