mirror of
https://github.com/corda/corda.git
synced 2025-06-18 07:08:15 +00:00
Remove boilerplate code (jump* methods in Compiler)
This commit is contained in:
@ -2592,170 +2592,17 @@ class MyCompiler: public Compiler {
|
||||
return dst;
|
||||
}
|
||||
|
||||
virtual void jumpIfEqual(unsigned size, Operand* a, Operand* b,
|
||||
virtual void condJump(lir::TernaryOperation type, unsigned size, Operand* a, Operand* b,
|
||||
Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueGeneral
|
||||
and static_cast<Value*>(b)->type == lir::ValueGeneral);
|
||||
assert(&c,
|
||||
(isGeneralBranch(type) and isGeneralValue(a) and isGeneralValue(b))
|
||||
or (isFloatBranch(type) and isFloatValue(a) and isFloatValue(b)));
|
||||
|
||||
appendBranch(&c, lir::JumpIfEqual, size, static_cast<Value*>(a),
|
||||
appendBranch(&c, type, size, static_cast<Value*>(a),
|
||||
static_cast<Value*>(b), static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfNotEqual(unsigned size, Operand* a, Operand* b,
|
||||
Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueGeneral
|
||||
and static_cast<Value*>(b)->type == lir::ValueGeneral);
|
||||
|
||||
appendBranch(&c, lir::JumpIfNotEqual, size, static_cast<Value*>(a),
|
||||
static_cast<Value*>(b), static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfLess(unsigned size, Operand* a, Operand* b,
|
||||
Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueGeneral
|
||||
and static_cast<Value*>(b)->type == lir::ValueGeneral);
|
||||
|
||||
appendBranch(&c, lir::JumpIfLess, size, static_cast<Value*>(a),
|
||||
static_cast<Value*>(b), static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfGreater(unsigned size, Operand* a, Operand* b,
|
||||
Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueGeneral
|
||||
and static_cast<Value*>(b)->type == lir::ValueGeneral);
|
||||
|
||||
appendBranch(&c, lir::JumpIfGreater, size, static_cast<Value*>(a),
|
||||
static_cast<Value*>(b), static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfLessOrEqual(unsigned size, Operand* a, Operand* b,
|
||||
Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueGeneral
|
||||
and static_cast<Value*>(b)->type == lir::ValueGeneral);
|
||||
|
||||
appendBranch(&c, lir::JumpIfLessOrEqual, size, static_cast<Value*>(a),
|
||||
static_cast<Value*>(b), static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfGreaterOrEqual(unsigned size, Operand* a, Operand* b,
|
||||
Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueGeneral
|
||||
and static_cast<Value*>(b)->type == lir::ValueGeneral);
|
||||
|
||||
appendBranch(&c, lir::JumpIfGreaterOrEqual, size, static_cast<Value*>(a),
|
||||
static_cast<Value*>(b), static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfFloatEqual(unsigned size, Operand* a, Operand* b,
|
||||
Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueFloat
|
||||
and static_cast<Value*>(b)->type == lir::ValueFloat);
|
||||
|
||||
appendBranch(&c, lir::JumpIfFloatEqual, size, static_cast<Value*>(a),
|
||||
static_cast<Value*>(b), static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfFloatNotEqual(unsigned size, Operand* a, Operand* b,
|
||||
Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueFloat
|
||||
and static_cast<Value*>(b)->type == lir::ValueFloat);
|
||||
|
||||
appendBranch(&c, lir::JumpIfFloatNotEqual, size, static_cast<Value*>(a),
|
||||
static_cast<Value*>(b), static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfFloatLess(unsigned size, Operand* a, Operand* b,
|
||||
Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueFloat
|
||||
and static_cast<Value*>(b)->type == lir::ValueFloat);
|
||||
|
||||
appendBranch(&c, lir::JumpIfFloatLess, size, static_cast<Value*>(a),
|
||||
static_cast<Value*>(b), static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfFloatGreater(unsigned size, Operand* a, Operand* b,
|
||||
Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueFloat
|
||||
and static_cast<Value*>(b)->type == lir::ValueFloat);
|
||||
|
||||
appendBranch(&c, lir::JumpIfFloatGreater, size, static_cast<Value*>(a),
|
||||
static_cast<Value*>(b), static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfFloatLessOrEqual(unsigned size, Operand* a, Operand* b,
|
||||
Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueFloat
|
||||
and static_cast<Value*>(b)->type == lir::ValueFloat);
|
||||
|
||||
appendBranch(&c, lir::JumpIfFloatLessOrEqual, size, static_cast<Value*>(a),
|
||||
static_cast<Value*>(b), static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfFloatGreaterOrEqual(unsigned size, Operand* a, Operand* b,
|
||||
Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueFloat
|
||||
and static_cast<Value*>(b)->type == lir::ValueFloat);
|
||||
|
||||
appendBranch(&c, lir::JumpIfFloatGreaterOrEqual, size, static_cast<Value*>(a),
|
||||
static_cast<Value*>(b), static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfFloatLessOrUnordered(unsigned size, Operand* a,
|
||||
Operand* b, Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueFloat
|
||||
and static_cast<Value*>(b)->type == lir::ValueFloat);
|
||||
|
||||
appendBranch(&c, lir::JumpIfFloatLessOrUnordered, size, static_cast<Value*>(a),
|
||||
static_cast<Value*>(b), static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfFloatGreaterOrUnordered(unsigned size, Operand* a,
|
||||
Operand* b, Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueFloat
|
||||
and static_cast<Value*>(b)->type == lir::ValueFloat);
|
||||
|
||||
appendBranch(&c, lir::JumpIfFloatGreaterOrUnordered, size,
|
||||
static_cast<Value*>(a), static_cast<Value*>(b),
|
||||
static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfFloatLessOrEqualOrUnordered(unsigned size, Operand* a,
|
||||
Operand* b, Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueFloat
|
||||
and static_cast<Value*>(b)->type == lir::ValueFloat);
|
||||
|
||||
appendBranch(&c, lir::JumpIfFloatLessOrEqualOrUnordered, size,
|
||||
static_cast<Value*>(a), static_cast<Value*>(b),
|
||||
static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jumpIfFloatGreaterOrEqualOrUnordered(unsigned size, Operand* a,
|
||||
Operand* b,
|
||||
Operand* address)
|
||||
{
|
||||
assert(&c, static_cast<Value*>(a)->type == lir::ValueFloat
|
||||
and static_cast<Value*>(b)->type == lir::ValueFloat);
|
||||
|
||||
appendBranch(&c, lir::JumpIfFloatGreaterOrEqualOrUnordered, size,
|
||||
static_cast<Value*>(a), static_cast<Value*>(b),
|
||||
static_cast<Value*>(address));
|
||||
}
|
||||
|
||||
virtual void jmp(Operand* address) {
|
||||
appendJump(&c, lir::Jump, static_cast<Value*>(address));
|
||||
}
|
||||
|
Reference in New Issue
Block a user