本文整理汇总了C++中VirtualRegister::hasRegister方法的典型用法代码示例。如果您正苦于以下问题:C++ VirtualRegister::hasRegister方法的具体用法?C++ VirtualRegister::hasRegister怎么用?C++ VirtualRegister::hasRegister使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtualRegister
的用法示例。
在下文中一共展示了VirtualRegister::hasRegister方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getVirtualRegister
bool
GreedyAllocator::prescanDefinition(LDefinition *def)
{
// If the definition is fakeo, a redefinition, ignore it entirely. It's not
// valid to kill it, and it doesn't matter if an input uses the same
// register (thus it does not go into the disallow set).
if (def->policy() == LDefinition::PASSTHROUGH)
return true;
VirtualRegister *vr = getVirtualRegister(def);
// Add its register to the free pool.
killReg(vr);
// If it has a register, prevent it from being allocated this round.
if (vr->hasRegister())
disallowed.add(vr->reg());
if (def->policy() == LDefinition::PRESET) {
const LAllocation *a = def->output();
if (a->isRegister()) {
// Evict fixed registers. Use the unchecked version of set-add
// because the register does not reflect any allocation state, so
// it may have already been added.
AnyRegister reg = GetPresetRegister(def);
disallowed.addUnchecked(reg);
if (!maybeEvict(reg))
return false;
}
}
return true;
}
示例2: IonSpew
bool
GreedyAllocator::buildPhiMoves(LBlock *block)
{
IonSpew(IonSpew_RegAlloc, " Merging phi state.");
phiMoves = Mover();
MBasicBlock *mblock = block->mir();
if (!mblock->successorWithPhis())
return true;
// Insert moves from our state into our successor's phi.
uint32 pos = mblock->positionInPhiSuccessor();
LBlock *successor = mblock->successorWithPhis()->lir();
for (size_t i = 0; i < successor->numPhis(); i++) {
LPhi *phi = successor->getPhi(i);
JS_ASSERT(phi->numDefs() == 1);
VirtualRegister *phiReg = getVirtualRegister(phi->getDef(0));
allocateStack(phiReg);
LAllocation *in = phi->getOperand(pos);
VirtualRegister *inReg = getVirtualRegister(in->toUse());
allocateStack(inReg);
// Try to get a register for the input.
if (!inReg->hasRegister() && !allocatableRegs().empty(inReg->isDouble())) {
if (!allocateReg(inReg))
return false;
}
// Add a move from the input to the phi.
if (inReg->hasRegister()) {
if (!phiMoves.move(inReg->reg(), phiReg->backingStack()))
return false;
} else {
if (!phiMoves.move(inReg->backingStack(), phiReg->backingStack()))
return false;
}
}
return true;
}