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); }
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); }