зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1027897 - IonMonkey: Create entryOf and exitOf helper functions and use them. r=bhackett
This commit is contained in:
Родитель
eb249888d0
Коммит
c2035a8562
|
@ -59,8 +59,8 @@ BacktrackingAllocator::init()
|
|||
|
||||
if (block == backedge) {
|
||||
LBlock *header = block->mir()->loopHeaderOfBackedge()->lir();
|
||||
CodePosition from = inputOf(header->firstId());
|
||||
CodePosition to = outputOf(block->lastId()).next();
|
||||
CodePosition from = entryOf(header);
|
||||
CodePosition to = exitOf(block).next();
|
||||
if (!hotcodeInterval->addRange(from, to))
|
||||
return false;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ BacktrackingAllocator::tryGroupReusedRegister(uint32_t def, uint32_t use)
|
|||
|
||||
// The input's lifetime must end within the same block as the definition,
|
||||
// otherwise it could live on in phis elsewhere.
|
||||
if (interval->end() > outputOf(block->lastId())) {
|
||||
if (interval->end() > exitOf(block)) {
|
||||
reg.setMustCopyInput();
|
||||
return true;
|
||||
}
|
||||
|
@ -926,7 +926,7 @@ BacktrackingAllocator::resolveControlFlow()
|
|||
|
||||
CodePosition start = interval->start();
|
||||
InstructionData *data = &insData[start];
|
||||
if (interval->start() > inputOf(data->block()->firstId())) {
|
||||
if (interval->start() > entryOf(data->block())) {
|
||||
JS_ASSERT(start == inputOf(data->ins()) || start == outputOf(data->ins()));
|
||||
|
||||
LiveInterval *prevInterval = reg->intervalFor(start.previous());
|
||||
|
@ -956,7 +956,7 @@ BacktrackingAllocator::resolveControlFlow()
|
|||
JS_ASSERT(phi->numDefs() == 1);
|
||||
LDefinition *def = phi->getDef(0);
|
||||
VirtualRegister *vreg = &vregs[def];
|
||||
LiveInterval *to = vreg->intervalFor(inputOf(successor->firstId()));
|
||||
LiveInterval *to = vreg->intervalFor(entryOf(successor));
|
||||
JS_ASSERT(to);
|
||||
|
||||
for (size_t k = 0; k < mSuccessor->numPredecessors(); k++) {
|
||||
|
@ -964,7 +964,7 @@ BacktrackingAllocator::resolveControlFlow()
|
|||
JS_ASSERT(predecessor->mir()->numSuccessors() == 1);
|
||||
|
||||
LAllocation *input = phi->getOperand(k);
|
||||
LiveInterval *from = vregs[input].intervalFor(outputOf(predecessor->lastId()));
|
||||
LiveInterval *from = vregs[input].intervalFor(exitOf(predecessor));
|
||||
JS_ASSERT(from);
|
||||
|
||||
if (!moveAtExit(predecessor, from, to, def->type()))
|
||||
|
@ -983,12 +983,12 @@ BacktrackingAllocator::resolveControlFlow()
|
|||
|
||||
for (size_t k = 0; k < reg.numIntervals(); k++) {
|
||||
LiveInterval *to = reg.getInterval(k);
|
||||
if (!to->covers(inputOf(successor->firstId())))
|
||||
if (!to->covers(entryOf(successor)))
|
||||
continue;
|
||||
if (to->covers(outputOf(predecessor->lastId())))
|
||||
if (to->covers(exitOf(predecessor)))
|
||||
continue;
|
||||
|
||||
LiveInterval *from = reg.intervalFor(outputOf(predecessor->lastId()));
|
||||
LiveInterval *from = reg.intervalFor(exitOf(predecessor));
|
||||
|
||||
if (mSuccessor->numPredecessors() > 1) {
|
||||
JS_ASSERT(predecessor->mir()->numSuccessors() == 1);
|
||||
|
|
|
@ -112,7 +112,7 @@ LBlock::New(TempAllocator &alloc, MBasicBlock *from)
|
|||
}
|
||||
|
||||
uint32_t
|
||||
LBlock::firstId()
|
||||
LBlock::firstId() const
|
||||
{
|
||||
if (phis_.length()) {
|
||||
return phis_[0].id();
|
||||
|
@ -125,7 +125,7 @@ LBlock::firstId()
|
|||
return 0;
|
||||
}
|
||||
uint32_t
|
||||
LBlock::lastId()
|
||||
LBlock::lastId() const
|
||||
{
|
||||
LInstruction *last = *instructions_.rbegin();
|
||||
JS_ASSERT(last->id());
|
||||
|
|
|
@ -790,8 +790,8 @@ class LBlock : public TempObject
|
|||
JS_ASSERT(!at->isLabel());
|
||||
instructions_.insertBefore(at, ins);
|
||||
}
|
||||
uint32_t firstId();
|
||||
uint32_t lastId();
|
||||
uint32_t firstId() const;
|
||||
uint32_t lastId() const;
|
||||
|
||||
// Return the label to branch to when branching to this block.
|
||||
Label *label() {
|
||||
|
|
|
@ -235,7 +235,7 @@ LinearScanAllocator::resolveControlFlow()
|
|||
JS_ASSERT(phi->numDefs() == 1);
|
||||
LDefinition *def = phi->getDef(0);
|
||||
LinearScanVirtualRegister *vreg = &vregs[def];
|
||||
LiveInterval *to = vreg->intervalFor(inputOf(successor->firstId()));
|
||||
LiveInterval *to = vreg->intervalFor(entryOf(successor));
|
||||
JS_ASSERT(to);
|
||||
|
||||
for (size_t k = 0; k < mSuccessor->numPredecessors(); k++) {
|
||||
|
@ -243,7 +243,7 @@ LinearScanAllocator::resolveControlFlow()
|
|||
JS_ASSERT(predecessor->mir()->numSuccessors() == 1);
|
||||
|
||||
LAllocation *input = phi->getOperand(k);
|
||||
LiveInterval *from = vregs[input].intervalFor(outputOf(predecessor->lastId()));
|
||||
LiveInterval *from = vregs[input].intervalFor(exitOf(predecessor));
|
||||
JS_ASSERT(from);
|
||||
|
||||
if (!moveAtExit(predecessor, from, to, def->type()))
|
||||
|
@ -264,12 +264,12 @@ LinearScanAllocator::resolveControlFlow()
|
|||
|
||||
for (BitSet::Iterator liveRegId(*live); liveRegId; liveRegId++) {
|
||||
LinearScanVirtualRegister *vreg = &vregs[*liveRegId];
|
||||
LiveInterval *to = vreg->intervalFor(inputOf(successor->firstId()));
|
||||
LiveInterval *to = vreg->intervalFor(entryOf(successor));
|
||||
JS_ASSERT(to);
|
||||
|
||||
for (size_t j = 0; j < mSuccessor->numPredecessors(); j++) {
|
||||
LBlock *predecessor = mSuccessor->getPredecessor(j)->lir();
|
||||
LiveInterval *from = vregs[*liveRegId].intervalFor(outputOf(predecessor->lastId()));
|
||||
LiveInterval *from = vregs[*liveRegId].intervalFor(exitOf(predecessor));
|
||||
JS_ASSERT(from);
|
||||
|
||||
if (*from->getAllocation() == *to->getAllocation())
|
||||
|
@ -424,7 +424,7 @@ LinearScanAllocator::reifyAllocations()
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if (interval->start() > inputOf(insData[interval->start()].block()->firstId()) &&
|
||||
else if (interval->start() > entryOf(insData[interval->start()].block()) &&
|
||||
(!reg->canonicalSpill() ||
|
||||
(reg->canonicalSpill() == interval->getAllocation() &&
|
||||
!reg->mustSpillAtDefinition()) ||
|
||||
|
@ -1310,7 +1310,7 @@ LinearScanAllocator::setIntervalRequirement(LiveInterval *interval)
|
|||
// first input
|
||||
LUse *use = reg->ins()->getOperand(0)->toUse();
|
||||
LBlock *predecessor = reg->block()->mir()->getPredecessor(0)->lir();
|
||||
CodePosition predEnd = outputOf(predecessor->lastId());
|
||||
CodePosition predEnd = exitOf(predecessor);
|
||||
interval->setHint(Requirement(use->virtualRegister(), predEnd));
|
||||
} else {
|
||||
// Non-phis get a REGISTER requirement
|
||||
|
|
|
@ -548,8 +548,8 @@ LiveRangeAllocator<VREG, forLSRA>::buildLivenessInfo()
|
|||
// Variables are assumed alive for the entire block, a define shortens
|
||||
// the interval to the point of definition.
|
||||
for (BitSet::Iterator liveRegId(*live); liveRegId; liveRegId++) {
|
||||
if (!vregs[*liveRegId].getInterval(0)->addRangeAtHead(inputOf(block->firstId()),
|
||||
outputOf(block->lastId()).next()))
|
||||
if (!vregs[*liveRegId].getInterval(0)->addRangeAtHead(entryOf(block),
|
||||
exitOf(block).next()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -747,7 +747,7 @@ LiveRangeAllocator<VREG, forLSRA>::buildLivenessInfo()
|
|||
}
|
||||
|
||||
LiveInterval *interval = vregs[use].getInterval(0);
|
||||
if (!interval->addRangeAtHead(inputOf(block->firstId()), forLSRA ? to : to.next()))
|
||||
if (!interval->addRangeAtHead(entryOf(block), forLSRA ? to : to.next()))
|
||||
return false;
|
||||
interval->addUse(new(alloc()) UsePosition(use, to));
|
||||
|
||||
|
@ -766,7 +766,7 @@ LiveRangeAllocator<VREG, forLSRA>::buildLivenessInfo()
|
|||
} else {
|
||||
// This is a dead phi, so add a dummy range over all phis. This
|
||||
// can go away if we have an earlier dead code elimination pass.
|
||||
if (!vregs[def].getInterval(0)->addRangeAtHead(inputOf(block->firstId()),
|
||||
if (!vregs[def].getInterval(0)->addRangeAtHead(entryOf(block),
|
||||
outputOf(block->firstId())))
|
||||
{
|
||||
return false;
|
||||
|
@ -786,8 +786,8 @@ LiveRangeAllocator<VREG, forLSRA>::buildLivenessInfo()
|
|||
JS_ASSERT(loopBlock->id() >= mblock->id());
|
||||
|
||||
// Add an interval for this entire loop block
|
||||
CodePosition from = inputOf(loopBlock->lir()->firstId());
|
||||
CodePosition to = outputOf(loopBlock->lir()->lastId()).next();
|
||||
CodePosition from = entryOf(loopBlock->lir());
|
||||
CodePosition to = exitOf(loopBlock->lir()).next();
|
||||
|
||||
for (BitSet::Iterator liveRegId(*live); liveRegId; liveRegId++) {
|
||||
if (!vregs[*liveRegId].getInterval(0)->addRange(from, to))
|
||||
|
|
|
@ -274,17 +274,25 @@ class InstructionDataMap
|
|||
}
|
||||
|
||||
InstructionData &operator[](CodePosition pos) {
|
||||
JS_ASSERT(pos.ins() < numIns_);
|
||||
return insData_[pos.ins()];
|
||||
return operator[](pos.ins());
|
||||
}
|
||||
const InstructionData &operator[](CodePosition pos) const {
|
||||
return operator[](pos.ins());
|
||||
}
|
||||
InstructionData &operator[](LInstruction *ins) {
|
||||
JS_ASSERT(ins->id() < numIns_);
|
||||
return insData_[ins->id()];
|
||||
return operator[](ins->id());
|
||||
}
|
||||
const InstructionData &operator[](LInstruction *ins) const {
|
||||
return operator[](ins->id());
|
||||
}
|
||||
InstructionData &operator[](uint32_t ins) {
|
||||
JS_ASSERT(ins < numIns_);
|
||||
return insData_[ins];
|
||||
}
|
||||
const InstructionData &operator[](uint32_t ins) const {
|
||||
JS_ASSERT(ins < numIns_);
|
||||
return insData_[ins];
|
||||
}
|
||||
};
|
||||
|
||||
// Common superclass for register allocators.
|
||||
|
@ -335,7 +343,7 @@ class RegisterAllocator
|
|||
return CodePosition(pos, CodePosition::OUTPUT);
|
||||
}
|
||||
static CodePosition outputOf(const LInstruction *ins) {
|
||||
return CodePosition(ins->id(), CodePosition::OUTPUT);
|
||||
return outputOf(ins->id());
|
||||
}
|
||||
static CodePosition inputOf(uint32_t pos) {
|
||||
return CodePosition(pos, CodePosition::INPUT);
|
||||
|
@ -343,7 +351,13 @@ class RegisterAllocator
|
|||
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);
|
||||
return inputOf(ins->id());
|
||||
}
|
||||
static CodePosition entryOf(const LBlock *block) {
|
||||
return inputOf(block->firstId());
|
||||
}
|
||||
static CodePosition exitOf(const LBlock *block) {
|
||||
return outputOf(block->lastId());
|
||||
}
|
||||
|
||||
LMoveGroup *getInputMoveGroup(uint32_t ins);
|
||||
|
|
Загрузка…
Ссылка в новой задаче