mirror of
https://github.com/corda/corda.git
synced 2025-01-22 12:28:11 +00:00
use ir::Type in f2i and friends, instead of aSize
This commit is contained in:
parent
704c05f818
commit
6ed7681dc0
@ -127,9 +127,9 @@ class Compiler {
|
|||||||
virtual Operand* unaryOp(lir::BinaryOperation type, unsigned size, Operand* a) = 0;
|
virtual Operand* unaryOp(lir::BinaryOperation type, unsigned size, Operand* a) = 0;
|
||||||
virtual void nullaryOp(lir::Operation type) = 0;
|
virtual void nullaryOp(lir::Operation type) = 0;
|
||||||
|
|
||||||
virtual Operand* f2f(unsigned aSize, ir::Type resType, Operand* a) = 0;
|
virtual Operand* f2f(ir::Type aType, ir::Type resType, Operand* a) = 0;
|
||||||
virtual Operand* f2i(unsigned aSize, ir::Type resType, Operand* a) = 0;
|
virtual Operand* f2i(ir::Type aType, ir::Type resType, Operand* a) = 0;
|
||||||
virtual Operand* i2f(unsigned aSize, ir::Type resType, Operand* a) = 0;
|
virtual Operand* i2f(ir::Type aType, ir::Type resType, Operand* a) = 0;
|
||||||
|
|
||||||
virtual void compile(uintptr_t stackOverflowHandler,
|
virtual void compile(uintptr_t stackOverflowHandler,
|
||||||
unsigned stackLimitOffset) = 0;
|
unsigned stackLimitOffset) = 0;
|
||||||
|
@ -2649,42 +2649,50 @@ class MyCompiler: public Compiler {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Operand* f2f(unsigned aSize, ir::Type resType, Operand* a)
|
virtual Operand* f2f(ir::Type aType, ir::Type resType, Operand* a)
|
||||||
{
|
{
|
||||||
|
assert(&c, aType == static_cast<Value*>(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::Float2Float,
|
lir::Float2Float,
|
||||||
aSize,
|
aType.size(),
|
||||||
static_cast<Value*>(a),
|
static_cast<Value*>(a),
|
||||||
resType.size(),
|
resType.size(),
|
||||||
result);
|
result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Operand* f2i(unsigned aSize, ir::Type resType, Operand* a)
|
virtual Operand* f2i(ir::Type aType, ir::Type resType, Operand* a)
|
||||||
{
|
{
|
||||||
|
// TODO: enable when possible
|
||||||
|
// assert(&c, aType == static_cast<Value*>(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,
|
||||||
aSize,
|
aType.size(),
|
||||||
static_cast<Value*>(a),
|
static_cast<Value*>(a),
|
||||||
resType.size(),
|
resType.size(),
|
||||||
result);
|
result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Operand* i2f(unsigned aSize, ir::Type resType, Operand* a)
|
virtual Operand* i2f(ir::Type aType, ir::Type resType, Operand* a)
|
||||||
{
|
{
|
||||||
|
// TODO: enable when possible
|
||||||
|
// assert(&c, aType == static_cast<Value*>(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,
|
||||||
aSize,
|
aType.size(),
|
||||||
static_cast<Value*>(a),
|
static_cast<Value*>(a),
|
||||||
resType.size(),
|
resType.size(),
|
||||||
result);
|
result);
|
||||||
|
@ -4417,15 +4417,15 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
case d2f: {
|
case d2f: {
|
||||||
frame->pushInt(c->f2f(8, types.f4, frame->popLong()));
|
frame->pushInt(c->f2f(types.f8, types.f4, frame->popLong()));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case d2i: {
|
case d2i: {
|
||||||
frame->pushInt(c->f2i(8, types.i4, frame->popLong()));
|
frame->pushInt(c->f2i(types.f8, types.i4, frame->popLong()));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case d2l: {
|
case d2l: {
|
||||||
frame->pushLong(c->f2i(8, types.i8, frame->popLong()));
|
frame->pushLong(c->f2i(types.f8, types.i8, frame->popLong()));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dadd:
|
case dadd:
|
||||||
@ -4518,15 +4518,15 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case f2d: {
|
case f2d: {
|
||||||
frame->pushLong(c->f2f(4, types.f8, frame->popInt()));
|
frame->pushLong(c->f2f(types.f4, types.f8, frame->popInt()));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case f2i: {
|
case f2i: {
|
||||||
frame->pushInt(c->f2i(4, types.i4, frame->popInt()));
|
frame->pushInt(c->f2i(types.f4, types.i4, frame->popInt()));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case f2l: {
|
case f2l: {
|
||||||
frame->pushLong(c->f2i(4, types.i8, frame->popInt()));
|
frame->pushLong(c->f2i(types.f4, types.i8, frame->popInt()));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case fadd:
|
case fadd:
|
||||||
@ -4706,7 +4706,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
8,
|
8,
|
||||||
8,
|
8,
|
||||||
c->memory(
|
c->memory(
|
||||||
table, types.f4, targetFieldOffset(context, field), 0, 1),
|
table, types.f8, targetFieldOffset(context, field), 0, 1),
|
||||||
8));
|
8));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -4715,7 +4715,7 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
8,
|
8,
|
||||||
8,
|
8,
|
||||||
c->memory(
|
c->memory(
|
||||||
table, types.i4, targetFieldOffset(context, field), 0, 1),
|
table, types.i8, targetFieldOffset(context, field), 0, 1),
|
||||||
8));
|
8));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -4828,11 +4828,11 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
case i2d: {
|
case i2d: {
|
||||||
frame->pushLong(c->i2f(4, types.f8, frame->popInt()));
|
frame->pushLong(c->i2f(types.i4, types.f8, frame->popInt()));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case i2f: {
|
case i2f: {
|
||||||
frame->pushInt(c->i2f(4, types.f4, frame->popInt()));
|
frame->pushInt(c->i2f(types.i4, types.f4, frame->popInt()));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case i2l:
|
case i2l:
|
||||||
@ -5331,11 +5331,11 @@ compile(MyThread* t, Frame* initialFrame, unsigned initialIp,
|
|||||||
} goto start;
|
} goto start;
|
||||||
|
|
||||||
case l2d: {
|
case l2d: {
|
||||||
frame->pushLong(c->i2f(8, types.f8, frame->popLong()));
|
frame->pushLong(c->i2f(types.i8, types.f8, frame->popLong()));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case l2f: {
|
case l2f: {
|
||||||
frame->pushInt(c->i2f(8, types.f4, frame->popLong()));
|
frame->pushInt(c->i2f(types.i8, types.f4, frame->popLong()));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case l2i:
|
case l2i:
|
||||||
|
Loading…
Reference in New Issue
Block a user