mirror of
https://github.com/corda/corda.git
synced 2025-01-21 03:55:00 +00:00
begin renaming lir:: types
This commit is contained in:
parent
94761711c9
commit
2939480a65
@ -26,11 +26,11 @@ class Architecture;
|
|||||||
class OperandInfo {
|
class OperandInfo {
|
||||||
public:
|
public:
|
||||||
const unsigned size;
|
const unsigned size;
|
||||||
const lir::OperandType type;
|
const lir::Operand::Type type;
|
||||||
lir::Operand* const operand;
|
lir::Operand* const operand;
|
||||||
|
|
||||||
inline OperandInfo(unsigned size,
|
inline OperandInfo(unsigned size,
|
||||||
lir::OperandType type,
|
lir::Operand::Type type,
|
||||||
lir::Operand* operand)
|
lir::Operand* operand)
|
||||||
: size(size), type(type), operand(operand)
|
: size(size), type(type), operand(operand)
|
||||||
{
|
{
|
||||||
|
@ -79,17 +79,8 @@ const unsigned NonBranchTernaryOperationCount = FloatMin + 1;
|
|||||||
const unsigned BranchOperationCount = JumpIfFloatGreaterOrEqualOrUnordered
|
const unsigned BranchOperationCount = JumpIfFloatGreaterOrEqualOrUnordered
|
||||||
- FloatMin;
|
- FloatMin;
|
||||||
|
|
||||||
enum OperandType {
|
|
||||||
ConstantOperand,
|
|
||||||
AddressOperand,
|
|
||||||
RegisterOperand,
|
|
||||||
MemoryOperand
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ValueType { ValueGeneral, ValueFloat };
|
enum ValueType { ValueGeneral, ValueFloat };
|
||||||
|
|
||||||
const unsigned OperandTypeCount = MemoryOperand + 1;
|
|
||||||
|
|
||||||
const int NoRegister = -1;
|
const int NoRegister = -1;
|
||||||
|
|
||||||
inline bool isBranch(lir::TernaryOperation op)
|
inline bool isBranch(lir::TernaryOperation op)
|
||||||
@ -128,6 +119,16 @@ inline bool isFloatUnaryOp(lir::BinaryOperation op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Operand {
|
class Operand {
|
||||||
|
public:
|
||||||
|
|
||||||
|
enum class Type {
|
||||||
|
Constant,
|
||||||
|
Address,
|
||||||
|
RegisterPair,
|
||||||
|
Memory
|
||||||
|
};
|
||||||
|
|
||||||
|
const static unsigned TypeCount = (unsigned)Type::Memory + 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Constant : public Operand {
|
class Constant : public Operand {
|
||||||
|
@ -256,7 +256,7 @@ Site* pickTargetSite(Context* c,
|
|||||||
|
|
||||||
expect(c, target.cost < Target::Impossible);
|
expect(c, target.cost < Target::Impossible);
|
||||||
|
|
||||||
if (target.type == lir::MemoryOperand) {
|
if (target.type == lir::Operand::Type::Memory) {
|
||||||
return frameSite(c, target.index);
|
return frameSite(c, target.index);
|
||||||
} else {
|
} else {
|
||||||
return registerSite(c, target.index);
|
return registerSite(c, target.index);
|
||||||
@ -369,7 +369,7 @@ Site* maybeMove(Context* c,
|
|||||||
size,
|
size,
|
||||||
src,
|
src,
|
||||||
tmp,
|
tmp,
|
||||||
OperandMask(1 << dstSite->type(c), dstSite->registerMask(c), 0));
|
OperandMask(1 << (unsigned)dstSite->type(c), dstSite->registerMask(c), 0));
|
||||||
|
|
||||||
SiteMask srcMask = SiteMask::lowPart(src);
|
SiteMask srcMask = SiteMask::lowPart(src);
|
||||||
unsigned cost = 0xFFFFFFFF;
|
unsigned cost = 0xFFFFFFFF;
|
||||||
@ -514,14 +514,14 @@ void steal(Context* c, Resource* r, Value* thief)
|
|||||||
|
|
||||||
SiteMask generalRegisterMask(Context* c)
|
SiteMask generalRegisterMask(Context* c)
|
||||||
{
|
{
|
||||||
return SiteMask(1 << lir::RegisterOperand,
|
return SiteMask(1 << (unsigned)lir::Operand::Type::RegisterPair,
|
||||||
c->regFile->generalRegisters.mask,
|
c->regFile->generalRegisters.mask,
|
||||||
NoFrameIndex);
|
NoFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
SiteMask generalRegisterOrConstantMask(Context* c)
|
SiteMask generalRegisterOrConstantMask(Context* c)
|
||||||
{
|
{
|
||||||
return SiteMask((1 << lir::RegisterOperand) | (1 << lir::ConstantOperand),
|
return SiteMask((1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Constant),
|
||||||
c->regFile->generalRegisters.mask,
|
c->regFile->generalRegisters.mask,
|
||||||
NoFrameIndex);
|
NoFrameIndex);
|
||||||
}
|
}
|
||||||
@ -616,11 +616,11 @@ bool isHome(Value* v, int frameIndex)
|
|||||||
bool acceptForResolve(Context* c, Site* s, Read* read, const SiteMask& mask)
|
bool acceptForResolve(Context* c, Site* s, Read* read, const SiteMask& mask)
|
||||||
{
|
{
|
||||||
if (acceptMatch(c, s, read, mask) and (not s->frozen(c))) {
|
if (acceptMatch(c, s, read, mask) and (not s->frozen(c))) {
|
||||||
if (s->type(c) == lir::RegisterOperand) {
|
if (s->type(c) == lir::Operand::Type::RegisterPair) {
|
||||||
return c->availableGeneralRegisterCount > ResolveRegisterReserveCount;
|
return c->availableGeneralRegisterCount > ResolveRegisterReserveCount;
|
||||||
} else {
|
} else {
|
||||||
assertT(c,
|
assertT(c,
|
||||||
s->match(c, SiteMask(1 << lir::MemoryOperand, 0, AnyFrameIndex)));
|
s->match(c, SiteMask(1 << (unsigned)lir::Operand::Type::Memory, 0, AnyFrameIndex)));
|
||||||
|
|
||||||
return isHome(read->value,
|
return isHome(read->value,
|
||||||
offsetToFrameIndex(c, static_cast<MemorySite*>(s)->offset));
|
offsetToFrameIndex(c, static_cast<MemorySite*>(s)->offset));
|
||||||
@ -698,7 +698,7 @@ void apply(Context* c,
|
|||||||
{
|
{
|
||||||
assertT(c, s1Low->type(c) == s1High->type(c));
|
assertT(c, s1Low->type(c) == s1High->type(c));
|
||||||
|
|
||||||
lir::OperandType s1Type = s1Low->type(c);
|
lir::Operand::Type s1Type = s1Low->type(c);
|
||||||
OperandUnion s1Union;
|
OperandUnion s1Union;
|
||||||
asAssemblerOperand(c, s1Low, s1High, &s1Union);
|
asAssemblerOperand(c, s1Low, s1High, &s1Union);
|
||||||
|
|
||||||
@ -717,11 +717,11 @@ void apply(Context* c,
|
|||||||
assertT(c, s1Low->type(c) == s1High->type(c));
|
assertT(c, s1Low->type(c) == s1High->type(c));
|
||||||
assertT(c, s2Low->type(c) == s2High->type(c));
|
assertT(c, s2Low->type(c) == s2High->type(c));
|
||||||
|
|
||||||
lir::OperandType s1Type = s1Low->type(c);
|
lir::Operand::Type s1Type = s1Low->type(c);
|
||||||
OperandUnion s1Union;
|
OperandUnion s1Union;
|
||||||
asAssemblerOperand(c, s1Low, s1High, &s1Union);
|
asAssemblerOperand(c, s1Low, s1High, &s1Union);
|
||||||
|
|
||||||
lir::OperandType s2Type = s2Low->type(c);
|
lir::Operand::Type s2Type = s2Low->type(c);
|
||||||
OperandUnion s2Union;
|
OperandUnion s2Union;
|
||||||
asAssemblerOperand(c, s2Low, s2High, &s2Union);
|
asAssemblerOperand(c, s2Low, s2High, &s2Union);
|
||||||
|
|
||||||
@ -746,15 +746,15 @@ void apply(Context* c,
|
|||||||
assertT(c, s2Low->type(c) == s2High->type(c));
|
assertT(c, s2Low->type(c) == s2High->type(c));
|
||||||
assertT(c, s3Low->type(c) == s3High->type(c));
|
assertT(c, s3Low->type(c) == s3High->type(c));
|
||||||
|
|
||||||
lir::OperandType s1Type = s1Low->type(c);
|
lir::Operand::Type s1Type = s1Low->type(c);
|
||||||
OperandUnion s1Union;
|
OperandUnion s1Union;
|
||||||
asAssemblerOperand(c, s1Low, s1High, &s1Union);
|
asAssemblerOperand(c, s1Low, s1High, &s1Union);
|
||||||
|
|
||||||
lir::OperandType s2Type = s2Low->type(c);
|
lir::Operand::Type s2Type = s2Low->type(c);
|
||||||
OperandUnion s2Union;
|
OperandUnion s2Union;
|
||||||
asAssemblerOperand(c, s2Low, s2High, &s2Union);
|
asAssemblerOperand(c, s2Low, s2High, &s2Union);
|
||||||
|
|
||||||
lir::OperandType s3Type = s3Low->type(c);
|
lir::Operand::Type s3Type = s3Low->type(c);
|
||||||
OperandUnion s3Union;
|
OperandUnion s3Union;
|
||||||
asAssemblerOperand(c, s3Low, s3High, &s3Union);
|
asAssemblerOperand(c, s3Low, s3High, &s3Union);
|
||||||
|
|
||||||
@ -782,7 +782,7 @@ void saveLocals(Context* c, Event* e)
|
|||||||
e->addRead(
|
e->addRead(
|
||||||
c,
|
c,
|
||||||
local->value,
|
local->value,
|
||||||
SiteMask(1 << lir::MemoryOperand, 0, compiler::frameIndex(c, li)));
|
SiteMask(1 << (unsigned)lir::Operand::Type::Memory, 0, compiler::frameIndex(c, li)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -815,10 +815,10 @@ void maybeMove(Context* c,
|
|||||||
|
|
||||||
if (cost) {
|
if (cost) {
|
||||||
// todo: let c->arch->planMove decide this:
|
// todo: let c->arch->planMove decide this:
|
||||||
bool useTemporary = ((target->type(c) == lir::MemoryOperand
|
bool useTemporary = ((target->type(c) == lir::Operand::Type::Memory
|
||||||
and srcValue->source->type(c) == lir::MemoryOperand)
|
and srcValue->source->type(c) == lir::Operand::Type::Memory)
|
||||||
or (srcSelectSize < dstSize
|
or (srcSelectSize < dstSize
|
||||||
and target->type(c) != lir::RegisterOperand));
|
and target->type(c) != lir::Operand::Type::RegisterPair));
|
||||||
|
|
||||||
srcValue->source->freeze(c, srcValue);
|
srcValue->source->freeze(c, srcValue);
|
||||||
|
|
||||||
@ -827,7 +827,7 @@ void maybeMove(Context* c,
|
|||||||
srcValue->source->thaw(c, srcValue);
|
srcValue->source->thaw(c, srcValue);
|
||||||
|
|
||||||
bool addOffset = srcSize != srcSelectSize and c->arch->bigEndian()
|
bool addOffset = srcSize != srcSelectSize and c->arch->bigEndian()
|
||||||
and srcValue->source->type(c) == lir::MemoryOperand;
|
and srcValue->source->type(c) == lir::Operand::Type::Memory;
|
||||||
|
|
||||||
if (addOffset) {
|
if (addOffset) {
|
||||||
static_cast<MemorySite*>(srcValue->source)->offset
|
static_cast<MemorySite*>(srcValue->source)->offset
|
||||||
@ -878,7 +878,7 @@ void maybeMove(Context* c,
|
|||||||
}
|
}
|
||||||
|
|
||||||
assertT(c, thunk == 0);
|
assertT(c, thunk == 0);
|
||||||
assertT(c, dstMask.typeMask & src.typeMask & (1 << lir::RegisterOperand));
|
assertT(c, dstMask.typeMask & src.typeMask & (1 << (unsigned)lir::Operand::Type::RegisterPair));
|
||||||
|
|
||||||
Site* tmpTarget
|
Site* tmpTarget
|
||||||
= freeRegisterSite(c, dstMask.registerMask & src.lowRegisterMask);
|
= freeRegisterSite(c, dstMask.registerMask & src.lowRegisterMask);
|
||||||
@ -1635,7 +1635,7 @@ bool resolveSourceSites(Context* c,
|
|||||||
Read* r = live(c, v);
|
Read* r = live(c, v);
|
||||||
|
|
||||||
if (r and sites[el.localIndex] == 0) {
|
if (r and sites[el.localIndex] == 0) {
|
||||||
SiteMask mask((1 << lir::RegisterOperand) | (1 << lir::MemoryOperand),
|
SiteMask mask((1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Memory),
|
||||||
c->regFile->generalRegisters.mask,
|
c->regFile->generalRegisters.mask,
|
||||||
AnyFrameIndex);
|
AnyFrameIndex);
|
||||||
|
|
||||||
@ -1677,7 +1677,7 @@ void resolveTargetSites(Context* c,
|
|||||||
Read* r = live(c, v);
|
Read* r = live(c, v);
|
||||||
|
|
||||||
if (r and sites[el.localIndex] == 0) {
|
if (r and sites[el.localIndex] == 0) {
|
||||||
SiteMask mask((1 << lir::RegisterOperand) | (1 << lir::MemoryOperand),
|
SiteMask mask((1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Memory),
|
||||||
c->regFile->generalRegisters.mask,
|
c->regFile->generalRegisters.mask,
|
||||||
AnyFrameIndex);
|
AnyFrameIndex);
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ class CallEvent : public Event {
|
|||||||
fprintf(stderr, "stack %d arg read %p\n", frameIndex, v);
|
fprintf(stderr, "stack %d arg read %p\n", frameIndex, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
targetMask = SiteMask(1 << lir::MemoryOperand, 0, frameIndex);
|
targetMask = SiteMask(1 << (unsigned)lir::Operand::Type::Memory, 0, frameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->addRead(c, v, targetMask);
|
this->addRead(c, v, targetMask);
|
||||||
@ -512,7 +512,7 @@ class CallEvent : public Event {
|
|||||||
this->addRead(c, v, generalRegisterMask(c));
|
this->addRead(c, v, generalRegisterMask(c));
|
||||||
} else {
|
} else {
|
||||||
this->addRead(
|
this->addRead(
|
||||||
c, v, SiteMask(1 << lir::MemoryOperand, 0, frameIndex));
|
c, v, SiteMask(1 << (unsigned)lir::Operand::Type::Memory, 0, frameIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -544,7 +544,7 @@ class CallEvent : public Event {
|
|||||||
|
|
||||||
this->addRead(c,
|
this->addRead(c,
|
||||||
stack->value,
|
stack->value,
|
||||||
SiteMask(1 << lir::MemoryOperand, 0, logicalIndex));
|
SiteMask(1 << (unsigned)lir::Operand::Type::Memory, 0, logicalIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
stack = stack->next;
|
stack = stack->next;
|
||||||
@ -581,11 +581,11 @@ class CallEvent : public Event {
|
|||||||
assertT(
|
assertT(
|
||||||
c,
|
c,
|
||||||
returnAddressSurrogate == 0
|
returnAddressSurrogate == 0
|
||||||
or returnAddressSurrogate->source->type(c) == lir::RegisterOperand);
|
or returnAddressSurrogate->source->type(c) == lir::Operand::Type::RegisterPair);
|
||||||
assertT(
|
assertT(
|
||||||
c,
|
c,
|
||||||
framePointerSurrogate == 0
|
framePointerSurrogate == 0
|
||||||
or framePointerSurrogate->source->type(c) == lir::RegisterOperand);
|
or framePointerSurrogate->source->type(c) == lir::Operand::Type::RegisterPair);
|
||||||
|
|
||||||
int ras;
|
int ras;
|
||||||
if (returnAddressSurrogate) {
|
if (returnAddressSurrogate) {
|
||||||
@ -783,7 +783,7 @@ class MoveEvent : public Event {
|
|||||||
op,
|
op,
|
||||||
srcSelectSize,
|
srcSelectSize,
|
||||||
OperandMask(
|
OperandMask(
|
||||||
1 << srcValue->source->type(c),
|
1 << (unsigned)srcValue->source->type(c),
|
||||||
srcValue->source->registerMask(c),
|
srcValue->source->registerMask(c),
|
||||||
srcValue->nextWord->source->registerMask(c)),
|
srcValue->nextWord->source->registerMask(c)),
|
||||||
dstSize,
|
dstSize,
|
||||||
@ -866,7 +866,7 @@ class MoveEvent : public Event {
|
|||||||
assertT(c, srcSelectSize == c->targetInfo.pointerSize);
|
assertT(c, srcSelectSize == c->targetInfo.pointerSize);
|
||||||
|
|
||||||
if (dstValue->nextWord->target or live(c, dstValue->nextWord)) {
|
if (dstValue->nextWord->target or live(c, dstValue->nextWord)) {
|
||||||
assertT(c, dstLowMask.typeMask & (1 << lir::RegisterOperand));
|
assertT(c, dstLowMask.typeMask & (1 << (unsigned)lir::Operand::Type::RegisterPair));
|
||||||
|
|
||||||
Site* low = freeRegisterSite(c, dstLowMask.registerMask);
|
Site* low = freeRegisterSite(c, dstLowMask.registerMask);
|
||||||
|
|
||||||
@ -897,7 +897,7 @@ class MoveEvent : public Event {
|
|||||||
|
|
||||||
srcValue->source->thaw(c, srcValue);
|
srcValue->source->thaw(c, srcValue);
|
||||||
|
|
||||||
assertT(c, dstHighMask.typeMask & (1 << lir::RegisterOperand));
|
assertT(c, dstHighMask.typeMask & (1 << (unsigned)lir::Operand::Type::RegisterPair));
|
||||||
|
|
||||||
Site* high = freeRegisterSite(c, dstHighMask.registerMask);
|
Site* high = freeRegisterSite(c, dstHighMask.registerMask);
|
||||||
|
|
||||||
@ -1126,12 +1126,12 @@ class CombineEvent : public Event {
|
|||||||
op,
|
op,
|
||||||
firstValue->type.size(c->targetInfo),
|
firstValue->type.size(c->targetInfo),
|
||||||
OperandMask(
|
OperandMask(
|
||||||
1 << firstValue->source->type(c),
|
1 << (unsigned)firstValue->source->type(c),
|
||||||
firstValue->source->registerMask(c),
|
firstValue->source->registerMask(c),
|
||||||
firstValue->nextWord->source->registerMask(c)),
|
firstValue->nextWord->source->registerMask(c)),
|
||||||
secondValue->type.size(c->targetInfo),
|
secondValue->type.size(c->targetInfo),
|
||||||
OperandMask(
|
OperandMask(
|
||||||
1 << secondValue->source->type(c),
|
1 << (unsigned)secondValue->source->type(c),
|
||||||
secondValue->source->registerMask(c),
|
secondValue->source->registerMask(c),
|
||||||
secondValue->nextWord->source->registerMask(c)),
|
secondValue->nextWord->source->registerMask(c)),
|
||||||
resultValue->type.size(c->targetInfo),
|
resultValue->type.size(c->targetInfo),
|
||||||
@ -1314,7 +1314,7 @@ class TranslateEvent : public Event {
|
|||||||
op,
|
op,
|
||||||
firstValue->type.size(c->targetInfo),
|
firstValue->type.size(c->targetInfo),
|
||||||
OperandMask(
|
OperandMask(
|
||||||
1 << firstValue->source->type(c),
|
1 << (unsigned)firstValue->source->type(c),
|
||||||
firstValue->source->registerMask(c),
|
firstValue->source->registerMask(c),
|
||||||
firstValue->nextWord->source->registerMask(c)),
|
firstValue->nextWord->source->registerMask(c)),
|
||||||
resultValue->type.size(c->targetInfo),
|
resultValue->type.size(c->targetInfo),
|
||||||
@ -1451,7 +1451,7 @@ ConstantSite* findConstantSite(Context* c, Value* v)
|
|||||||
{
|
{
|
||||||
for (SiteIterator it(c, v); it.hasMore();) {
|
for (SiteIterator it(c, v); it.hasMore();) {
|
||||||
Site* s = it.next();
|
Site* s = it.next();
|
||||||
if (s->type(c) == lir::ConstantOperand) {
|
if (s->type(c) == lir::Operand::Type::Constant) {
|
||||||
return static_cast<ConstantSite*>(s);
|
return static_cast<ConstantSite*>(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1461,7 +1461,7 @@ ConstantSite* findConstantSite(Context* c, Value* v)
|
|||||||
void moveIfConflict(Context* c, Value* v, MemorySite* s)
|
void moveIfConflict(Context* c, Value* v, MemorySite* s)
|
||||||
{
|
{
|
||||||
if (v->reads) {
|
if (v->reads) {
|
||||||
SiteMask mask(1 << lir::RegisterOperand, ~0, AnyFrameIndex);
|
SiteMask mask(1 << (unsigned)lir::Operand::Type::RegisterPair, ~0, AnyFrameIndex);
|
||||||
v->reads->intersect(&mask);
|
v->reads->intersect(&mask);
|
||||||
if (s->conflicts(mask)) {
|
if (s->conflicts(mask)) {
|
||||||
maybeMove(c, v->reads, true, false);
|
maybeMove(c, v->reads, true, false);
|
||||||
@ -1509,13 +1509,13 @@ class MemoryEvent : public Event {
|
|||||||
displacement += (constant->value->value() * scale);
|
displacement += (constant->value->value() * scale);
|
||||||
scale = 1;
|
scale = 1;
|
||||||
} else {
|
} else {
|
||||||
assertT(c, index->source->type(c) == lir::RegisterOperand);
|
assertT(c, index->source->type(c) == lir::Operand::Type::RegisterPair);
|
||||||
indexRegister = static_cast<RegisterSite*>(index->source)->number;
|
indexRegister = static_cast<RegisterSite*>(index->source)->number;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
indexRegister = lir::NoRegister;
|
indexRegister = lir::NoRegister;
|
||||||
}
|
}
|
||||||
assertT(c, base->source->type(c) == lir::RegisterOperand);
|
assertT(c, base->source->type(c) == lir::Operand::Type::RegisterPair);
|
||||||
int baseRegister = static_cast<RegisterSite*>(base->source)->number;
|
int baseRegister = static_cast<RegisterSite*>(base->source)->number;
|
||||||
|
|
||||||
popRead(c, this, base);
|
popRead(c, this, base);
|
||||||
@ -1873,12 +1873,12 @@ void clean(Context* c, Value* v, unsigned popIndex)
|
|||||||
{
|
{
|
||||||
for (SiteIterator it(c, v); it.hasMore();) {
|
for (SiteIterator it(c, v); it.hasMore();) {
|
||||||
Site* s = it.next();
|
Site* s = it.next();
|
||||||
if (not(s->match(c, SiteMask(1 << lir::MemoryOperand, 0, AnyFrameIndex))
|
if (not(s->match(c, SiteMask(1 << (unsigned)lir::Operand::Type::Memory, 0, AnyFrameIndex))
|
||||||
and offsetToFrameIndex(c, static_cast<MemorySite*>(s)->offset)
|
and offsetToFrameIndex(c, static_cast<MemorySite*>(s)->offset)
|
||||||
>= popIndex)) {
|
>= popIndex)) {
|
||||||
if (false
|
if (false
|
||||||
and s->match(c,
|
and s->match(c,
|
||||||
SiteMask(1 << lir::MemoryOperand, 0, AnyFrameIndex))) {
|
SiteMask(1 << (unsigned)lir::Operand::Type::Memory, 0, AnyFrameIndex))) {
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
s->toString(c, buffer, 256);
|
s->toString(c, buffer, 256);
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@ -2010,7 +2010,7 @@ class BoundsCheckEvent : public Event {
|
|||||||
lir::Constant handlerConstant(resolvedPromise(c, handler));
|
lir::Constant handlerConstant(resolvedPromise(c, handler));
|
||||||
a->apply(lir::Call,
|
a->apply(lir::Call,
|
||||||
OperandInfo(c->targetInfo.pointerSize,
|
OperandInfo(c->targetInfo.pointerSize,
|
||||||
lir::ConstantOperand,
|
lir::Operand::Type::Constant,
|
||||||
&handlerConstant));
|
&handlerConstant));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2032,7 +2032,7 @@ class BoundsCheckEvent : public Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (constant == 0 or constant->value->value() >= 0) {
|
if (constant == 0 or constant->value->value() >= 0) {
|
||||||
assertT(c, object->source->type(c) == lir::RegisterOperand);
|
assertT(c, object->source->type(c) == lir::Operand::Type::RegisterPair);
|
||||||
MemorySite length(static_cast<RegisterSite*>(object->source)->number,
|
MemorySite length(static_cast<RegisterSite*>(object->source)->number,
|
||||||
lengthOffset,
|
lengthOffset,
|
||||||
lir::NoRegister,
|
lir::NoRegister,
|
||||||
@ -2066,7 +2066,7 @@ class BoundsCheckEvent : public Event {
|
|||||||
lir::Constant handlerConstant(resolvedPromise(c, handler));
|
lir::Constant handlerConstant(resolvedPromise(c, handler));
|
||||||
a->apply(lir::Call,
|
a->apply(lir::Call,
|
||||||
OperandInfo(c->targetInfo.pointerSize,
|
OperandInfo(c->targetInfo.pointerSize,
|
||||||
lir::ConstantOperand,
|
lir::Operand::Type::Constant,
|
||||||
&handlerConstant));
|
&handlerConstant));
|
||||||
|
|
||||||
nextPromise->offset = a->offset();
|
nextPromise->offset = a->offset();
|
||||||
|
@ -205,7 +205,7 @@ Read* StubRead::next(Context*)
|
|||||||
SingleRead* read(Context* c, const SiteMask& mask, Value* successor)
|
SingleRead* read(Context* c, const SiteMask& mask, Value* successor)
|
||||||
{
|
{
|
||||||
assertT(c,
|
assertT(c,
|
||||||
(mask.typeMask != 1 << lir::MemoryOperand) or mask.frameIndex >= 0);
|
(mask.typeMask != 1 << (unsigned)lir::Operand::Type::Memory) or mask.frameIndex >= 0);
|
||||||
|
|
||||||
return new (c->zone) SingleRead(mask, successor);
|
return new (c->zone) SingleRead(mask, successor);
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ bool pickRegisterTarget(Context* c,
|
|||||||
c,
|
c,
|
||||||
v,
|
v,
|
||||||
r,
|
r,
|
||||||
SiteMask(1 << lir::RegisterOperand, 1 << i, NoFrameIndex),
|
SiteMask(1 << (unsigned)lir::Operand::Type::RegisterPair, 1 << i, NoFrameIndex),
|
||||||
costCalculator) + Target::MinimumRegisterCost;
|
costCalculator) + Target::MinimumRegisterCost;
|
||||||
|
|
||||||
if (mask.containsExactly(i)) {
|
if (mask.containsExactly(i)) {
|
||||||
@ -124,7 +124,7 @@ Target pickRegisterTarget(Context* c,
|
|||||||
{
|
{
|
||||||
unsigned cost;
|
unsigned cost;
|
||||||
Register number = pickRegisterTarget(c, v, mask, &cost, costCalculator);
|
Register number = pickRegisterTarget(c, v, mask, &cost, costCalculator);
|
||||||
return Target(number, lir::RegisterOperand, cost);
|
return Target(number, lir::Operand::Type::RegisterPair, cost);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned frameCost(Context* c,
|
unsigned frameCost(Context* c,
|
||||||
@ -135,7 +135,7 @@ unsigned frameCost(Context* c,
|
|||||||
return resourceCost(c,
|
return resourceCost(c,
|
||||||
v,
|
v,
|
||||||
c->frameResources + frameIndex,
|
c->frameResources + frameIndex,
|
||||||
SiteMask(1 << lir::MemoryOperand, 0, frameIndex),
|
SiteMask(1 << (unsigned)lir::Operand::Type::Memory, 0, frameIndex),
|
||||||
costCalculator) + Target::MinimumFrameCost;
|
costCalculator) + Target::MinimumFrameCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ Target pickFrameTarget(Context* c, Value* v, CostCalculator* costCalculator)
|
|||||||
do {
|
do {
|
||||||
if (p->home >= 0) {
|
if (p->home >= 0) {
|
||||||
Target mine(p->home,
|
Target mine(p->home,
|
||||||
lir::MemoryOperand,
|
lir::Operand::Type::Memory,
|
||||||
frameCost(c, v, p->home, costCalculator));
|
frameCost(c, v, p->home, costCalculator));
|
||||||
|
|
||||||
if (mine.cost == Target::MinimumFrameCost) {
|
if (mine.cost == Target::MinimumFrameCost) {
|
||||||
@ -168,7 +168,7 @@ Target pickAnyFrameTarget(Context* c, Value* v, CostCalculator* costCalculator)
|
|||||||
|
|
||||||
unsigned count = totalFrameSize(c);
|
unsigned count = totalFrameSize(c);
|
||||||
for (unsigned i = 0; i < count; ++i) {
|
for (unsigned i = 0; i < count; ++i) {
|
||||||
Target mine(i, lir::MemoryOperand, frameCost(c, v, i, costCalculator));
|
Target mine(i, lir::Operand::Type::Memory, frameCost(c, v, i, costCalculator));
|
||||||
if (mine.cost == Target::MinimumFrameCost) {
|
if (mine.cost == Target::MinimumFrameCost) {
|
||||||
return mine;
|
return mine;
|
||||||
} else if (mine.cost < best.cost) {
|
} else if (mine.cost < best.cost) {
|
||||||
@ -186,7 +186,7 @@ Target pickTarget(Context* c,
|
|||||||
Target best,
|
Target best,
|
||||||
CostCalculator* costCalculator)
|
CostCalculator* costCalculator)
|
||||||
{
|
{
|
||||||
if (mask.typeMask & (1 << lir::RegisterOperand)) {
|
if (mask.typeMask & (1 << (unsigned)lir::Operand::Type::RegisterPair)) {
|
||||||
Target mine
|
Target mine
|
||||||
= pickRegisterTarget(c, value, mask.registerMask, costCalculator);
|
= pickRegisterTarget(c, value, mask.registerMask, costCalculator);
|
||||||
|
|
||||||
@ -198,10 +198,10 @@ Target pickTarget(Context* c,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mask.typeMask & (1 << lir::MemoryOperand)) {
|
if (mask.typeMask & (1 << (unsigned)lir::Operand::Type::Memory)) {
|
||||||
if (mask.frameIndex >= 0) {
|
if (mask.frameIndex >= 0) {
|
||||||
Target mine(mask.frameIndex,
|
Target mine(mask.frameIndex,
|
||||||
lir::MemoryOperand,
|
lir::Operand::Type::Memory,
|
||||||
frameCost(c, value, mask.frameIndex, costCalculator));
|
frameCost(c, value, mask.frameIndex, costCalculator));
|
||||||
if (mine.cost == Target::MinimumFrameCost) {
|
if (mine.cost == Target::MinimumFrameCost) {
|
||||||
return mine;
|
return mine;
|
||||||
|
@ -55,13 +55,13 @@ class Target {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Target(Register index, lir::OperandType type, unsigned cost)
|
Target(Register index, lir::Operand::Type type, unsigned cost)
|
||||||
: index(index), type(type), cost(cost)
|
: index(index), type(type), cost(cost)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t index;
|
int16_t index;
|
||||||
lir::OperandType type;
|
lir::Operand::Type type;
|
||||||
uint8_t cost;
|
uint8_t cost;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ class AddressSite : public Site {
|
|||||||
|
|
||||||
virtual bool match(Context*, const SiteMask& mask)
|
virtual bool match(Context*, const SiteMask& mask)
|
||||||
{
|
{
|
||||||
return mask.typeMask & (1 << lir::AddressOperand);
|
return mask.typeMask & (1 << (unsigned)lir::Operand::Type::Address);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool loneMatch(Context*, const SiteMask&)
|
virtual bool loneMatch(Context*, const SiteMask&)
|
||||||
@ -165,9 +165,9 @@ class AddressSite : public Site {
|
|||||||
abort(c);
|
abort(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual lir::OperandType type(Context*)
|
virtual lir::Operand::Type type(Context*)
|
||||||
{
|
{
|
||||||
return lir::AddressOperand;
|
return lir::Operand::Type::Address;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void asAssemblerOperand(Context* c UNUSED,
|
virtual void asAssemblerOperand(Context* c UNUSED,
|
||||||
@ -201,7 +201,7 @@ class AddressSite : public Site {
|
|||||||
|
|
||||||
virtual SiteMask mask(Context*)
|
virtual SiteMask mask(Context*)
|
||||||
{
|
{
|
||||||
return SiteMask(1 << lir::AddressOperand, 0, NoFrameIndex);
|
return SiteMask(1 << (unsigned)lir::Operand::Type::Address, 0, NoFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual SiteMask nextWordMask(Context* c, unsigned)
|
virtual SiteMask nextWordMask(Context* c, unsigned)
|
||||||
@ -237,7 +237,7 @@ unsigned RegisterSite::copyCost(Context* c, Site* s)
|
|||||||
assertT(c, number != lir::NoRegister);
|
assertT(c, number != lir::NoRegister);
|
||||||
|
|
||||||
if (s and (this == s
|
if (s and (this == s
|
||||||
or (s->type(c) == lir::RegisterOperand
|
or (s->type(c) == lir::Operand::Type::RegisterPair
|
||||||
and (static_cast<RegisterSite*>(s)->mask_.contains(number))))) {
|
and (static_cast<RegisterSite*>(s)->mask_.contains(number))))) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
@ -249,7 +249,7 @@ bool RegisterSite::match(Context* c UNUSED, const SiteMask& mask)
|
|||||||
{
|
{
|
||||||
assertT(c, number != lir::NoRegister);
|
assertT(c, number != lir::NoRegister);
|
||||||
|
|
||||||
if ((mask.typeMask & (1 << lir::RegisterOperand))) {
|
if ((mask.typeMask & (1 << (unsigned)lir::Operand::Type::RegisterPair))) {
|
||||||
return mask.registerMask.contains(number);
|
return mask.registerMask.contains(number);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -260,7 +260,7 @@ bool RegisterSite::loneMatch(Context* c UNUSED, const SiteMask& mask)
|
|||||||
{
|
{
|
||||||
assertT(c, number != lir::NoRegister);
|
assertT(c, number != lir::NoRegister);
|
||||||
|
|
||||||
if ((mask.typeMask & (1 << lir::RegisterOperand))) {
|
if ((mask.typeMask & (1 << (unsigned)lir::Operand::Type::RegisterPair))) {
|
||||||
return mask.registerMask.containsExactly(number);
|
return mask.registerMask.containsExactly(number);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -271,7 +271,7 @@ bool RegisterSite::matchNextWord(Context* c, Site* s, unsigned)
|
|||||||
{
|
{
|
||||||
assertT(c, number != lir::NoRegister);
|
assertT(c, number != lir::NoRegister);
|
||||||
|
|
||||||
if (s->type(c) != lir::RegisterOperand) {
|
if (s->type(c) != lir::Operand::Type::RegisterPair) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ void RegisterSite::acquire(Context* c, Value* v)
|
|||||||
{
|
{
|
||||||
Target target;
|
Target target;
|
||||||
if (number != lir::NoRegister) {
|
if (number != lir::NoRegister) {
|
||||||
target = Target(number, lir::RegisterOperand, 0);
|
target = Target(number, lir::Operand::Type::RegisterPair, 0);
|
||||||
} else {
|
} else {
|
||||||
target = pickRegisterTarget(c, v, mask_);
|
target = pickRegisterTarget(c, v, mask_);
|
||||||
expect(c, target.cost < Target::Impossible);
|
expect(c, target.cost < Target::Impossible);
|
||||||
@ -330,9 +330,9 @@ bool RegisterSite::frozen(Context* c UNUSED)
|
|||||||
return c->registerResources[number].freezeCount != 0;
|
return c->registerResources[number].freezeCount != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
lir::OperandType RegisterSite::type(Context*)
|
lir::Operand::Type RegisterSite::type(Context*)
|
||||||
{
|
{
|
||||||
return lir::RegisterOperand;
|
return lir::Operand::Type::RegisterPair;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterSite::asAssemblerOperand(Context* c UNUSED,
|
void RegisterSite::asAssemblerOperand(Context* c UNUSED,
|
||||||
@ -385,7 +385,7 @@ Site* RegisterSite::makeNextWord(Context* c, unsigned)
|
|||||||
|
|
||||||
SiteMask RegisterSite::mask(Context* c UNUSED)
|
SiteMask RegisterSite::mask(Context* c UNUSED)
|
||||||
{
|
{
|
||||||
return SiteMask(1 << lir::RegisterOperand, mask_, NoFrameIndex);
|
return SiteMask(1 << (unsigned)lir::Operand::Type::RegisterPair, mask_, NoFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
SiteMask RegisterSite::nextWordMask(Context* c, unsigned)
|
SiteMask RegisterSite::nextWordMask(Context* c, unsigned)
|
||||||
@ -393,9 +393,9 @@ SiteMask RegisterSite::nextWordMask(Context* c, unsigned)
|
|||||||
assertT(c, number != lir::NoRegister);
|
assertT(c, number != lir::NoRegister);
|
||||||
|
|
||||||
if (registerSize(c) > c->targetInfo.pointerSize) {
|
if (registerSize(c) > c->targetInfo.pointerSize) {
|
||||||
return SiteMask(1 << lir::RegisterOperand, number, NoFrameIndex);
|
return SiteMask(1 << (unsigned)lir::Operand::Type::RegisterPair, number, NoFrameIndex);
|
||||||
} else {
|
} else {
|
||||||
return SiteMask(1 << lir::RegisterOperand,
|
return SiteMask(1 << (unsigned)lir::Operand::Type::RegisterPair,
|
||||||
c->regFile->generalRegisters.mask,
|
c->regFile->generalRegisters.mask,
|
||||||
NoFrameIndex);
|
NoFrameIndex);
|
||||||
}
|
}
|
||||||
@ -453,7 +453,7 @@ unsigned MemorySite::copyCost(Context* c, Site* s)
|
|||||||
{
|
{
|
||||||
assertT(c, acquired);
|
assertT(c, acquired);
|
||||||
|
|
||||||
if (s and (this == s or (s->type(c) == lir::MemoryOperand
|
if (s and (this == s or (s->type(c) == lir::Operand::Type::Memory
|
||||||
and static_cast<MemorySite*>(s)->base == base
|
and static_cast<MemorySite*>(s)->base == base
|
||||||
and static_cast<MemorySite*>(s)->offset == offset
|
and static_cast<MemorySite*>(s)->offset == offset
|
||||||
and static_cast<MemorySite*>(s)->index == index
|
and static_cast<MemorySite*>(s)->index == index
|
||||||
@ -466,7 +466,7 @@ unsigned MemorySite::copyCost(Context* c, Site* s)
|
|||||||
|
|
||||||
bool MemorySite::conflicts(const SiteMask& mask)
|
bool MemorySite::conflicts(const SiteMask& mask)
|
||||||
{
|
{
|
||||||
return (mask.typeMask & (1 << lir::RegisterOperand)) != 0
|
return (mask.typeMask & (1 << (unsigned)lir::Operand::Type::RegisterPair)) != 0
|
||||||
and (!mask.registerMask.contains(base)
|
and (!mask.registerMask.contains(base)
|
||||||
or (index != lir::NoRegister
|
or (index != lir::NoRegister
|
||||||
and !mask.registerMask.contains(index)));
|
and !mask.registerMask.contains(index)));
|
||||||
@ -476,7 +476,7 @@ bool MemorySite::match(Context* c, const SiteMask& mask)
|
|||||||
{
|
{
|
||||||
assertT(c, acquired);
|
assertT(c, acquired);
|
||||||
|
|
||||||
if (mask.typeMask & (1 << lir::MemoryOperand)) {
|
if (mask.typeMask & (1 << (unsigned)lir::Operand::Type::Memory)) {
|
||||||
if (mask.frameIndex >= 0) {
|
if (mask.frameIndex >= 0) {
|
||||||
if (base == c->arch->stack()) {
|
if (base == c->arch->stack()) {
|
||||||
assertT(c, index == lir::NoRegister);
|
assertT(c, index == lir::NoRegister);
|
||||||
@ -497,7 +497,7 @@ bool MemorySite::loneMatch(Context* c, const SiteMask& mask)
|
|||||||
{
|
{
|
||||||
assertT(c, acquired);
|
assertT(c, acquired);
|
||||||
|
|
||||||
if (mask.typeMask & (1 << lir::MemoryOperand)) {
|
if (mask.typeMask & (1 << (unsigned)lir::Operand::Type::Memory)) {
|
||||||
if (base == c->arch->stack()) {
|
if (base == c->arch->stack()) {
|
||||||
assertT(c, index == lir::NoRegister);
|
assertT(c, index == lir::NoRegister);
|
||||||
|
|
||||||
@ -513,7 +513,7 @@ bool MemorySite::loneMatch(Context* c, const SiteMask& mask)
|
|||||||
|
|
||||||
bool MemorySite::matchNextWord(Context* c, Site* s, unsigned index)
|
bool MemorySite::matchNextWord(Context* c, Site* s, unsigned index)
|
||||||
{
|
{
|
||||||
if (s->type(c) == lir::MemoryOperand) {
|
if (s->type(c) == lir::Operand::Type::Memory) {
|
||||||
MemorySite* ms = static_cast<MemorySite*>(s);
|
MemorySite* ms = static_cast<MemorySite*>(s);
|
||||||
return ms->base == this->base
|
return ms->base == this->base
|
||||||
and ((index == 1
|
and ((index == 1
|
||||||
@ -596,9 +596,9 @@ bool MemorySite::frozen(Context* c)
|
|||||||
and c->frameResources[offsetToFrameIndex(c, offset)].freezeCount != 0;
|
and c->frameResources[offsetToFrameIndex(c, offset)].freezeCount != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
lir::OperandType MemorySite::type(Context*)
|
lir::Operand::Type MemorySite::type(Context*)
|
||||||
{
|
{
|
||||||
return lir::MemoryOperand;
|
return lir::Operand::Type::Memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemorySite::asAssemblerOperand(Context* c UNUSED,
|
void MemorySite::asAssemblerOperand(Context* c UNUSED,
|
||||||
@ -657,7 +657,7 @@ Site* MemorySite::makeNextWord(Context* c, unsigned index)
|
|||||||
|
|
||||||
SiteMask MemorySite::mask(Context* c)
|
SiteMask MemorySite::mask(Context* c)
|
||||||
{
|
{
|
||||||
return SiteMask(1 << lir::MemoryOperand,
|
return SiteMask(1 << (unsigned)lir::Operand::Type::Memory,
|
||||||
0,
|
0,
|
||||||
(base == c->arch->stack())
|
(base == c->arch->stack())
|
||||||
? static_cast<int>(offsetToFrameIndex(c, offset))
|
? static_cast<int>(offsetToFrameIndex(c, offset))
|
||||||
@ -674,7 +674,7 @@ SiteMask MemorySite::nextWordMask(Context* c, unsigned index)
|
|||||||
} else {
|
} else {
|
||||||
frameIndex = NoFrameIndex;
|
frameIndex = NoFrameIndex;
|
||||||
}
|
}
|
||||||
return SiteMask(1 << lir::MemoryOperand, 0, frameIndex);
|
return SiteMask(1 << (unsigned)lir::Operand::Type::Memory, 0, frameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MemorySite::isVolatile(Context* c)
|
bool MemorySite::isVolatile(Context* c)
|
||||||
|
@ -43,7 +43,7 @@ class SiteMask {
|
|||||||
|
|
||||||
static SiteMask fixedRegisterMask(int number)
|
static SiteMask fixedRegisterMask(int number)
|
||||||
{
|
{
|
||||||
return SiteMask(1 << lir::RegisterOperand, 1 << number, NoFrameIndex);
|
return SiteMask(1 << (unsigned)lir::Operand::Type::RegisterPair, 1 << number, NoFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SiteMask lowPart(const OperandMask& mask)
|
static SiteMask lowPart(const OperandMask& mask)
|
||||||
@ -103,7 +103,7 @@ class Site {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual lir::OperandType type(Context*) = 0;
|
virtual lir::Operand::Type type(Context*) = 0;
|
||||||
|
|
||||||
virtual void asAssemblerOperand(Context*, Site*, lir::Operand*) = 0;
|
virtual void asAssemblerOperand(Context*, Site*, lir::Operand*) = 0;
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ class ConstantSite : public Site {
|
|||||||
|
|
||||||
virtual bool match(Context*, const SiteMask& mask)
|
virtual bool match(Context*, const SiteMask& mask)
|
||||||
{
|
{
|
||||||
return mask.typeMask & (1 << lir::ConstantOperand);
|
return mask.typeMask & (1 << (unsigned)lir::Operand::Type::Constant);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool loneMatch(Context*, const SiteMask&)
|
virtual bool loneMatch(Context*, const SiteMask&)
|
||||||
@ -197,12 +197,12 @@ class ConstantSite : public Site {
|
|||||||
|
|
||||||
virtual bool matchNextWord(Context* c, Site* s, unsigned)
|
virtual bool matchNextWord(Context* c, Site* s, unsigned)
|
||||||
{
|
{
|
||||||
return s->type(c) == lir::ConstantOperand;
|
return s->type(c) == lir::Operand::Type::Constant;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual lir::OperandType type(Context*)
|
virtual lir::Operand::Type type(Context*)
|
||||||
{
|
{
|
||||||
return lir::ConstantOperand;
|
return lir::Operand::Type::Constant;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void asAssemblerOperand(Context* c, Site* high, lir::Operand* result)
|
virtual void asAssemblerOperand(Context* c, Site* high, lir::Operand* result)
|
||||||
@ -236,12 +236,12 @@ class ConstantSite : public Site {
|
|||||||
|
|
||||||
virtual SiteMask mask(Context*)
|
virtual SiteMask mask(Context*)
|
||||||
{
|
{
|
||||||
return SiteMask(1 << lir::ConstantOperand, 0, NoFrameIndex);
|
return SiteMask(1 << (unsigned)lir::Operand::Type::Constant, 0, NoFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual SiteMask nextWordMask(Context*, unsigned)
|
virtual SiteMask nextWordMask(Context*, unsigned)
|
||||||
{
|
{
|
||||||
return SiteMask(1 << lir::ConstantOperand, 0, NoFrameIndex);
|
return SiteMask(1 << (unsigned)lir::Operand::Type::Constant, 0, NoFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise* value;
|
Promise* value;
|
||||||
@ -273,7 +273,7 @@ class RegisterSite : public Site {
|
|||||||
|
|
||||||
virtual bool frozen(Context* c UNUSED);
|
virtual bool frozen(Context* c UNUSED);
|
||||||
|
|
||||||
virtual lir::OperandType type(Context*);
|
virtual lir::Operand::Type type(Context*);
|
||||||
|
|
||||||
virtual void asAssemblerOperand(Context* c UNUSED,
|
virtual void asAssemblerOperand(Context* c UNUSED,
|
||||||
Site* high,
|
Site* high,
|
||||||
@ -328,7 +328,7 @@ class MemorySite : public Site {
|
|||||||
|
|
||||||
virtual bool frozen(Context* c);
|
virtual bool frozen(Context* c);
|
||||||
|
|
||||||
virtual lir::OperandType type(Context*);
|
virtual lir::Operand::Type type(Context*);
|
||||||
|
|
||||||
virtual void asAssemblerOperand(Context* c UNUSED,
|
virtual void asAssemblerOperand(Context* c UNUSED,
|
||||||
Site* high UNUSED,
|
Site* high UNUSED,
|
||||||
|
@ -396,7 +396,7 @@ class MyArchitecture : public Architecture {
|
|||||||
OperandMask& aMask,
|
OperandMask& aMask,
|
||||||
bool* thunk)
|
bool* thunk)
|
||||||
{
|
{
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand) | (1 << lir::ConstantOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Constant);
|
||||||
aMask.setLowHighRegisterMasks(~static_cast<uint64_t>(0), ~static_cast<uint64_t>(0));
|
aMask.setLowHighRegisterMasks(~static_cast<uint64_t>(0), ~static_cast<uint64_t>(0));
|
||||||
*thunk = false;
|
*thunk = false;
|
||||||
}
|
}
|
||||||
@ -413,7 +413,7 @@ class MyArchitecture : public Architecture {
|
|||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case lir::Negate:
|
case lir::Negate:
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
aMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
aMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -426,7 +426,7 @@ class MyArchitecture : public Architecture {
|
|||||||
case lir::FloatNegate:
|
case lir::FloatNegate:
|
||||||
case lir::Float2Float:
|
case lir::Float2Float:
|
||||||
if (vfpSupported()) {
|
if (vfpSupported()) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
aMask.setLowHighRegisterMasks(FPR_MASK, FPR_MASK);
|
aMask.setLowHighRegisterMasks(FPR_MASK, FPR_MASK);
|
||||||
} else {
|
} else {
|
||||||
*thunk = true;
|
*thunk = true;
|
||||||
@ -439,7 +439,7 @@ class MyArchitecture : public Architecture {
|
|||||||
// thunks or produce inline machine code which handles edge
|
// thunks or produce inline machine code which handles edge
|
||||||
// cases properly.
|
// cases properly.
|
||||||
if (false && vfpSupported() && bSize == 4) {
|
if (false && vfpSupported() && bSize == 4) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
aMask.setLowHighRegisterMasks(FPR_MASK, FPR_MASK);
|
aMask.setLowHighRegisterMasks(FPR_MASK, FPR_MASK);
|
||||||
} else {
|
} else {
|
||||||
*thunk = true;
|
*thunk = true;
|
||||||
@ -448,7 +448,7 @@ class MyArchitecture : public Architecture {
|
|||||||
|
|
||||||
case lir::Int2Float:
|
case lir::Int2Float:
|
||||||
if (vfpSupported() && aSize == 4) {
|
if (vfpSupported() && aSize == 4) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
aMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
aMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
||||||
} else {
|
} else {
|
||||||
*thunk = true;
|
*thunk = true;
|
||||||
@ -466,12 +466,12 @@ class MyArchitecture : public Architecture {
|
|||||||
unsigned,
|
unsigned,
|
||||||
OperandMask& bMask)
|
OperandMask& bMask)
|
||||||
{
|
{
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand) | (1 << lir::MemoryOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Memory);
|
||||||
bMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
bMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case lir::Negate:
|
case lir::Negate:
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
bMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
bMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -480,18 +480,18 @@ class MyArchitecture : public Architecture {
|
|||||||
case lir::FloatNegate:
|
case lir::FloatNegate:
|
||||||
case lir::Float2Float:
|
case lir::Float2Float:
|
||||||
case lir::Int2Float:
|
case lir::Int2Float:
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
bMask.setLowHighRegisterMasks(FPR_MASK, FPR_MASK);
|
bMask.setLowHighRegisterMasks(FPR_MASK, FPR_MASK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lir::Float2Int:
|
case lir::Float2Int:
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
bMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
bMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lir::Move:
|
case lir::Move:
|
||||||
if (!(aMask.typeMask & 1 << lir::RegisterOperand)) {
|
if (!(aMask.typeMask & 1 << (unsigned)lir::Operand::Type::RegisterPair)) {
|
||||||
bMask.typeMask = 1 << lir::RegisterOperand;
|
bMask.typeMask = 1 << (unsigned)lir::Operand::Type::RegisterPair;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -511,15 +511,15 @@ class MyArchitecture : public Architecture {
|
|||||||
tmpMask.typeMask = 0;
|
tmpMask.typeMask = 0;
|
||||||
tmpMask.setLowHighRegisterMasks(0, 0);
|
tmpMask.setLowHighRegisterMasks(0, 0);
|
||||||
|
|
||||||
if (dstMask.typeMask & (1 << lir::MemoryOperand)) {
|
if (dstMask.typeMask & (1 << (unsigned)lir::Operand::Type::Memory)) {
|
||||||
// can't move directly from memory or constant to memory
|
// can't move directly from memory or constant to memory
|
||||||
srcMask.typeMask = 1 << lir::RegisterOperand;
|
srcMask.typeMask = 1 << (unsigned)lir::Operand::Type::RegisterPair;
|
||||||
tmpMask.typeMask = 1 << lir::RegisterOperand;
|
tmpMask.typeMask = 1 << (unsigned)lir::Operand::Type::RegisterPair;
|
||||||
tmpMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
tmpMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
||||||
} else if (vfpSupported() && dstMask.typeMask & 1 << lir::RegisterOperand
|
} else if (vfpSupported() && dstMask.typeMask & 1 << (unsigned)lir::Operand::Type::RegisterPair
|
||||||
&& dstMask.lowRegisterMask & FPR_MASK) {
|
&& dstMask.lowRegisterMask & FPR_MASK) {
|
||||||
srcMask.typeMask = tmpMask.typeMask = 1 << lir::RegisterOperand
|
srcMask.typeMask = tmpMask.typeMask = 1 << (unsigned)lir::Operand::Type::RegisterPair
|
||||||
| 1 << lir::MemoryOperand;
|
| 1 << (unsigned)lir::Operand::Type::Memory;
|
||||||
tmpMask.setLowHighRegisterMasks(~static_cast<uint64_t>(0), ~static_cast<uint64_t>(0));
|
tmpMask.setLowHighRegisterMasks(~static_cast<uint64_t>(0), ~static_cast<uint64_t>(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -532,10 +532,10 @@ class MyArchitecture : public Architecture {
|
|||||||
unsigned,
|
unsigned,
|
||||||
bool* thunk)
|
bool* thunk)
|
||||||
{
|
{
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand) | (1 << lir::ConstantOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Constant);
|
||||||
aMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
aMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
||||||
|
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
bMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
bMask.setLowHighRegisterMasks(GPR_MASK, GPR_MASK);
|
||||||
|
|
||||||
*thunk = false;
|
*thunk = false;
|
||||||
@ -545,7 +545,7 @@ class MyArchitecture : public Architecture {
|
|||||||
case lir::ShiftRight:
|
case lir::ShiftRight:
|
||||||
case lir::UnsignedShiftRight:
|
case lir::UnsignedShiftRight:
|
||||||
if (bSize == 8)
|
if (bSize == 8)
|
||||||
aMask.typeMask = bMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lir::Add:
|
case lir::Add:
|
||||||
@ -553,7 +553,7 @@ class MyArchitecture : public Architecture {
|
|||||||
case lir::Or:
|
case lir::Or:
|
||||||
case lir::Xor:
|
case lir::Xor:
|
||||||
case lir::Multiply:
|
case lir::Multiply:
|
||||||
aMask.typeMask = bMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lir::Divide:
|
case lir::Divide:
|
||||||
@ -567,7 +567,7 @@ class MyArchitecture : public Architecture {
|
|||||||
case lir::FloatMultiply:
|
case lir::FloatMultiply:
|
||||||
case lir::FloatDivide:
|
case lir::FloatDivide:
|
||||||
if (vfpSupported()) {
|
if (vfpSupported()) {
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
aMask.setLowHighRegisterMasks(FPR_MASK, FPR_MASK);
|
aMask.setLowHighRegisterMasks(FPR_MASK, FPR_MASK);
|
||||||
bMask = aMask;
|
bMask = aMask;
|
||||||
} else {
|
} else {
|
||||||
@ -586,7 +586,7 @@ class MyArchitecture : public Architecture {
|
|||||||
case lir::JumpIfFloatLessOrEqualOrUnordered:
|
case lir::JumpIfFloatLessOrEqualOrUnordered:
|
||||||
case lir::JumpIfFloatGreaterOrEqualOrUnordered:
|
case lir::JumpIfFloatGreaterOrEqualOrUnordered:
|
||||||
if (vfpSupported()) {
|
if (vfpSupported()) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
aMask.setLowHighRegisterMasks(FPR_MASK, FPR_MASK);
|
aMask.setLowHighRegisterMasks(FPR_MASK, FPR_MASK);
|
||||||
bMask = aMask;
|
bMask = aMask;
|
||||||
} else {
|
} else {
|
||||||
@ -608,10 +608,10 @@ class MyArchitecture : public Architecture {
|
|||||||
OperandMask& cMask)
|
OperandMask& cMask)
|
||||||
{
|
{
|
||||||
if (isBranch(op)) {
|
if (isBranch(op)) {
|
||||||
cMask.typeMask = (1 << lir::ConstantOperand);
|
cMask.typeMask = (1 << (unsigned)lir::Operand::Type::Constant);
|
||||||
cMask.setLowHighRegisterMasks(0, 0);
|
cMask.setLowHighRegisterMasks(0, 0);
|
||||||
} else {
|
} else {
|
||||||
cMask.typeMask = (1 << lir::RegisterOperand);
|
cMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
cMask.lowRegisterMask = bMask.lowRegisterMask;
|
cMask.lowRegisterMask = bMask.lowRegisterMask;
|
||||||
cMask.highRegisterMask = bMask.highRegisterMask;
|
cMask.highRegisterMask = bMask.highRegisterMask;
|
||||||
}
|
}
|
||||||
@ -682,7 +682,7 @@ class MyAssembler : public Assembler {
|
|||||||
{
|
{
|
||||||
struct Argument {
|
struct Argument {
|
||||||
unsigned size;
|
unsigned size;
|
||||||
lir::OperandType type;
|
lir::Operand::Type type;
|
||||||
lir::Operand* operand;
|
lir::Operand* operand;
|
||||||
};
|
};
|
||||||
RUNTIME_ARRAY(Argument, arguments, argumentCount);
|
RUNTIME_ARRAY(Argument, arguments, argumentCount);
|
||||||
@ -693,7 +693,7 @@ class MyAssembler : public Assembler {
|
|||||||
for (unsigned i = 0; i < argumentCount; ++i) {
|
for (unsigned i = 0; i < argumentCount; ++i) {
|
||||||
RUNTIME_ARRAY_BODY(arguments)[i].size = va_arg(a, unsigned);
|
RUNTIME_ARRAY_BODY(arguments)[i].size = va_arg(a, unsigned);
|
||||||
RUNTIME_ARRAY_BODY(arguments)[i].type
|
RUNTIME_ARRAY_BODY(arguments)[i].type
|
||||||
= static_cast<lir::OperandType>(va_arg(a, int));
|
= static_cast<lir::Operand::Type>(va_arg(a, int));
|
||||||
RUNTIME_ARRAY_BODY(arguments)[i].operand = va_arg(a, lir::Operand*);
|
RUNTIME_ARRAY_BODY(arguments)[i].operand = va_arg(a, lir::Operand*);
|
||||||
footprint += ceilingDivide(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
footprint += ceilingDivide(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
||||||
TargetBytesPerWord);
|
TargetBytesPerWord);
|
||||||
@ -713,7 +713,7 @@ class MyAssembler : public Assembler {
|
|||||||
RUNTIME_ARRAY_BODY(arguments)[i].operand),
|
RUNTIME_ARRAY_BODY(arguments)[i].operand),
|
||||||
OperandInfo(pad(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
OperandInfo(pad(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
||||||
TargetBytesPerWord),
|
TargetBytesPerWord),
|
||||||
lir::RegisterOperand,
|
lir::Operand::Type::RegisterPair,
|
||||||
&dst));
|
&dst));
|
||||||
|
|
||||||
offset += ceilingDivide(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
offset += ceilingDivide(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
||||||
@ -727,7 +727,7 @@ class MyAssembler : public Assembler {
|
|||||||
RUNTIME_ARRAY_BODY(arguments)[i].operand),
|
RUNTIME_ARRAY_BODY(arguments)[i].operand),
|
||||||
OperandInfo(pad(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
OperandInfo(pad(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
||||||
TargetBytesPerWord),
|
TargetBytesPerWord),
|
||||||
lir::MemoryOperand,
|
lir::Operand::Type::Memory,
|
||||||
&dst));
|
&dst));
|
||||||
|
|
||||||
offset += ceilingDivide(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
offset += ceilingDivide(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
||||||
@ -888,14 +888,14 @@ class MyAssembler : public Assembler {
|
|||||||
if (isBranch(op)) {
|
if (isBranch(op)) {
|
||||||
assertT(&con, a.size == b.size);
|
assertT(&con, a.size == b.size);
|
||||||
assertT(&con, c.size == TargetBytesPerWord);
|
assertT(&con, c.size == TargetBytesPerWord);
|
||||||
assertT(&con, c.type == lir::ConstantOperand);
|
assertT(&con, c.type == lir::Operand::Type::Constant);
|
||||||
|
|
||||||
arch_->con.branchOperations[branchIndex(&(arch_->con), a.type, b.type)](
|
arch_->con.branchOperations[branchIndex(&(arch_->con), a.type, b.type)](
|
||||||
&con, op, a.size, a.operand, b.operand, c.operand);
|
&con, op, a.size, a.operand, b.operand, c.operand);
|
||||||
} else {
|
} else {
|
||||||
assertT(&con, b.size == c.size);
|
assertT(&con, b.size == c.size);
|
||||||
assertT(&con, b.type == lir::RegisterOperand);
|
assertT(&con, b.type == lir::Operand::Type::RegisterPair);
|
||||||
assertT(&con, c.type == lir::RegisterOperand);
|
assertT(&con, c.type == lir::Operand::Type::RegisterPair);
|
||||||
|
|
||||||
arch_->con.ternaryOperations[index(&(arch_->con), op, a.type)](
|
arch_->con.ternaryOperations[index(&(arch_->con), op, a.type)](
|
||||||
&con, b.size, a.operand, b.operand, c.operand);
|
&con, b.size, a.operand, b.operand, c.operand);
|
||||||
|
@ -85,15 +85,15 @@ class ArchitectureContext {
|
|||||||
vm::System* s;
|
vm::System* s;
|
||||||
OperationType operations[lir::OperationCount];
|
OperationType operations[lir::OperationCount];
|
||||||
UnaryOperationType
|
UnaryOperationType
|
||||||
unaryOperations[lir::UnaryOperationCount * lir::OperandTypeCount];
|
unaryOperations[lir::UnaryOperationCount * lir::Operand::TypeCount];
|
||||||
BinaryOperationType binaryOperations[lir::BinaryOperationCount
|
BinaryOperationType binaryOperations[lir::BinaryOperationCount
|
||||||
* lir::OperandTypeCount
|
* lir::Operand::TypeCount
|
||||||
* lir::OperandTypeCount];
|
* lir::Operand::TypeCount];
|
||||||
TernaryOperationType ternaryOperations[lir::NonBranchTernaryOperationCount
|
TernaryOperationType ternaryOperations[lir::NonBranchTernaryOperationCount
|
||||||
* lir::OperandTypeCount];
|
* lir::Operand::TypeCount];
|
||||||
BranchOperationType branchOperations[lir::BranchOperationCount
|
BranchOperationType branchOperations[lir::BranchOperationCount
|
||||||
* lir::OperandTypeCount
|
* lir::Operand::TypeCount
|
||||||
* lir::OperandTypeCount];
|
* lir::Operand::TypeCount];
|
||||||
};
|
};
|
||||||
|
|
||||||
inline avian::util::Aborter* getAborter(Context* c)
|
inline avian::util::Aborter* getAborter(Context* c)
|
||||||
|
@ -22,16 +22,16 @@ using namespace util;
|
|||||||
|
|
||||||
unsigned index(ArchitectureContext*,
|
unsigned index(ArchitectureContext*,
|
||||||
lir::BinaryOperation operation,
|
lir::BinaryOperation operation,
|
||||||
lir::OperandType operand1,
|
lir::Operand::Type operand1,
|
||||||
lir::OperandType operand2)
|
lir::Operand::Type operand2)
|
||||||
{
|
{
|
||||||
return operation + (lir::BinaryOperationCount * operand1)
|
return operation + (lir::BinaryOperationCount * operand1)
|
||||||
+ (lir::BinaryOperationCount * lir::OperandTypeCount * operand2);
|
+ (lir::BinaryOperationCount * lir::Operand::TypeCount * operand2);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned index(ArchitectureContext* con UNUSED,
|
unsigned index(ArchitectureContext* con UNUSED,
|
||||||
lir::TernaryOperation operation,
|
lir::TernaryOperation operation,
|
||||||
lir::OperandType operand1)
|
lir::Operand::Type operand1)
|
||||||
{
|
{
|
||||||
assertT(con, not isBranch(operation));
|
assertT(con, not isBranch(operation));
|
||||||
|
|
||||||
@ -39,18 +39,18 @@ unsigned index(ArchitectureContext* con UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned branchIndex(ArchitectureContext* con UNUSED,
|
unsigned branchIndex(ArchitectureContext* con UNUSED,
|
||||||
lir::OperandType operand1,
|
lir::Operand::Type operand1,
|
||||||
lir::OperandType operand2)
|
lir::Operand::Type operand2)
|
||||||
{
|
{
|
||||||
return operand1 + (lir::OperandTypeCount * operand2);
|
return operand1 + (lir::Operand::TypeCount * operand2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void populateTables(ArchitectureContext* con)
|
void populateTables(ArchitectureContext* con)
|
||||||
{
|
{
|
||||||
const lir::OperandType C = lir::ConstantOperand;
|
const lir::Operand::Type C = lir::Operand::Type::Constant;
|
||||||
const lir::OperandType A = lir::AddressOperand;
|
const lir::Operand::Type A = lir::Operand::Type::Address;
|
||||||
const lir::OperandType R = lir::RegisterOperand;
|
const lir::Operand::Type R = lir::Operand::Type::RegisterPair;
|
||||||
const lir::OperandType M = lir::MemoryOperand;
|
const lir::Operand::Type M = lir::Operand::Type::Memory;
|
||||||
|
|
||||||
OperationType* zo = con->operations;
|
OperationType* zo = con->operations;
|
||||||
UnaryOperationType* uo = con->unaryOperations;
|
UnaryOperationType* uo = con->unaryOperations;
|
||||||
|
@ -25,16 +25,16 @@ namespace arm {
|
|||||||
|
|
||||||
unsigned index(ArchitectureContext*,
|
unsigned index(ArchitectureContext*,
|
||||||
lir::BinaryOperation operation,
|
lir::BinaryOperation operation,
|
||||||
lir::OperandType operand1,
|
lir::Operand::Type operand1,
|
||||||
lir::OperandType operand2);
|
lir::Operand::Type operand2);
|
||||||
|
|
||||||
unsigned index(ArchitectureContext* con UNUSED,
|
unsigned index(ArchitectureContext* con UNUSED,
|
||||||
lir::TernaryOperation operation,
|
lir::TernaryOperation operation,
|
||||||
lir::OperandType operand1);
|
lir::Operand::Type operand1);
|
||||||
|
|
||||||
unsigned branchIndex(ArchitectureContext* con UNUSED,
|
unsigned branchIndex(ArchitectureContext* con UNUSED,
|
||||||
lir::OperandType operand1,
|
lir::Operand::Type operand1,
|
||||||
lir::OperandType operand2);
|
lir::Operand::Type operand2);
|
||||||
|
|
||||||
void populateTables(ArchitectureContext* con);
|
void populateTables(ArchitectureContext* con);
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@ namespace codegen {
|
|||||||
class Multimethod {
|
class Multimethod {
|
||||||
public:
|
public:
|
||||||
inline static unsigned index(lir::UnaryOperation operation,
|
inline static unsigned index(lir::UnaryOperation operation,
|
||||||
lir::OperandType operand)
|
lir::Operand::Type operand)
|
||||||
{
|
{
|
||||||
return operation + (lir::UnaryOperationCount * operand);
|
return operation + (lir::UnaryOperationCount * (unsigned)operand);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -501,8 +501,8 @@ class MyArchitecture : public Architecture {
|
|||||||
OperandMask& aMask,
|
OperandMask& aMask,
|
||||||
bool* thunk)
|
bool* thunk)
|
||||||
{
|
{
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand) | (1 << lir::MemoryOperand)
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Memory)
|
||||||
| (1 << lir::ConstantOperand);
|
| (1 << (unsigned)lir::Operand::Type::Constant);
|
||||||
*thunk = false;
|
*thunk = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,13 +518,13 @@ class MyArchitecture : public Architecture {
|
|||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case lir::Negate:
|
case lir::Negate:
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
aMask.setLowHighRegisterMasks(1 << rax, 1 << rdx);
|
aMask.setLowHighRegisterMasks(1 << rax, 1 << rdx);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lir::Absolute:
|
case lir::Absolute:
|
||||||
if (aSize <= TargetBytesPerWord) {
|
if (aSize <= TargetBytesPerWord) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
aMask.setLowHighRegisterMasks(1 << rax, 0);
|
aMask.setLowHighRegisterMasks(1 << rax, 0);
|
||||||
} else {
|
} else {
|
||||||
*thunk = true;
|
*thunk = true;
|
||||||
@ -533,7 +533,7 @@ class MyArchitecture : public Architecture {
|
|||||||
|
|
||||||
case lir::FloatAbsolute:
|
case lir::FloatAbsolute:
|
||||||
if (useSSE(&c)) {
|
if (useSSE(&c)) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
aMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
aMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
||||||
} else {
|
} else {
|
||||||
*thunk = true;
|
*thunk = true;
|
||||||
@ -543,7 +543,7 @@ class MyArchitecture : public Architecture {
|
|||||||
case lir::FloatNegate:
|
case lir::FloatNegate:
|
||||||
// floatNegateRR does not support doubles
|
// floatNegateRR does not support doubles
|
||||||
if (useSSE(&c) and aSize == 4 and bSize == 4) {
|
if (useSSE(&c) and aSize == 4 and bSize == 4) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
aMask.setLowHighRegisterMasks(FloatRegisterMask, 0);
|
aMask.setLowHighRegisterMasks(FloatRegisterMask, 0);
|
||||||
} else {
|
} else {
|
||||||
*thunk = true;
|
*thunk = true;
|
||||||
@ -552,8 +552,8 @@ class MyArchitecture : public Architecture {
|
|||||||
|
|
||||||
case lir::FloatSquareRoot:
|
case lir::FloatSquareRoot:
|
||||||
if (useSSE(&c)) {
|
if (useSSE(&c)) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand)
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair)
|
||||||
| (1 << lir::MemoryOperand);
|
| (1 << (unsigned)lir::Operand::Type::Memory);
|
||||||
aMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
aMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
||||||
} else {
|
} else {
|
||||||
*thunk = true;
|
*thunk = true;
|
||||||
@ -562,8 +562,8 @@ class MyArchitecture : public Architecture {
|
|||||||
|
|
||||||
case lir::Float2Float:
|
case lir::Float2Float:
|
||||||
if (useSSE(&c)) {
|
if (useSSE(&c)) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand)
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair)
|
||||||
| (1 << lir::MemoryOperand);
|
| (1 << (unsigned)lir::Operand::Type::Memory);
|
||||||
aMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
aMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
||||||
} else {
|
} else {
|
||||||
*thunk = true;
|
*thunk = true;
|
||||||
@ -576,8 +576,8 @@ class MyArchitecture : public Architecture {
|
|||||||
// thunks or produce inline machine code which handles edge
|
// thunks or produce inline machine code which handles edge
|
||||||
// cases properly.
|
// cases properly.
|
||||||
if (false and useSSE(&c) and bSize <= TargetBytesPerWord) {
|
if (false and useSSE(&c) and bSize <= TargetBytesPerWord) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand)
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair)
|
||||||
| (1 << lir::MemoryOperand);
|
| (1 << (unsigned)lir::Operand::Type::Memory);
|
||||||
aMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
aMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
||||||
} else {
|
} else {
|
||||||
*thunk = true;
|
*thunk = true;
|
||||||
@ -586,8 +586,8 @@ class MyArchitecture : public Architecture {
|
|||||||
|
|
||||||
case lir::Int2Float:
|
case lir::Int2Float:
|
||||||
if (useSSE(&c) and aSize <= TargetBytesPerWord) {
|
if (useSSE(&c) and aSize <= TargetBytesPerWord) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand)
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair)
|
||||||
| (1 << lir::MemoryOperand);
|
| (1 << (unsigned)lir::Operand::Type::Memory);
|
||||||
aMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
aMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
||||||
} else {
|
} else {
|
||||||
*thunk = true;
|
*thunk = true;
|
||||||
@ -600,14 +600,14 @@ class MyArchitecture : public Architecture {
|
|||||||
|
|
||||||
if (TargetBytesPerWord == 4) {
|
if (TargetBytesPerWord == 4) {
|
||||||
if (aSize == 4 and bSize == 8) {
|
if (aSize == 4 and bSize == 8) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand)
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair)
|
||||||
| (1 << lir::MemoryOperand);
|
| (1 << (unsigned)lir::Operand::Type::Memory);
|
||||||
const uint32_t mask = GeneralRegisterMask
|
const uint32_t mask = GeneralRegisterMask
|
||||||
& ~((1 << rax) | (1 << rdx));
|
& ~((1 << rax) | (1 << rdx));
|
||||||
aMask.setLowHighRegisterMasks(mask, mask);
|
aMask.setLowHighRegisterMasks(mask, mask);
|
||||||
} else if (aSize == 1 or bSize == 1) {
|
} else if (aSize == 1 or bSize == 1) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand)
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair)
|
||||||
| (1 << lir::MemoryOperand);
|
| (1 << (unsigned)lir::Operand::Type::Memory);
|
||||||
const uint32_t mask = (1 << rax) | (1 << rcx) | (1 << rdx)
|
const uint32_t mask = (1 << rax) | (1 << rcx) | (1 << rdx)
|
||||||
| (1 << rbx);
|
| (1 << rbx);
|
||||||
aMask.setLowHighRegisterMasks(mask, mask);
|
aMask.setLowHighRegisterMasks(mask, mask);
|
||||||
@ -631,18 +631,18 @@ class MyArchitecture : public Architecture {
|
|||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case lir::Absolute:
|
case lir::Absolute:
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
bMask.setLowHighRegisterMasks(1 << rax, 0);
|
bMask.setLowHighRegisterMasks(1 << rax, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lir::FloatAbsolute:
|
case lir::FloatAbsolute:
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
bMask.lowRegisterMask = aMask.lowRegisterMask;
|
bMask.lowRegisterMask = aMask.lowRegisterMask;
|
||||||
bMask.highRegisterMask = aMask.highRegisterMask;
|
bMask.highRegisterMask = aMask.highRegisterMask;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lir::Negate:
|
case lir::Negate:
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
bMask.lowRegisterMask = aMask.lowRegisterMask;
|
bMask.lowRegisterMask = aMask.lowRegisterMask;
|
||||||
bMask.highRegisterMask = aMask.highRegisterMask;
|
bMask.highRegisterMask = aMask.highRegisterMask;
|
||||||
break;
|
break;
|
||||||
@ -651,30 +651,30 @@ class MyArchitecture : public Architecture {
|
|||||||
case lir::FloatSquareRoot:
|
case lir::FloatSquareRoot:
|
||||||
case lir::Float2Float:
|
case lir::Float2Float:
|
||||||
case lir::Int2Float:
|
case lir::Int2Float:
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
bMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
bMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lir::Float2Int:
|
case lir::Float2Int:
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lir::Move:
|
case lir::Move:
|
||||||
if (aMask.typeMask
|
if (aMask.typeMask
|
||||||
& ((1 << lir::MemoryOperand) | 1 << lir::AddressOperand)) {
|
& ((1 << (unsigned)lir::Operand::Type::Memory) | 1 << (unsigned)lir::Operand::Type::Address)) {
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
bMask.setLowHighRegisterMasks(GeneralRegisterMask | FloatRegisterMask, GeneralRegisterMask);
|
bMask.setLowHighRegisterMasks(GeneralRegisterMask | FloatRegisterMask, GeneralRegisterMask);
|
||||||
} else if (aMask.typeMask & (1 << lir::RegisterOperand)) {
|
} else if (aMask.typeMask & (1 << (unsigned)lir::Operand::Type::RegisterPair)) {
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand)
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair)
|
||||||
| (1 << lir::MemoryOperand);
|
| (1 << (unsigned)lir::Operand::Type::Memory);
|
||||||
if (aMask.lowRegisterMask & FloatRegisterMask) {
|
if (aMask.lowRegisterMask & FloatRegisterMask) {
|
||||||
bMask.setLowHighRegisterMasks(FloatRegisterMask, 0);
|
bMask.setLowHighRegisterMasks(FloatRegisterMask, 0);
|
||||||
} else {
|
} else {
|
||||||
bMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
bMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand)
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair)
|
||||||
| (1 << lir::MemoryOperand);
|
| (1 << (unsigned)lir::Operand::Type::Memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TargetBytesPerWord == 4) {
|
if (TargetBytesPerWord == 4) {
|
||||||
@ -704,32 +704,32 @@ class MyArchitecture : public Architecture {
|
|||||||
tmpMask.typeMask = 0;
|
tmpMask.typeMask = 0;
|
||||||
tmpMask.setLowHighRegisterMasks(0, 0);
|
tmpMask.setLowHighRegisterMasks(0, 0);
|
||||||
|
|
||||||
if (dstMask.typeMask & (1 << lir::MemoryOperand)) {
|
if (dstMask.typeMask & (1 << (unsigned)lir::Operand::Type::Memory)) {
|
||||||
// can't move directly from memory to memory
|
// can't move directly from memory to memory
|
||||||
srcMask.typeMask = (1 << lir::RegisterOperand)
|
srcMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair)
|
||||||
| (1 << lir::ConstantOperand);
|
| (1 << (unsigned)lir::Operand::Type::Constant);
|
||||||
tmpMask.typeMask = 1 << lir::RegisterOperand;
|
tmpMask.typeMask = 1 << (unsigned)lir::Operand::Type::RegisterPair;
|
||||||
tmpMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
tmpMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
||||||
} else if (dstMask.typeMask & (1 << lir::RegisterOperand)) {
|
} else if (dstMask.typeMask & (1 << (unsigned)lir::Operand::Type::RegisterPair)) {
|
||||||
if (size > TargetBytesPerWord) {
|
if (size > TargetBytesPerWord) {
|
||||||
// can't move directly from FPR to GPR or vice-versa for
|
// can't move directly from FPR to GPR or vice-versa for
|
||||||
// values larger than the GPR size
|
// values larger than the GPR size
|
||||||
if (dstMask.lowRegisterMask & FloatRegisterMask) {
|
if (dstMask.lowRegisterMask & FloatRegisterMask) {
|
||||||
srcMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
srcMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
||||||
tmpMask.typeMask = 1 << lir::MemoryOperand;
|
tmpMask.typeMask = 1 << (unsigned)lir::Operand::Type::Memory;
|
||||||
} else if (dstMask.lowRegisterMask & GeneralRegisterMask) {
|
} else if (dstMask.lowRegisterMask & GeneralRegisterMask) {
|
||||||
srcMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
srcMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
||||||
tmpMask.typeMask = 1 << lir::MemoryOperand;
|
tmpMask.typeMask = 1 << (unsigned)lir::Operand::Type::Memory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dstMask.lowRegisterMask & FloatRegisterMask) {
|
if (dstMask.lowRegisterMask & FloatRegisterMask) {
|
||||||
// can't move directly from constant to FPR
|
// can't move directly from constant to FPR
|
||||||
srcMask.typeMask &= ~(1 << lir::ConstantOperand);
|
srcMask.typeMask &= ~(1 << (unsigned)lir::Operand::Type::Constant);
|
||||||
if (size > TargetBytesPerWord) {
|
if (size > TargetBytesPerWord) {
|
||||||
tmpMask.typeMask = 1 << lir::MemoryOperand;
|
tmpMask.typeMask = 1 << (unsigned)lir::Operand::Type::Memory;
|
||||||
} else {
|
} else {
|
||||||
tmpMask.typeMask = (1 << lir::RegisterOperand)
|
tmpMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair)
|
||||||
| (1 << lir::MemoryOperand);
|
| (1 << (unsigned)lir::Operand::Type::Memory);
|
||||||
tmpMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
tmpMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -744,10 +744,10 @@ class MyArchitecture : public Architecture {
|
|||||||
unsigned,
|
unsigned,
|
||||||
bool* thunk)
|
bool* thunk)
|
||||||
{
|
{
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand) | (1 << lir::ConstantOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Constant);
|
||||||
aMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
aMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
||||||
|
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
bMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
bMask.setLowHighRegisterMasks(GeneralRegisterMask, GeneralRegisterMask);
|
||||||
|
|
||||||
*thunk = false;
|
*thunk = false;
|
||||||
@ -758,9 +758,9 @@ class MyArchitecture : public Architecture {
|
|||||||
case lir::FloatMultiply:
|
case lir::FloatMultiply:
|
||||||
case lir::FloatDivide:
|
case lir::FloatDivide:
|
||||||
if (useSSE(&c)) {
|
if (useSSE(&c)) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand)
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair)
|
||||||
| (1 << lir::MemoryOperand);
|
| (1 << (unsigned)lir::Operand::Type::Memory);
|
||||||
bMask.typeMask = (1 << lir::RegisterOperand);
|
bMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
|
|
||||||
aMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
aMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
||||||
bMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
bMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
||||||
@ -788,7 +788,7 @@ class MyArchitecture : public Architecture {
|
|||||||
if (TargetBytesPerWord == 4 and aSize == 8) {
|
if (TargetBytesPerWord == 4 and aSize == 8) {
|
||||||
*thunk = true;
|
*thunk = true;
|
||||||
} else {
|
} else {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
aMask.setLowHighRegisterMasks(GeneralRegisterMask & ~((1 << rax) | (1 << rdx)), 0);
|
aMask.setLowHighRegisterMasks(GeneralRegisterMask & ~((1 << rax) | (1 << rdx)), 0);
|
||||||
bMask.setLowHighRegisterMasks(1 << rax, 0);
|
bMask.setLowHighRegisterMasks(1 << rax, 0);
|
||||||
}
|
}
|
||||||
@ -798,7 +798,7 @@ class MyArchitecture : public Architecture {
|
|||||||
if (TargetBytesPerWord == 4 and aSize == 8) {
|
if (TargetBytesPerWord == 4 and aSize == 8) {
|
||||||
*thunk = true;
|
*thunk = true;
|
||||||
} else {
|
} else {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
aMask.setLowHighRegisterMasks(GeneralRegisterMask & ~((1 << rax) | (1 << rdx)), 0);
|
aMask.setLowHighRegisterMasks(GeneralRegisterMask & ~((1 << rax) | (1 << rdx)), 0);
|
||||||
bMask.setLowHighRegisterMasks(1 << rax, 0);
|
bMask.setLowHighRegisterMasks(1 << rax, 0);
|
||||||
}
|
}
|
||||||
@ -829,7 +829,7 @@ class MyArchitecture : public Architecture {
|
|||||||
case lir::JumpIfFloatLessOrEqualOrUnordered:
|
case lir::JumpIfFloatLessOrEqualOrUnordered:
|
||||||
case lir::JumpIfFloatGreaterOrEqualOrUnordered:
|
case lir::JumpIfFloatGreaterOrEqualOrUnordered:
|
||||||
if (useSSE(&c)) {
|
if (useSSE(&c)) {
|
||||||
aMask.typeMask = (1 << lir::RegisterOperand);
|
aMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
aMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
aMask.setLowHighRegisterMasks(FloatRegisterMask, FloatRegisterMask);
|
||||||
bMask.typeMask = aMask.typeMask;
|
bMask.typeMask = aMask.typeMask;
|
||||||
bMask.lowRegisterMask = aMask.lowRegisterMask;
|
bMask.lowRegisterMask = aMask.lowRegisterMask;
|
||||||
@ -853,10 +853,10 @@ class MyArchitecture : public Architecture {
|
|||||||
OperandMask& cMask)
|
OperandMask& cMask)
|
||||||
{
|
{
|
||||||
if (isBranch(op)) {
|
if (isBranch(op)) {
|
||||||
cMask.typeMask = (1 << lir::ConstantOperand);
|
cMask.typeMask = (1 << (unsigned)lir::Operand::Type::Constant);
|
||||||
cMask.setLowHighRegisterMasks(0, 0);
|
cMask.setLowHighRegisterMasks(0, 0);
|
||||||
} else {
|
} else {
|
||||||
cMask.typeMask = (1 << lir::RegisterOperand);
|
cMask.typeMask = (1 << (unsigned)lir::Operand::Type::RegisterPair);
|
||||||
cMask.lowRegisterMask = bMask.lowRegisterMask;
|
cMask.lowRegisterMask = bMask.lowRegisterMask;
|
||||||
cMask.highRegisterMask = bMask.highRegisterMask;
|
cMask.highRegisterMask = bMask.highRegisterMask;
|
||||||
}
|
}
|
||||||
@ -918,8 +918,8 @@ class MyAssembler : public Assembler {
|
|||||||
lir::Register stack(rsp);
|
lir::Register stack(rsp);
|
||||||
lir::Memory stackDst(rbx, stackOffset);
|
lir::Memory stackDst(rbx, stackOffset);
|
||||||
apply(lir::Move,
|
apply(lir::Move,
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &stack),
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &stack),
|
||||||
OperandInfo(TargetBytesPerWord, lir::MemoryOperand, &stackDst));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::Memory, &stackDst));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void pushFrame(unsigned argumentCount, ...)
|
virtual void pushFrame(unsigned argumentCount, ...)
|
||||||
@ -927,7 +927,7 @@ class MyAssembler : public Assembler {
|
|||||||
// TODO: Argument should be replaced by OperandInfo...
|
// TODO: Argument should be replaced by OperandInfo...
|
||||||
struct Argument {
|
struct Argument {
|
||||||
unsigned size;
|
unsigned size;
|
||||||
lir::OperandType type;
|
lir::Operand::Type type;
|
||||||
lir::Operand* operand;
|
lir::Operand* operand;
|
||||||
};
|
};
|
||||||
RUNTIME_ARRAY(Argument, arguments, argumentCount);
|
RUNTIME_ARRAY(Argument, arguments, argumentCount);
|
||||||
@ -937,7 +937,7 @@ class MyAssembler : public Assembler {
|
|||||||
for (unsigned i = 0; i < argumentCount; ++i) {
|
for (unsigned i = 0; i < argumentCount; ++i) {
|
||||||
RUNTIME_ARRAY_BODY(arguments)[i].size = va_arg(a, unsigned);
|
RUNTIME_ARRAY_BODY(arguments)[i].size = va_arg(a, unsigned);
|
||||||
RUNTIME_ARRAY_BODY(arguments)[i].type
|
RUNTIME_ARRAY_BODY(arguments)[i].type
|
||||||
= static_cast<lir::OperandType>(va_arg(a, int));
|
= static_cast<lir::Operand::Type>(va_arg(a, int));
|
||||||
RUNTIME_ARRAY_BODY(arguments)[i].operand = va_arg(a, lir::Operand*);
|
RUNTIME_ARRAY_BODY(arguments)[i].operand = va_arg(a, lir::Operand*);
|
||||||
footprint += ceilingDivide(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
footprint += ceilingDivide(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
||||||
TargetBytesPerWord);
|
TargetBytesPerWord);
|
||||||
@ -956,7 +956,7 @@ class MyAssembler : public Assembler {
|
|||||||
RUNTIME_ARRAY_BODY(arguments)[i].operand),
|
RUNTIME_ARRAY_BODY(arguments)[i].operand),
|
||||||
OperandInfo(pad(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
OperandInfo(pad(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
||||||
TargetBytesPerWord),
|
TargetBytesPerWord),
|
||||||
lir::RegisterOperand,
|
lir::Operand::Type::RegisterPair,
|
||||||
&dst));
|
&dst));
|
||||||
} else {
|
} else {
|
||||||
lir::Memory dst(rsp, offset * TargetBytesPerWord);
|
lir::Memory dst(rsp, offset * TargetBytesPerWord);
|
||||||
@ -966,7 +966,7 @@ class MyAssembler : public Assembler {
|
|||||||
RUNTIME_ARRAY_BODY(arguments)[i].operand),
|
RUNTIME_ARRAY_BODY(arguments)[i].operand),
|
||||||
OperandInfo(pad(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
OperandInfo(pad(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
||||||
TargetBytesPerWord),
|
TargetBytesPerWord),
|
||||||
lir::MemoryOperand,
|
lir::Operand::Type::Memory,
|
||||||
&dst));
|
&dst));
|
||||||
offset += ceilingDivide(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
offset += ceilingDivide(RUNTIME_ARRAY_BODY(arguments)[i].size,
|
||||||
TargetBytesPerWord);
|
TargetBytesPerWord);
|
||||||
@ -983,17 +983,17 @@ class MyAssembler : public Assembler {
|
|||||||
pushR(&c, TargetBytesPerWord, &base);
|
pushR(&c, TargetBytesPerWord, &base);
|
||||||
|
|
||||||
apply(lir::Move,
|
apply(lir::Move,
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &stack),
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &stack),
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &base));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &base));
|
||||||
}
|
}
|
||||||
|
|
||||||
lir::Constant footprintConstant(
|
lir::Constant footprintConstant(
|
||||||
resolvedPromise(&c, footprint * TargetBytesPerWord));
|
resolvedPromise(&c, footprint * TargetBytesPerWord));
|
||||||
apply(lir::Subtract,
|
apply(lir::Subtract,
|
||||||
OperandInfo(
|
OperandInfo(
|
||||||
TargetBytesPerWord, lir::ConstantOperand, &footprintConstant),
|
TargetBytesPerWord, lir::Operand::Type::Constant, &footprintConstant),
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &stack),
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &stack),
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &stack));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void adjustFrame(unsigned difference)
|
virtual void adjustFrame(unsigned difference)
|
||||||
@ -1003,9 +1003,9 @@ class MyAssembler : public Assembler {
|
|||||||
resolvedPromise(&c, difference * TargetBytesPerWord));
|
resolvedPromise(&c, difference * TargetBytesPerWord));
|
||||||
apply(lir::Subtract,
|
apply(lir::Subtract,
|
||||||
OperandInfo(
|
OperandInfo(
|
||||||
TargetBytesPerWord, lir::ConstantOperand, &differenceConstant),
|
TargetBytesPerWord, lir::Operand::Type::Constant, &differenceConstant),
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &stack),
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &stack),
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &stack));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void popFrame(unsigned frameFootprint)
|
virtual void popFrame(unsigned frameFootprint)
|
||||||
@ -1014,8 +1014,8 @@ class MyAssembler : public Assembler {
|
|||||||
lir::Register base(rbp);
|
lir::Register base(rbp);
|
||||||
lir::Register stack(rsp);
|
lir::Register stack(rsp);
|
||||||
apply(lir::Move,
|
apply(lir::Move,
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &base),
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &base),
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &stack));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &stack));
|
||||||
|
|
||||||
popR(&c, TargetBytesPerWord, &base);
|
popR(&c, TargetBytesPerWord, &base);
|
||||||
} else {
|
} else {
|
||||||
@ -1023,9 +1023,9 @@ class MyAssembler : public Assembler {
|
|||||||
lir::Constant footprint(
|
lir::Constant footprint(
|
||||||
resolvedPromise(&c, frameFootprint * TargetBytesPerWord));
|
resolvedPromise(&c, frameFootprint * TargetBytesPerWord));
|
||||||
apply(lir::Add,
|
apply(lir::Add,
|
||||||
OperandInfo(TargetBytesPerWord, lir::ConstantOperand, &footprint),
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::Constant, &footprint),
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &stack),
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &stack),
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &stack));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &stack));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1157,7 +1157,7 @@ class MyAssembler : public Assembler {
|
|||||||
if (isBranch(op)) {
|
if (isBranch(op)) {
|
||||||
assertT(&this->c, a.size == b.size);
|
assertT(&this->c, a.size == b.size);
|
||||||
assertT(&this->c, c.size == TargetBytesPerWord);
|
assertT(&this->c, c.size == TargetBytesPerWord);
|
||||||
assertT(&this->c, c.type == lir::ConstantOperand);
|
assertT(&this->c, c.type == lir::Operand::Type::Constant);
|
||||||
|
|
||||||
arch_->c.branchOperations[branchIndex(&(arch_->c), a.type, b.type)](
|
arch_->c.branchOperations[branchIndex(&(arch_->c), a.type, b.type)](
|
||||||
&this->c, op, a.size, a.operand, b.operand, c.operand);
|
&this->c, op, a.size, a.operand, b.operand, c.operand);
|
||||||
|
@ -68,13 +68,13 @@ class ArchitectureContext {
|
|||||||
bool useNativeFeatures;
|
bool useNativeFeatures;
|
||||||
OperationType operations[lir::OperationCount];
|
OperationType operations[lir::OperationCount];
|
||||||
UnaryOperationType
|
UnaryOperationType
|
||||||
unaryOperations[lir::UnaryOperationCount * lir::OperandTypeCount];
|
unaryOperations[lir::UnaryOperationCount * lir::Operand::TypeCount];
|
||||||
BinaryOperationType binaryOperations
|
BinaryOperationType binaryOperations
|
||||||
[(lir::BinaryOperationCount + lir::NonBranchTernaryOperationCount)
|
[(lir::BinaryOperationCount + lir::NonBranchTernaryOperationCount)
|
||||||
* lir::OperandTypeCount * lir::OperandTypeCount];
|
* lir::Operand::TypeCount * lir::Operand::TypeCount];
|
||||||
BranchOperationType branchOperations[lir::BranchOperationCount
|
BranchOperationType branchOperations[lir::BranchOperationCount
|
||||||
* lir::OperandTypeCount
|
* lir::Operand::TypeCount
|
||||||
* lir::OperandTypeCount];
|
* lir::Operand::TypeCount];
|
||||||
};
|
};
|
||||||
|
|
||||||
class Context {
|
class Context {
|
||||||
|
@ -28,42 +28,42 @@ using namespace util;
|
|||||||
|
|
||||||
unsigned index(ArchitectureContext*,
|
unsigned index(ArchitectureContext*,
|
||||||
lir::BinaryOperation operation,
|
lir::BinaryOperation operation,
|
||||||
lir::OperandType operand1,
|
lir::Operand::Type operand1,
|
||||||
lir::OperandType operand2)
|
lir::Operand::Type operand2)
|
||||||
{
|
{
|
||||||
return operation + ((lir::BinaryOperationCount
|
return operation + ((lir::BinaryOperationCount
|
||||||
+ lir::NonBranchTernaryOperationCount) * operand1)
|
+ lir::NonBranchTernaryOperationCount) * (unsigned)operand1)
|
||||||
+ ((lir::BinaryOperationCount + lir::NonBranchTernaryOperationCount)
|
+ ((lir::BinaryOperationCount + lir::NonBranchTernaryOperationCount)
|
||||||
* lir::OperandTypeCount * operand2);
|
* lir::Operand::TypeCount * (unsigned)operand2);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned index(ArchitectureContext* c UNUSED,
|
unsigned index(ArchitectureContext* c UNUSED,
|
||||||
lir::TernaryOperation operation,
|
lir::TernaryOperation operation,
|
||||||
lir::OperandType operand1,
|
lir::Operand::Type operand1,
|
||||||
lir::OperandType operand2)
|
lir::Operand::Type operand2)
|
||||||
{
|
{
|
||||||
assertT(c, not isBranch(operation));
|
assertT(c, not isBranch(operation));
|
||||||
|
|
||||||
return lir::BinaryOperationCount + operation
|
return lir::BinaryOperationCount + operation
|
||||||
+ ((lir::BinaryOperationCount + lir::NonBranchTernaryOperationCount)
|
+ ((lir::BinaryOperationCount + lir::NonBranchTernaryOperationCount)
|
||||||
* operand1)
|
* (unsigned)operand1)
|
||||||
+ ((lir::BinaryOperationCount + lir::NonBranchTernaryOperationCount)
|
+ ((lir::BinaryOperationCount + lir::NonBranchTernaryOperationCount)
|
||||||
* lir::OperandTypeCount * operand2);
|
* lir::Operand::TypeCount * (unsigned)operand2);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned branchIndex(ArchitectureContext* c UNUSED,
|
unsigned branchIndex(ArchitectureContext* c UNUSED,
|
||||||
lir::OperandType operand1,
|
lir::Operand::Type operand1,
|
||||||
lir::OperandType operand2)
|
lir::Operand::Type operand2)
|
||||||
{
|
{
|
||||||
return operand1 + (lir::OperandTypeCount * operand2);
|
return (unsigned)operand1 + (lir::Operand::TypeCount * (unsigned)operand2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void populateTables(ArchitectureContext* c)
|
void populateTables(ArchitectureContext* c)
|
||||||
{
|
{
|
||||||
const lir::OperandType C = lir::ConstantOperand;
|
const lir::Operand::Type C = lir::Operand::Type::Constant;
|
||||||
const lir::OperandType A = lir::AddressOperand;
|
const lir::Operand::Type A = lir::Operand::Type::Address;
|
||||||
const lir::OperandType R = lir::RegisterOperand;
|
const lir::Operand::Type R = lir::Operand::Type::RegisterPair;
|
||||||
const lir::OperandType M = lir::MemoryOperand;
|
const lir::Operand::Type M = lir::Operand::Type::Memory;
|
||||||
|
|
||||||
OperationType* zo = c->operations;
|
OperationType* zo = c->operations;
|
||||||
UnaryOperationType* uo = c->unaryOperations;
|
UnaryOperationType* uo = c->unaryOperations;
|
||||||
|
@ -23,17 +23,17 @@ class ArchitectureContext;
|
|||||||
|
|
||||||
unsigned index(ArchitectureContext*,
|
unsigned index(ArchitectureContext*,
|
||||||
lir::BinaryOperation operation,
|
lir::BinaryOperation operation,
|
||||||
lir::OperandType operand1,
|
lir::Operand::Type operand1,
|
||||||
lir::OperandType operand2);
|
lir::Operand::Type operand2);
|
||||||
|
|
||||||
unsigned index(ArchitectureContext* c UNUSED,
|
unsigned index(ArchitectureContext* c UNUSED,
|
||||||
lir::TernaryOperation operation,
|
lir::TernaryOperation operation,
|
||||||
lir::OperandType operand1,
|
lir::Operand::Type operand1,
|
||||||
lir::OperandType operand2);
|
lir::Operand::Type operand2);
|
||||||
|
|
||||||
unsigned branchIndex(ArchitectureContext* c UNUSED,
|
unsigned branchIndex(ArchitectureContext* c UNUSED,
|
||||||
lir::OperandType operand1,
|
lir::Operand::Type operand1,
|
||||||
lir::OperandType operand2);
|
lir::Operand::Type operand2);
|
||||||
|
|
||||||
void populateTables(ArchitectureContext* c);
|
void populateTables(ArchitectureContext* c);
|
||||||
|
|
||||||
|
@ -9785,20 +9785,20 @@ void compileCall(MyThread* t, Context* c, ThunkIndex index, bool call = true)
|
|||||||
lir::Memory table(t->arch->thread(), TARGET_THREAD_THUNKTABLE);
|
lir::Memory table(t->arch->thread(), TARGET_THREAD_THUNKTABLE);
|
||||||
lir::Register scratch(t->arch->scratch());
|
lir::Register scratch(t->arch->scratch());
|
||||||
a->apply(lir::Move,
|
a->apply(lir::Move,
|
||||||
OperandInfo(TargetBytesPerWord, lir::MemoryOperand, &table),
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::Memory, &table),
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &scratch));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &scratch));
|
||||||
lir::Memory proc(scratch.low, index * TargetBytesPerWord);
|
lir::Memory proc(scratch.low, index * TargetBytesPerWord);
|
||||||
a->apply(lir::Move,
|
a->apply(lir::Move,
|
||||||
OperandInfo(TargetBytesPerWord, lir::MemoryOperand, &proc),
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::Memory, &proc),
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &scratch));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &scratch));
|
||||||
a->apply(call ? lir::Call : lir::Jump,
|
a->apply(call ? lir::Call : lir::Jump,
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &scratch));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &scratch));
|
||||||
} else {
|
} else {
|
||||||
lir::Constant proc(new (&c->zone) avian::codegen::ResolvedPromise(
|
lir::Constant proc(new (&c->zone) avian::codegen::ResolvedPromise(
|
||||||
reinterpret_cast<intptr_t>(t->thunkTable[index])));
|
reinterpret_cast<intptr_t>(t->thunkTable[index])));
|
||||||
|
|
||||||
a->apply(call ? lir::LongCall : lir::LongJump,
|
a->apply(call ? lir::LongCall : lir::LongJump,
|
||||||
OperandInfo(TargetBytesPerWord, lir::ConstantOperand, &proc));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::Constant, &proc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9815,7 +9815,7 @@ void compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
p->thunks.default_.frameSavedOffset = a->length();
|
p->thunks.default_.frameSavedOffset = a->length();
|
||||||
|
|
||||||
lir::Register thread(t->arch->thread());
|
lir::Register thread(t->arch->thread());
|
||||||
a->pushFrame(1, TargetBytesPerWord, lir::RegisterOperand, &thread);
|
a->pushFrame(1, TargetBytesPerWord, lir::Operand::Type::RegisterPair, &thread);
|
||||||
|
|
||||||
compileCall(t, &context, compileMethodIndex);
|
compileCall(t, &context, compileMethodIndex);
|
||||||
|
|
||||||
@ -9823,7 +9823,7 @@ void compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
|
|
||||||
lir::Register result(t->arch->returnLow());
|
lir::Register result(t->arch->returnLow());
|
||||||
a->apply(lir::Jump,
|
a->apply(lir::Jump,
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &result));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &result));
|
||||||
|
|
||||||
p->thunks.default_.length = a->endBlock(false)->resolve(0, 0);
|
p->thunks.default_.length = a->endBlock(false)->resolve(0, 0);
|
||||||
|
|
||||||
@ -9843,17 +9843,17 @@ void compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
|
|
||||||
a->apply(lir::Move,
|
a->apply(lir::Move,
|
||||||
OperandInfo(
|
OperandInfo(
|
||||||
TargetBytesPerWord, lir::MemoryOperand, &virtualCallTargetSrc),
|
TargetBytesPerWord, lir::Operand::Type::Memory, &virtualCallTargetSrc),
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &class_));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &class_));
|
||||||
|
|
||||||
lir::Memory virtualCallTargetDst(t->arch->thread(),
|
lir::Memory virtualCallTargetDst(t->arch->thread(),
|
||||||
TARGET_THREAD_VIRTUALCALLTARGET);
|
TARGET_THREAD_VIRTUALCALLTARGET);
|
||||||
|
|
||||||
a->apply(
|
a->apply(
|
||||||
lir::Move,
|
lir::Move,
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &class_),
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &class_),
|
||||||
OperandInfo(
|
OperandInfo(
|
||||||
TargetBytesPerWord, lir::MemoryOperand, &virtualCallTargetDst));
|
TargetBytesPerWord, lir::Operand::Type::Memory, &virtualCallTargetDst));
|
||||||
|
|
||||||
lir::Register index(t->arch->virtualCallIndex());
|
lir::Register index(t->arch->virtualCallIndex());
|
||||||
lir::Memory virtualCallIndex(t->arch->thread(),
|
lir::Memory virtualCallIndex(t->arch->thread(),
|
||||||
@ -9861,15 +9861,15 @@ void compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
|
|
||||||
a->apply(
|
a->apply(
|
||||||
lir::Move,
|
lir::Move,
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &index),
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &index),
|
||||||
OperandInfo(TargetBytesPerWord, lir::MemoryOperand, &virtualCallIndex));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::Memory, &virtualCallIndex));
|
||||||
|
|
||||||
a->saveFrame(TARGET_THREAD_STACK, TARGET_THREAD_IP);
|
a->saveFrame(TARGET_THREAD_STACK, TARGET_THREAD_IP);
|
||||||
|
|
||||||
p->thunks.defaultVirtual.frameSavedOffset = a->length();
|
p->thunks.defaultVirtual.frameSavedOffset = a->length();
|
||||||
|
|
||||||
lir::Register thread(t->arch->thread());
|
lir::Register thread(t->arch->thread());
|
||||||
a->pushFrame(1, TargetBytesPerWord, lir::RegisterOperand, &thread);
|
a->pushFrame(1, TargetBytesPerWord, lir::Operand::Type::RegisterPair, &thread);
|
||||||
|
|
||||||
compileCall(t, &context, compileVirtualMethodIndex);
|
compileCall(t, &context, compileVirtualMethodIndex);
|
||||||
|
|
||||||
@ -9877,7 +9877,7 @@ void compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
|
|
||||||
lir::Register result(t->arch->returnLow());
|
lir::Register result(t->arch->returnLow());
|
||||||
a->apply(lir::Jump,
|
a->apply(lir::Jump,
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &result));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &result));
|
||||||
|
|
||||||
p->thunks.defaultVirtual.length = a->endBlock(false)->resolve(0, 0);
|
p->thunks.defaultVirtual.length = a->endBlock(false)->resolve(0, 0);
|
||||||
|
|
||||||
@ -9894,7 +9894,7 @@ void compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
p->thunks.native.frameSavedOffset = a->length();
|
p->thunks.native.frameSavedOffset = a->length();
|
||||||
|
|
||||||
lir::Register thread(t->arch->thread());
|
lir::Register thread(t->arch->thread());
|
||||||
a->pushFrame(1, TargetBytesPerWord, lir::RegisterOperand, &thread);
|
a->pushFrame(1, TargetBytesPerWord, lir::Operand::Type::RegisterPair, &thread);
|
||||||
|
|
||||||
compileCall(t, &context, invokeNativeIndex);
|
compileCall(t, &context, invokeNativeIndex);
|
||||||
|
|
||||||
@ -9916,7 +9916,7 @@ void compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
p->thunks.aioob.frameSavedOffset = a->length();
|
p->thunks.aioob.frameSavedOffset = a->length();
|
||||||
|
|
||||||
lir::Register thread(t->arch->thread());
|
lir::Register thread(t->arch->thread());
|
||||||
a->pushFrame(1, TargetBytesPerWord, lir::RegisterOperand, &thread);
|
a->pushFrame(1, TargetBytesPerWord, lir::Operand::Type::RegisterPair, &thread);
|
||||||
|
|
||||||
compileCall(t, &context, throwArrayIndexOutOfBoundsIndex);
|
compileCall(t, &context, throwArrayIndexOutOfBoundsIndex);
|
||||||
|
|
||||||
@ -9935,7 +9935,7 @@ void compileThunks(MyThread* t, FixedAllocator* allocator)
|
|||||||
p->thunks.stackOverflow.frameSavedOffset = a->length();
|
p->thunks.stackOverflow.frameSavedOffset = a->length();
|
||||||
|
|
||||||
lir::Register thread(t->arch->thread());
|
lir::Register thread(t->arch->thread());
|
||||||
a->pushFrame(1, TargetBytesPerWord, lir::RegisterOperand, &thread);
|
a->pushFrame(1, TargetBytesPerWord, lir::Operand::Type::RegisterPair, &thread);
|
||||||
|
|
||||||
compileCall(t, &context, throwStackOverflowIndex);
|
compileCall(t, &context, throwStackOverflowIndex);
|
||||||
|
|
||||||
@ -10061,14 +10061,14 @@ uintptr_t compileVirtualThunk(MyThread* t, unsigned index, unsigned* size)
|
|||||||
lir::Register indexRegister(t->arch->virtualCallIndex());
|
lir::Register indexRegister(t->arch->virtualCallIndex());
|
||||||
a->apply(
|
a->apply(
|
||||||
lir::Move,
|
lir::Move,
|
||||||
OperandInfo(TargetBytesPerWord, lir::ConstantOperand, &indexConstant),
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::Constant, &indexConstant),
|
||||||
OperandInfo(TargetBytesPerWord, lir::RegisterOperand, &indexRegister));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::RegisterPair, &indexRegister));
|
||||||
|
|
||||||
avian::codegen::ResolvedPromise defaultVirtualThunkPromise(
|
avian::codegen::ResolvedPromise defaultVirtualThunkPromise(
|
||||||
defaultVirtualThunk(t));
|
defaultVirtualThunk(t));
|
||||||
lir::Constant thunk(&defaultVirtualThunkPromise);
|
lir::Constant thunk(&defaultVirtualThunkPromise);
|
||||||
a->apply(lir::Jump,
|
a->apply(lir::Jump,
|
||||||
OperandInfo(TargetBytesPerWord, lir::ConstantOperand, &thunk));
|
OperandInfo(TargetBytesPerWord, lir::Operand::Type::Constant, &thunk));
|
||||||
|
|
||||||
*size = a->endBlock(false)->resolve(0, 0);
|
*size = a->endBlock(false)->resolve(0, 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user