remove redundant Compiler::unaryOp type parameter

This commit is contained in:
Joshua Warner 2014-05-03 20:41:54 -06:00 committed by Joshua Warner
parent a0443f0ef1
commit 008bb6b86e
3 changed files with 9 additions and 15 deletions

View File

@ -130,7 +130,6 @@ class Compiler {
ir::Value* a, ir::Value* a,
ir::Value* b) = 0; ir::Value* b) = 0;
virtual ir::Value* unaryOp(lir::BinaryOperation op, virtual ir::Value* unaryOp(lir::BinaryOperation op,
ir::Type type,
ir::Value* a) = 0; ir::Value* a) = 0;
virtual void nullaryOp(lir::Operation op) = 0; virtual void nullaryOp(lir::Operation op) = 0;

View File

@ -2678,16 +2678,14 @@ class MyCompiler: public Compiler {
} }
virtual ir::Value* unaryOp(lir::BinaryOperation op, virtual ir::Value* unaryOp(lir::BinaryOperation op,
ir::Type type,
ir::Value* a) ir::Value* a)
{ {
assert(&c, a->type == type);
assert(&c, assert(&c,
(isGeneralUnaryOp(op) and isGeneralValue(a))or(isFloatUnaryOp(op) (isGeneralUnaryOp(op) and isGeneralValue(a))or(isFloatUnaryOp(op)
and isFloatValue(a))); and isFloatValue(a)));
Value* result = value(&c, a->type); Value* result = value(&c, a->type);
appendTranslate( appendTranslate(
&c, op, type.size(), static_cast<Value*>(a), type.size(), result); &c, op, a->type.size(), static_cast<Value*>(a), a->type.size(), result);
return result; return result;
} }

View File

@ -3754,19 +3754,17 @@ intrinsic(MyThread* t, Frame* frame, object target)
if (MATCH(methodName(t, target), "sqrt") if (MATCH(methodName(t, target), "sqrt")
and MATCH(methodSpec(t, target), "(D)D")) and MATCH(methodSpec(t, target), "(D)D"))
{ {
frame->pushDouble( frame->pushDouble(c->unaryOp(lir::FloatSquareRoot, frame->popLong()));
c->unaryOp(lir::FloatSquareRoot, types.f8, frame->popLong()));
return true; return true;
} else if (MATCH(methodName(t, target), "abs")) { } else if (MATCH(methodName(t, target), "abs")) {
if (MATCH(methodSpec(t, target), "(I)I")) { if (MATCH(methodSpec(t, target), "(I)I")) {
frame->pushInt(c->unaryOp(lir::Absolute, types.i4, frame->popInt())); frame->pushInt(c->unaryOp(lir::Absolute, frame->popInt()));
return true; return true;
} else if (MATCH(methodSpec(t, target), "(J)J")) { } else if (MATCH(methodSpec(t, target), "(J)J")) {
frame->pushLong(c->unaryOp(lir::Absolute, types.i8, frame->popLong())); frame->pushLong(c->unaryOp(lir::Absolute, frame->popLong()));
return true; return true;
} else if (MATCH(methodSpec(t, target), "(F)F")) { } else if (MATCH(methodSpec(t, target), "(F)F")) {
frame->pushFloat( frame->pushFloat(c->unaryOp(lir::FloatAbsolute, frame->popInt()));
c->unaryOp(lir::FloatAbsolute, types.f4, frame->popInt()));
return true; return true;
} }
} }
@ -4484,8 +4482,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
break; break;
case dneg: { case dneg: {
frame->pushDouble( frame->pushDouble(c->unaryOp(lir::FloatNegate, frame->popLong()));
c->unaryOp(lir::FloatNegate, types.f8, frame->popLong()));
} break; } break;
case dup: case dup:
@ -4585,7 +4582,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
break; break;
case fneg: { case fneg: {
frame->pushFloat(c->unaryOp(lir::FloatNegate, types.f4, frame->popInt())); frame->pushFloat(c->unaryOp(lir::FloatNegate, frame->popInt()));
} break; } break;
case getfield: case getfield:
@ -4999,7 +4996,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
break; break;
case ineg: { case ineg: {
frame->pushInt(c->unaryOp(lir::Negate, types.i4, frame->popInt())); frame->pushInt(c->unaryOp(lir::Negate, frame->popInt()));
} break; } break;
case instanceof: { case instanceof: {
@ -5475,7 +5472,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
break; break;
case lneg: case lneg:
frame->pushLong(c->unaryOp(lir::Negate, types.i8, frame->popLong())); frame->pushLong(c->unaryOp(lir::Negate, frame->popLong()));
break; break;
case lookupswitch: { case lookupswitch: {