mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
make BoundedRegisterMask a subclass of RegisterMask
This commit is contained in:
parent
6b889b1d78
commit
a3ccc94cf5
@ -95,9 +95,8 @@ constexpr RegisterMask Register::operator | (Register o) const {
|
|||||||
return RegisterMask(*this) | o;
|
return RegisterMask(*this) | o;
|
||||||
}
|
}
|
||||||
|
|
||||||
class BoundedRegisterMask {
|
class BoundedRegisterMask : public RegisterMask {
|
||||||
public:
|
public:
|
||||||
RegisterMask mask;
|
|
||||||
uint8_t start;
|
uint8_t start;
|
||||||
uint8_t limit;
|
uint8_t limit;
|
||||||
|
|
||||||
@ -105,7 +104,7 @@ class BoundedRegisterMask {
|
|||||||
static unsigned maskLimit(RegisterMask mask);
|
static unsigned maskLimit(RegisterMask mask);
|
||||||
|
|
||||||
inline BoundedRegisterMask(RegisterMask mask)
|
inline BoundedRegisterMask(RegisterMask mask)
|
||||||
: mask(mask), start(maskStart(mask)), limit(maskLimit(mask))
|
: RegisterMask(mask), start(maskStart(mask)), limit(maskLimit(mask))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -144,7 +143,7 @@ class RegisterIterator {
|
|||||||
int r = index;
|
int r = index;
|
||||||
do {
|
do {
|
||||||
index++;
|
index++;
|
||||||
} while (index < mask.limit && !(mask.mask.contains(Register(index))));
|
} while (index < mask.limit && !(mask.contains(Register(index))));
|
||||||
return Register(r);
|
return Register(r);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -515,14 +515,14 @@ void steal(Context* c, Resource* r, Value* thief)
|
|||||||
SiteMask generalRegisterMask(Context* c)
|
SiteMask generalRegisterMask(Context* c)
|
||||||
{
|
{
|
||||||
return SiteMask(1 << (unsigned)lir::Operand::Type::RegisterPair,
|
return SiteMask(1 << (unsigned)lir::Operand::Type::RegisterPair,
|
||||||
c->regFile->generalRegisters.mask,
|
c->regFile->generalRegisters,
|
||||||
NoFrameIndex);
|
NoFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
SiteMask generalRegisterOrConstantMask(Context* c)
|
SiteMask generalRegisterOrConstantMask(Context* c)
|
||||||
{
|
{
|
||||||
return SiteMask((1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Constant),
|
return SiteMask((1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Constant),
|
||||||
c->regFile->generalRegisters.mask,
|
c->regFile->generalRegisters,
|
||||||
NoFrameIndex);
|
NoFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -874,7 +874,7 @@ void maybeMove(Context* c,
|
|||||||
c->arch->planSource(op, dstSize, src, dstSize, &thunk);
|
c->arch->planSource(op, dstSize, src, dstSize, &thunk);
|
||||||
|
|
||||||
if (isGeneralValue(srcValue)) {
|
if (isGeneralValue(srcValue)) {
|
||||||
src.lowRegisterMask &= c->regFile->generalRegisters.mask;
|
src.lowRegisterMask &= c->regFile->generalRegisters;
|
||||||
}
|
}
|
||||||
|
|
||||||
assertT(c, thunk == 0);
|
assertT(c, thunk == 0);
|
||||||
@ -1636,7 +1636,7 @@ bool resolveSourceSites(Context* c,
|
|||||||
|
|
||||||
if (r and sites[el.localIndex] == 0) {
|
if (r and sites[el.localIndex] == 0) {
|
||||||
SiteMask mask((1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Memory),
|
SiteMask mask((1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Memory),
|
||||||
c->regFile->generalRegisters.mask,
|
c->regFile->generalRegisters,
|
||||||
AnyFrameIndex);
|
AnyFrameIndex);
|
||||||
|
|
||||||
Site* s = pickSourceSite(
|
Site* s = pickSourceSite(
|
||||||
@ -1678,7 +1678,7 @@ void resolveTargetSites(Context* c,
|
|||||||
|
|
||||||
if (r and sites[el.localIndex] == 0) {
|
if (r and sites[el.localIndex] == 0) {
|
||||||
SiteMask mask((1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Memory),
|
SiteMask mask((1 << (unsigned)lir::Operand::Type::RegisterPair) | (1 << (unsigned)lir::Operand::Type::Memory),
|
||||||
c->regFile->generalRegisters.mask,
|
c->regFile->generalRegisters,
|
||||||
AnyFrameIndex);
|
AnyFrameIndex);
|
||||||
|
|
||||||
Site* s = pickSourceSite(
|
Site* s = pickSourceSite(
|
||||||
|
@ -372,7 +372,7 @@ class CallEvent : public Event {
|
|||||||
? arguments.count
|
? arguments.count
|
||||||
: 0)
|
: 0)
|
||||||
{
|
{
|
||||||
RegisterMask registerMask = c->regFile->generalRegisters.mask;
|
RegisterMask registerMask = c->regFile->generalRegisters;
|
||||||
|
|
||||||
if (callingConvention == ir::CallingConvention::Native) {
|
if (callingConvention == ir::CallingConvention::Native) {
|
||||||
assertT(c, (flags & Compiler::TailJump) == 0);
|
assertT(c, (flags & Compiler::TailJump) == 0);
|
||||||
|
@ -94,7 +94,7 @@ Register pickRegisterTarget(Context* c,
|
|||||||
Register target = NoRegister;
|
Register target = NoRegister;
|
||||||
*cost = Target::Impossible;
|
*cost = Target::Impossible;
|
||||||
|
|
||||||
if (mask & c->regFile->generalRegisters.mask) {
|
if (mask & c->regFile->generalRegisters) {
|
||||||
for (Register i = Register(c->regFile->generalRegisters.limit - 1);
|
for (Register i = Register(c->regFile->generalRegisters.limit - 1);
|
||||||
(int8_t)i >= c->regFile->generalRegisters.start;
|
(int8_t)i >= c->regFile->generalRegisters.start;
|
||||||
i = Register((int8_t)i - 1)) {
|
i = Register((int8_t)i - 1)) {
|
||||||
@ -104,7 +104,7 @@ Register pickRegisterTarget(Context* c,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mask & c->regFile->floatRegisters.mask) {
|
if (mask & c->regFile->floatRegisters) {
|
||||||
for (Register i = Register(c->regFile->floatRegisters.start);
|
for (Register i = Register(c->regFile->floatRegisters.start);
|
||||||
(int8_t)i < c->regFile->floatRegisters.limit;
|
(int8_t)i < c->regFile->floatRegisters.limit;
|
||||||
i = Register((int8_t)i + 1)) {
|
i = Register((int8_t)i + 1)) {
|
||||||
@ -235,13 +235,13 @@ Target pickTarget(Context* c,
|
|||||||
Value* value = read->value;
|
Value* value = read->value;
|
||||||
|
|
||||||
RegisterMask registerMask
|
RegisterMask registerMask
|
||||||
= (isFloatValue(value) ? RegisterMask::Any : c->regFile->generalRegisters.mask);
|
= (isFloatValue(value) ? RegisterMask::Any : (RegisterMask)c->regFile->generalRegisters);
|
||||||
|
|
||||||
SiteMask mask(~0, registerMask, AnyFrameIndex);
|
SiteMask mask(~0, registerMask, AnyFrameIndex);
|
||||||
read->intersect(&mask);
|
read->intersect(&mask);
|
||||||
|
|
||||||
if (isFloatValue(value)) {
|
if (isFloatValue(value)) {
|
||||||
RegisterMask floatMask = mask.registerMask & c->regFile->floatRegisters.mask;
|
RegisterMask floatMask = mask.registerMask & c->regFile->floatRegisters;
|
||||||
if (floatMask) {
|
if (floatMask) {
|
||||||
mask.registerMask = floatMask;
|
mask.registerMask = floatMask;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ void RegisterResource::freeze(Context* c, Value* v)
|
|||||||
freezeResource(c, this, v);
|
freezeResource(c, this, v);
|
||||||
|
|
||||||
if (freezeCount == 1
|
if (freezeCount == 1
|
||||||
and c->regFile->generalRegisters.mask.contains(index(c))) {
|
and c->regFile->generalRegisters.contains(index(c))) {
|
||||||
decrementAvailableGeneralRegisterCount(c);
|
decrementAvailableGeneralRegisterCount(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ void RegisterResource::thaw(Context* c, Value* v)
|
|||||||
thawResource(c, this, v);
|
thawResource(c, this, v);
|
||||||
|
|
||||||
if (freezeCount == 0
|
if (freezeCount == 0
|
||||||
and c->regFile->generalRegisters.mask.contains(index(c))) {
|
and c->regFile->generalRegisters.contains(index(c))) {
|
||||||
incrementAvailableGeneralRegisterCount(c);
|
incrementAvailableGeneralRegisterCount(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ void RegisterResource::increment(Context* c)
|
|||||||
++this->referenceCount;
|
++this->referenceCount;
|
||||||
|
|
||||||
if (this->referenceCount == 1
|
if (this->referenceCount == 1
|
||||||
and c->regFile->generalRegisters.mask.contains(this->index(c))) {
|
and c->regFile->generalRegisters.contains(this->index(c))) {
|
||||||
decrementAvailableGeneralRegisterCount(c);
|
decrementAvailableGeneralRegisterCount(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ void RegisterResource::decrement(Context* c)
|
|||||||
--this->referenceCount;
|
--this->referenceCount;
|
||||||
|
|
||||||
if (this->referenceCount == 0
|
if (this->referenceCount == 0
|
||||||
and c->regFile->generalRegisters.mask.contains(this->index(c))) {
|
and c->regFile->generalRegisters.contains(this->index(c))) {
|
||||||
incrementAvailableGeneralRegisterCount(c);
|
incrementAvailableGeneralRegisterCount(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ bool RegisterSite::matchNextWord(Context* c, Site* s, unsigned)
|
|||||||
assertT(c, number != NoRegister);
|
assertT(c, number != NoRegister);
|
||||||
return number == rs->number;
|
return number == rs->number;
|
||||||
} else {
|
} else {
|
||||||
RegisterMask mask = c->regFile->generalRegisters.mask;
|
RegisterMask mask = c->regFile->generalRegisters;
|
||||||
return mask.contains(number) and mask.contains(rs->number);
|
return mask.contains(number) and mask.contains(rs->number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,9 +378,9 @@ Site* RegisterSite::copyHigh(Context* c)
|
|||||||
Site* RegisterSite::makeNextWord(Context* c, unsigned)
|
Site* RegisterSite::makeNextWord(Context* c, unsigned)
|
||||||
{
|
{
|
||||||
assertT(c, number != NoRegister);
|
assertT(c, number != NoRegister);
|
||||||
assertT(c, c->regFile->generalRegisters.mask.contains(number));
|
assertT(c, c->regFile->generalRegisters.contains(number));
|
||||||
|
|
||||||
return freeRegisterSite(c, c->regFile->generalRegisters.mask);
|
return freeRegisterSite(c, c->regFile->generalRegisters);
|
||||||
}
|
}
|
||||||
|
|
||||||
SiteMask RegisterSite::mask(Context* c UNUSED)
|
SiteMask RegisterSite::mask(Context* c UNUSED)
|
||||||
@ -396,7 +396,7 @@ SiteMask RegisterSite::nextWordMask(Context* c, unsigned)
|
|||||||
return SiteMask(1 << (unsigned)lir::Operand::Type::RegisterPair, number, NoFrameIndex);
|
return SiteMask(1 << (unsigned)lir::Operand::Type::RegisterPair, number, NoFrameIndex);
|
||||||
} else {
|
} else {
|
||||||
return SiteMask(1 << (unsigned)lir::Operand::Type::RegisterPair,
|
return SiteMask(1 << (unsigned)lir::Operand::Type::RegisterPair,
|
||||||
c->regFile->generalRegisters.mask,
|
c->regFile->generalRegisters,
|
||||||
NoFrameIndex);
|
NoFrameIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -405,7 +405,7 @@ unsigned RegisterSite::registerSize(Context* c)
|
|||||||
{
|
{
|
||||||
assertT(c, number != NoRegister);
|
assertT(c, number != NoRegister);
|
||||||
|
|
||||||
if (c->regFile->floatRegisters.mask.contains(number)) {
|
if (c->regFile->floatRegisters.contains(number)) {
|
||||||
return c->arch->floatRegisterSize();
|
return c->arch->floatRegisterSize();
|
||||||
} else {
|
} else {
|
||||||
return c->targetInfo.pointerSize;
|
return c->targetInfo.pointerSize;
|
||||||
@ -423,8 +423,8 @@ Site* registerSite(Context* c, Register number)
|
|||||||
{
|
{
|
||||||
assertT(c, number != NoRegister);
|
assertT(c, number != NoRegister);
|
||||||
assertT(c,
|
assertT(c,
|
||||||
(c->regFile->generalRegisters.mask
|
(c->regFile->generalRegisters
|
||||||
| c->regFile->floatRegisters.mask).contains(number));
|
| c->regFile->floatRegisters).contains(number));
|
||||||
|
|
||||||
return new (c->zone) RegisterSite(RegisterMask(number), number);
|
return new (c->zone) RegisterSite(RegisterMask(number), number);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user