Bug 943429 - IonMonkey: Misc regalloc cleanups r=bhackett

This commit is contained in:
Dan Gohman 2013-11-26 11:22:58 -08:00
parent 3b904a0e08
commit 4258fb45c4
5 changed files with 20 additions and 18 deletions

View File

@ -36,7 +36,7 @@ struct VirtualRegisterGroup : public TempObject
// Spill location to be shared by registers in the group.
LAllocation spill;
VirtualRegisterGroup(TempAllocator &alloc)
explicit VirtualRegisterGroup(TempAllocator &alloc)
: registers(alloc), allocation(LUse(0, LUse::ANY)), spill(LUse(0, LUse::ANY))
{}
@ -67,7 +67,7 @@ class BacktrackingVirtualRegister : public VirtualRegister
VirtualRegisterGroup *group_;
public:
BacktrackingVirtualRegister(TempAllocator &alloc)
explicit BacktrackingVirtualRegister(TempAllocator &alloc)
: VirtualRegister(alloc)
{}
void setMustCopyInput() {
@ -108,7 +108,7 @@ class BacktrackingVirtualRegister : public VirtualRegister
// where to split.
typedef js::Vector<CodePosition, 4, SystemAllocPolicy> SplitPositionVector;
class BacktrackingAllocator : public LiveRangeAllocator<BacktrackingVirtualRegister>
class BacktrackingAllocator : private LiveRangeAllocator<BacktrackingVirtualRegister>
{
// Priority queue element: either an interval or group of intervals and the
// associated priority.

View File

@ -59,7 +59,7 @@ class LinearScanVirtualRegister : public VirtualRegister
}
};
class LinearScanAllocator : public LiveRangeAllocator<LinearScanVirtualRegister>
class LinearScanAllocator : private LiveRangeAllocator<LinearScanVirtualRegister>
{
friend class C1Spewer;
friend class JSONSpewer;

View File

@ -401,7 +401,7 @@ class VirtualRegister
VirtualRegister(const VirtualRegister &) MOZ_DELETE;
protected:
VirtualRegister(TempAllocator &alloc)
explicit VirtualRegister(TempAllocator &alloc)
: intervals_(alloc)
{}
@ -554,7 +554,7 @@ typedef InlineList<LiveInterval>::iterator IntervalIterator;
typedef InlineList<LiveInterval>::reverse_iterator IntervalReverseIterator;
template <typename VREG>
class LiveRangeAllocator : public RegisterAllocator
class LiveRangeAllocator : protected RegisterAllocator
{
protected:
// Computed inforamtion

View File

@ -162,8 +162,7 @@ AllocationIntegrityState::check(bool populateSafepoints)
checkIntegrity(block, *riter, vreg, **alloc, populateSafepoints);
while (!worklist.empty()) {
IntegrityItem item = worklist.back();
worklist.popBack();
IntegrityItem item = worklist.popCopy();
checkIntegrity(item.block, *item.block->rbegin(), item.vreg, item.alloc, populateSafepoints);
}
}
@ -230,7 +229,7 @@ AllocationIntegrityState::checkIntegrity(LBlock *block, LInstruction *ins,
// inputs as it is not guaranteed the register allocator filled in physical
// allocations for the inputs and outputs of the phis.
for (size_t i = 0; i < block->numPhis(); i++) {
InstructionInfo &info = blocks[block->mir()->id()].phis[i];
const InstructionInfo &info = blocks[block->mir()->id()].phis[i];
LPhi *phi = block->getPhi(i);
if (info.outputs[0].virtualRegister() == vreg) {
for (size_t j = 0; j < phi->numOperands(); j++) {
@ -372,7 +371,7 @@ AllocationIntegrityState::dump()
fprintf(stderr, "\n");
for (size_t i = 0; i < block->numPhis(); i++) {
InstructionInfo &info = blocks[blockIndex].phis[i];
const InstructionInfo &info = blocks[blockIndex].phis[i];
LPhi *phi = block->getPhi(i);
CodePosition output(phi->id(), CodePosition::OUTPUT);
@ -388,7 +387,7 @@ AllocationIntegrityState::dump()
for (LInstructionIterator iter = block->begin(); iter != block->end(); iter++) {
LInstruction *ins = *iter;
InstructionInfo &info = instructions[ins->id()];
const InstructionInfo &info = instructions[ins->id()];
CodePosition input(ins->id(), CodePosition::INPUT);
CodePosition output(ins->id(), CodePosition::OUTPUT);

View File

@ -30,7 +30,7 @@ class LIRGenerator;
// streamline the process of prototyping new allocators.
struct AllocationIntegrityState
{
AllocationIntegrityState(LIRGraph &graph)
explicit AllocationIntegrityState(const LIRGraph &graph)
: graph(graph)
{}
@ -46,7 +46,7 @@ struct AllocationIntegrityState
private:
LIRGraph &graph;
const LIRGraph &graph;
// For all instructions and phis in the graph, keep track of the virtual
// registers for all inputs and outputs of the nodes. These are overwritten
@ -284,6 +284,9 @@ class InstructionDataMap
// Common superclass for register allocators.
class RegisterAllocator
{
void operator=(const RegisterAllocator &) MOZ_DELETE;
RegisterAllocator(const RegisterAllocator &) MOZ_DELETE;
protected:
// Context
MIRGenerator *mir;
@ -322,16 +325,16 @@ class RegisterAllocator
return mir->alloc();
}
CodePosition outputOf(uint32_t pos) const {
static CodePosition outputOf(uint32_t pos) {
return CodePosition(pos, CodePosition::OUTPUT);
}
CodePosition outputOf(const LInstruction *ins) const {
static CodePosition outputOf(const LInstruction *ins) {
return CodePosition(ins->id(), CodePosition::OUTPUT);
}
CodePosition inputOf(uint32_t pos) const {
static CodePosition inputOf(uint32_t pos) {
return CodePosition(pos, CodePosition::INPUT);
}
CodePosition inputOf(const LInstruction *ins) const {
static CodePosition inputOf(const LInstruction *ins) {
// Phi nodes "use" their inputs before the beginning of the block.
JS_ASSERT(!ins->isPhi());
return CodePosition(ins->id(), CodePosition::INPUT);
@ -364,7 +367,7 @@ class RegisterAllocator
};
static inline AnyRegister
GetFixedRegister(LDefinition *def, const LUse *use)
GetFixedRegister(const LDefinition *def, const LUse *use)
{
return def->type() == LDefinition::DOUBLE
? AnyRegister(FloatRegister::FromCode(use->registerCode()))