本文整理汇总了C++中LBox::setDef方法的典型用法代码示例。如果您正苦于以下问题:C++ LBox::setDef方法的具体用法?C++ LBox::setDef怎么用?C++ LBox::setDef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LBox
的用法示例。
在下文中一共展示了LBox::setDef方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defineBox
bool
LIRGeneratorARM::visitBox(MBox *box)
{
MDefinition *inner = box->getOperand(0);
// If the box wrapped a double, it needs a new register.
if (inner->type() == MIRType_Double)
return defineBox(new LBoxDouble(useRegisterAtStart(inner), tempCopy(inner, 0)), box);
if (box->canEmitAtUses())
return emitAtUses(box);
if (inner->isConstant())
return defineBox(new LValue(inner->toConstant()->value()), box);
LBox *lir = new LBox(use(inner), inner->type());
// Otherwise, we should not define a new register for the payload portion
// of the output, so bypass defineBox().
uint32_t vreg = getVirtualRegister();
if (vreg >= MAX_VIRTUAL_REGISTERS)
return false;
// Note that because we're using PASSTHROUGH, we do not change the type of
// the definition. We also do not define the first output as "TYPE",
// because it has no corresponding payload at (vreg + 1). Also note that
// although we copy the input's original type for the payload half of the
// definition, this is only for clarity. PASSTHROUGH definitions are
// ignored.
lir->setDef(0, LDefinition(vreg, LDefinition::GENERAL));
lir->setDef(1, LDefinition(inner->virtualRegister(), LDefinition::TypeFrom(inner->type()),
LDefinition::PASSTHROUGH));
box->setVirtualRegister(vreg);
return add(lir);
}
示例2: defineBox
void
LIRGeneratorPPC::visitBox(MBox *box)
{
MDefinition *inner = box->getOperand(0);
// If the box wrapped a double, it needs a new register.
if (IsFloatingPointType(inner->type())) {
defineBox(new(alloc()) LBoxFloatingPoint(useRegisterAtStart(inner),
tempCopy(inner, 0), inner->type()), box);
return;
}
if (box->canEmitAtUses()) {
emitAtUses(box);
return;
}
if (inner->isConstant()) {
defineBox(new(alloc()) LValue(inner->toConstant()->value()), box);
return;
}
LBox *lir = new(alloc()) LBox(use(inner), inner->type());
// Otherwise, we should not define a new register for the payload portion
// of the output, so bypass defineBox().
// As of Fx38, getVirtualRegister is infallible (see bug 1107774).
uint32_t vreg = getVirtualRegister();
// Note that because we're using BogusTemp(), we do not change the type of
// the definition. We also do not define the first output as "TYPE",
// because it has no corresponding payload at (vreg + 1). Also note that
// although we copy the input's original type for the payload half of the
// definition, this is only for clarity. BogusTemp() definitions are
// ignored.
lir->setDef(0, LDefinition(vreg, LDefinition::GENERAL));
lir->setDef(1, LDefinition::BogusTemp());
box->setVirtualRegister(vreg);
add(lir);
}