SSATmp* IRInstruction::modifiedStkPtr() const { assert(modifiesStack()); assert(MInstrEffects::supported(this)); SSATmp* sp = dst(hasMainDst() ? 1 : 0); assert(sp->isA(Type::StkPtr)); return sp; }
PhysReg forceAlloc(const SSATmp& tmp) { auto inst = tmp.inst(); auto opc = inst->op(); if (tmp.isA(Type::StkPtr)) { assert(opc == DefSP || opc == ReDefSP || opc == Call || opc == CallArray || opc == ContEnter || opc == SpillStack || opc == SpillFrame || opc == CufIterSpillFrame || opc == ExceptionBarrier || opc == RetAdjustStack || opc == InterpOne || opc == InterpOneCF || opc == Mov || opc == CheckStk || opc == GuardStk || opc == AssertStk || opc == CastStk || opc == CastStkIntToDbl || opc == CoerceStk || opc == SideExitGuardStk || MInstrEffects::supported(opc)); return mcg->backEnd().rVmSp(); } // LdContActRec and LdAFWHActRec, loading a generator's AR, is the only time // we have a pointer to an AR that is not in rVmFp. if (opc != LdContActRec && opc != LdAFWHActRec && tmp.isA(Type::FramePtr)) { return mcg->backEnd().rVmFp(); } if (opc == DefMIStateBase) { assert(tmp.isA(Type::PtrToCell)); return mcg->backEnd().rSp(); } return InvalidReg; }
const StringData* findClassName(SSATmp* cls) { assert(cls->isA(Type::Cls)); if (cls->isConst()) { return cls->getValClass()->preClass()->name(); } // Try to get the class name from a LdCls IRInstruction* clsInst = cls->inst(); if (clsInst->op() == LdCls || clsInst->op() == LdClsCached) { SSATmp* clsName = clsInst->src(0); assert(clsName->isA(Type::Str)); if (clsName->isConst()) { return clsName->getValStr(); } } return nullptr; }
SSATmp* TraceBuilder::genBoxLoc(uint32_t id) { SSATmp* prevValue = genLdLoc(id); Type prevType = prevValue->type(); // Don't box if local's value already boxed if (prevType.isBoxed()) { return prevValue; } assert(prevType.notBoxed()); // The Box helper requires us to incref the values its boxing, but in // this case we don't need to incref prevValue because we are simply // transfering its refcount from the local to the box. if (prevValue->isA(Type::Uninit)) { // No box can ever contain Uninit, so promote it to InitNull here. prevValue = genDefInitNull(); } SSATmp* newValue = gen(Box, prevValue); gen(StLoc, LocalId(id), m_fpValue, newValue); return newValue; }