From 0fabe930f8c3b47d9f2edd332fde9010de2a7f26 Mon Sep 17 00:00:00 2001 From: Edwin Smith Date: Wed, 29 May 2013 09:10:33 -0700 Subject: [PATCH] Rename s/get// for id, src, dst, srcs, dsts, numSrcs, numDsts Dropping the "get" prefix makes the code more readable. Also srcReg(), dstReg(). --- hphp/runtime/vm/translator/hopt/block.h | 8 +- hphp/runtime/vm/translator/hopt/cfg.h | 4 +- hphp/runtime/vm/translator/hopt/check.cpp | 31 +- hphp/runtime/vm/translator/hopt/codegen.cpp | 634 +++++++++--------- hphp/runtime/vm/translator/hopt/codegen.h | 6 +- hphp/runtime/vm/translator/hopt/dce.cpp | 88 +-- .../vm/translator/hopt/hhbctranslator.cpp | 4 +- hphp/runtime/vm/translator/hopt/ir.cpp | 48 +- hphp/runtime/vm/translator/hopt/irfactory.cpp | 2 +- .../vm/translator/hopt/irinstruction.h | 22 +- hphp/runtime/vm/translator/hopt/jumpopts.cpp | 16 +- hphp/runtime/vm/translator/hopt/layout.cpp | 2 +- .../runtime/vm/translator/hopt/linearscan.cpp | 132 ++-- hphp/runtime/vm/translator/hopt/memelim.cpp | 76 +-- hphp/runtime/vm/translator/hopt/mutation.cpp | 28 +- .../vm/translator/hopt/nativecalls.cpp | 6 +- hphp/runtime/vm/translator/hopt/opt.cpp | 12 +- .../vm/translator/hopt/predictionopts.cpp | 12 +- hphp/runtime/vm/translator/hopt/print.cpp | 26 +- .../runtime/vm/translator/hopt/simplifier.cpp | 232 +++---- hphp/runtime/vm/translator/hopt/ssatmp.h | 2 +- .../runtime/vm/translator/hopt/state_vector.h | 8 +- .../vm/translator/hopt/tracebuilder.cpp | 76 +-- .../runtime/vm/translator/hopt/tracebuilder.h | 4 +- hphp/runtime/vm/translator/hopt/type.cpp | 38 +- .../vm/translator/hopt/vectortranslator.cpp | 14 +- 26 files changed, 765 insertions(+), 766 deletions(-) diff --git a/hphp/runtime/vm/translator/hopt/block.h b/hphp/runtime/vm/translator/hopt/block.h index 1bc63ebfe..b9240bc30 100644 --- a/hphp/runtime/vm/translator/hopt/block.h +++ b/hphp/runtime/vm/translator/hopt/block.h @@ -56,7 +56,7 @@ struct Block : boost::noncopyable { return front(); } - uint32_t getId() const { return m_id; } + uint32_t id() const { return m_id; } Trace* getTrace() const { return m_trace; } void setTrace(Trace* t) { m_trace = t; } void setHint(Hint hint) { m_hint = hint; } @@ -88,7 +88,7 @@ struct Block : boost::noncopyable { * Returns whether this block is the initial entry block for the * tracelet. */ - bool isEntry() const { return getId() == 0; } + bool isEntry() const { return id() == 0; } // return the last instruction in the block IRInstruction* back() const { @@ -164,7 +164,7 @@ struct Block : boost::noncopyable { for (Edge& e : m_preds) { IRInstruction* jmp = e.from()->back(); assert(jmp->op() == Jmp_ && jmp->getTaken() == this); - body(jmp, jmp->getSrc(i)); + body(jmp, jmp->src(i)); } } @@ -173,7 +173,7 @@ struct Block : boost::noncopyable { template SSATmp* findSrc(unsigned i, L body) { for (Edge& e : m_preds) { - SSATmp* src = e.from()->back()->getSrc(i); + SSATmp* src = e.from()->back()->src(i); if (body(src)) return src; } return nullptr; diff --git a/hphp/runtime/vm/translator/hopt/cfg.h b/hphp/runtime/vm/translator/hopt/cfg.h index a416d0d0a..6ae43f06d 100644 --- a/hphp/runtime/vm/translator/hopt/cfg.h +++ b/hphp/runtime/vm/translator/hopt/cfg.h @@ -39,8 +39,8 @@ struct PostorderSort { void walk(Block* block) { assert(!block->empty()); - if (m_visited.test(block->getId())) return; - m_visited.set(block->getId()); + if (m_visited.test(block->id())) return; + m_visited.set(block->id()); Block* taken = block->getTaken(); if (taken && taken->getTrace()->isMain() != block->getTrace()->isMain()) { walk(taken); diff --git a/hphp/runtime/vm/translator/hopt/check.cpp b/hphp/runtime/vm/translator/hopt/check.cpp index 56e2ae151..67813363e 100644 --- a/hphp/runtime/vm/translator/hopt/check.cpp +++ b/hphp/runtime/vm/translator/hopt/check.cpp @@ -75,11 +75,11 @@ bool checkBlock(Block* b) { if (b->getTaken()) { // only Jmp_ can branch to a join block expecting values. assert(b->back()->op() == Jmp_ || - b->getTaken()->front()->getNumDsts() == 0); + b->getTaken()->front()->numDsts() == 0); } if (b->getNext()) { // cannot fall-through to join block expecting values - assert(b->getNext()->front()->getNumDsts() == 0); + assert(b->getNext()->front()->numDsts() == 0); } { @@ -95,7 +95,7 @@ bool checkBlock(Block* b) { } } - for (int i = 0; i < b->front()->getNumDsts(); ++i) { + for (int i = 0; i < b->front()->numDsts(); ++i) { auto const traceBlocks = b->getTrace()->getBlocks(); b->forEachSrc(i, [&](IRInstruction* inst, SSATmp*) { assert(std::find(traceBlocks.begin(), traceBlocks.end(), @@ -158,14 +158,14 @@ bool checkCfg(Trace* trace, const IRFactory& factory) { // visit dom tree in preorder, checking all tmps auto const children = findDomChildren(blocks); - boost::dynamic_bitset<> defined0(factory.numTmps()); + StateVector defined0(&factory, false); forPreorderDoms(blocks.front(), children, defined0, - [] (Block* block, boost::dynamic_bitset<>& defined) { + [] (Block* block, StateVector& defined) { for (IRInstruction& inst : *block) { - for (DEBUG_ONLY SSATmp* src : inst.getSrcs()) { + for (DEBUG_ONLY SSATmp* src : inst.srcs()) { assert(src->inst() != &inst); assert_log(src->inst()->op() == DefConst || - defined[src->getId()], + defined[src], [&]{ return folly::format( "src '{}' in '{}' came from '{}', which is not a " "DefConst and is not defined at this use site", @@ -173,11 +173,10 @@ bool checkCfg(Trace* trace, const IRFactory& factory) { src->inst()->toString()).str(); }); } - for (SSATmp& dst : inst.getDsts()) { - assert(dst.inst() == &inst && - inst.op() != DefConst); - assert(!defined[dst.getId()]); - defined[dst.getId()] = 1; + for (SSATmp& dst : inst.dsts()) { + assert(dst.inst() == &inst && inst.op() != DefConst); + assert(!defined[dst]); + defined[dst] = true; } } }); @@ -201,7 +200,7 @@ bool checkTmpsSpanningCalls(Trace* trace, const IRFactory& irFactory) { blocks.front(), children, State(&irFactory, false), [&] (Block* b, State& state) { for (auto& inst : *b) { - for (auto& src : inst.getSrcs()) { + for (auto& src : inst.srcs()) { if (src->isA(Type::FramePtr)) continue; if (src->isConst()) continue; if (!state[src]) { @@ -222,7 +221,7 @@ bool checkTmpsSpanningCalls(Trace* trace, const IRFactory& irFactory) { */ if (isCall(inst.op())) state.reset(); - for (auto& d : inst.getDsts()) { + for (auto& d : inst.dsts()) { state[d] = true; } } @@ -241,7 +240,7 @@ bool checkRegisters(Trace* trace, const IRFactory& factory, forPreorderDoms(blocks.front(), children, RegState(), [&] (Block* block, RegState& state) { for (IRInstruction& inst : *block) { - for (SSATmp* src : inst.getSrcs()) { + for (SSATmp* src : inst.srcs()) { auto const &info = regs[src]; if (!info.spilled() && (info.getReg(0) == Transl::rVmSp || @@ -253,7 +252,7 @@ bool checkRegisters(Trace* trace, const IRFactory& factory, assert(state.tmp(info, i) == src); } } - for (SSATmp& dst : inst.getDsts()) { + for (SSATmp& dst : inst.dsts()) { auto const &info = regs[dst]; for (unsigned i = 0, n = info.numAllocatedRegs(); i < n; ++i) { state.tmp(info, i) = &dst; diff --git a/hphp/runtime/vm/translator/hopt/codegen.cpp b/hphp/runtime/vm/translator/hopt/codegen.cpp index 2a27027d3..0c0738b35 100644 --- a/hphp/runtime/vm/translator/hopt/codegen.cpp +++ b/hphp/runtime/vm/translator/hopt/codegen.cpp @@ -301,10 +301,10 @@ PhysReg CodeGenerator::selectScratchReg(IRInstruction* inst) { | RegSet(reg::rdi) ; RegSet liveRegs = m_state.liveRegs[inst]; - for (const auto& tmp : inst->getSrcs()) { + for (const auto& tmp : inst->srcs()) { liveRegs |= m_regs[tmp].getRegs(); } - for (const auto& tmp : inst->getDsts()) { + for (const auto& tmp : inst->dsts()) { liveRegs |= m_regs[tmp].getRegs(); } PhysReg selectedReg; @@ -777,13 +777,13 @@ void CodeGenerator::emitReqBindJcc(ConditionCode cc, } void CodeGenerator::cgJcc(IRInstruction* inst) { - emitCompare(inst->getSrc(0), inst->getSrc(1)); + emitCompare(inst->src(0), inst->src(1)); emitFwdJcc(opToConditionCode(inst->op()), inst->getTaken()); } void CodeGenerator::cgReqBindJcc(IRInstruction* inst) { // TODO(#2404427): prepareForTestAndSmash? - emitCompare(inst->getSrc(0), inst->getSrc(1)); + emitCompare(inst->src(0), inst->src(1)); emitReqBindJcc(opToConditionCode(inst->op()), inst->getExtra()); } @@ -825,8 +825,8 @@ static int64_t shuffleArgs(Asm& a, ArgGroup& args) { kind == ArgDesc::TypeReg)) { continue; } - auto dstReg = args[i].getDstReg(); - auto srcReg = args[i].getSrcReg(); + auto dstReg = args[i].dstReg(); + auto srcReg = args[i].srcReg(); if (dstReg != srcReg) { moves[int(dstReg)] = int(srcReg); argDescs[int(dstReg)] = &args[i]; @@ -875,7 +875,7 @@ static int64_t shuffleArgs(Asm& a, ArgGroup& args) { for (size_t i = 0; i < args.numRegArgs(); ++i) { if (!args[i].done()) { ArgDesc::Kind kind = args[i].getKind(); - PhysReg dst = args[i].getDstReg(); + PhysReg dst = args[i].dstReg(); assert(dst.isGP()); if (kind == ArgDesc::Imm) { a.emitImmReg(args[i].getImm().q(), dst); @@ -895,8 +895,8 @@ static int64_t shuffleArgs(Asm& a, ArgGroup& args) { // Store any remaining arguments to the stack for (int i = args.numStackArgs() - 1; i >= 0; --i) { auto& arg = args.stk(i); - auto srcReg = arg.getSrcReg(); - assert(arg.getDstReg() == InvalidReg); + auto srcReg = arg.srcReg(); + assert(arg.dstReg() == InvalidReg); switch (arg.getKind()) { case ArgDesc::Reg: if (arg.isZeroExtend()) { @@ -958,7 +958,7 @@ void CodeGenerator::cgCallNative(Asm& a, IRInstruction* inst) { const CallInfo& info = CallMap::getInfo(opc); ArgGroup argGroup(m_regs); for (auto const& arg : info.args) { - SSATmp* src = inst->getSrc(arg.srcIdx); + SSATmp* src = inst->src(arg.srcIdx); switch (arg.type) { case SSA: argGroup.ssa(src); @@ -984,12 +984,12 @@ void CodeGenerator::cgCallNative(Asm& a, IRInstruction* inst) { addr = info.func.ptr; break; case FSSA: - addr = inst->getSrc(info.func.srcIdx)->getValTCA(); + addr = inst->src(info.func.srcIdx)->getValTCA(); break; } cgCallHelper(a, addr, - info.dest != DestType::None ? inst->getDst(0) : nullptr, + info.dest != DestType::None ? inst->dst(0) : nullptr, info.sync, argGroup, info.dest); @@ -1098,9 +1098,9 @@ void CodeGenerator::cgMarker(IRInstruction* inst) { } void CodeGenerator::cgMov(IRInstruction* inst) { - assert(!m_regs[inst->getSrc(0)].hasReg(1));//TODO: t2082361: handle Gen & Cell - SSATmp* dst = inst->getDst(); - SSATmp* src = inst->getSrc(0); + assert(!m_regs[inst->src(0)].hasReg(1));//TODO: t2082361: handle Gen & Cell + SSATmp* dst = inst->dst(); + SSATmp* src = inst->src(0); auto dstReg = m_regs[dst].getReg(); if (!m_regs[src].hasReg(0)) { assert(src->isConst()); @@ -1155,9 +1155,9 @@ void CodeGenerator::cgBinaryIntOp(IRInstruction* inst, Oper oper, RegType (*convertReg)(PhysReg), Commutativity commuteFlag) { - const SSATmp* dst = inst->getDst(); - const SSATmp* src1 = inst->getSrc(0); - const SSATmp* src2 = inst->getSrc(1); + const SSATmp* dst = inst->dst(); + const SSATmp* src1 = inst->src(0); + const SSATmp* src2 = inst->src(1); if (!(src1->isA(Type::Bool) || src1->isA(Type::Int)) || !(src2->isA(Type::Bool) || src2->isA(Type::Int))) { CG_PUNT(cgBinaryIntOp); @@ -1242,9 +1242,9 @@ void CodeGenerator::cgBinaryOp(IRInstruction* inst, Oper oper, RegType (*convertReg)(PhysReg), Commutativity commuteFlag) { - const SSATmp* dst = inst->getDst(); - const SSATmp* src1 = inst->getSrc(0); - const SSATmp* src2 = inst->getSrc(1); + const SSATmp* dst = inst->dst(); + const SSATmp* src1 = inst->src(0); + const SSATmp* src2 = inst->src(1); if (!(src1->isA(Type::Bool) || src1->isA(Type::Int) || src1->isA(Type::Dbl)) || !(src2->isA(Type::Bool) || src2->isA(Type::Int) || src2->isA(Type::Dbl)) ) @@ -1303,9 +1303,9 @@ bool CodeGenerator::emitDec(SSATmp* dst, SSATmp* src1, SSATmp* src2) { } void CodeGenerator::cgOpAdd(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* src1 = inst->getSrc(0); - SSATmp* src2 = inst->getSrc(1); + SSATmp* dst = inst->dst(); + SSATmp* src1 = inst->src(0); + SSATmp* src2 = inst->src(1); // Special cases: x = y + 1 if (emitInc(dst, src1, src2) || emitInc(dst, src2, src1)) return; @@ -1321,9 +1321,9 @@ void CodeGenerator::cgOpAdd(IRInstruction* inst) { } void CodeGenerator::cgOpSub(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* src1 = inst->getSrc(0); - SSATmp* src2 = inst->getSrc(1); + SSATmp* dst = inst->dst(); + SSATmp* src1 = inst->src(0); + SSATmp* src2 = inst->src(1); if (emitDec(dst, src1, src2)) return; @@ -1378,8 +1378,8 @@ void CodeGenerator::cgOpBitXor(IRInstruction* inst) { } void CodeGenerator::cgOpBitNot(IRInstruction* inst) { - cgUnaryIntOp(inst->getDst(), - inst->getSrc(0), + cgUnaryIntOp(inst->dst(), + inst->src(0), &Asm::not, [](int64_t i) { return ~i; }); } @@ -1406,8 +1406,8 @@ void CodeGenerator::cgOpMul(IRInstruction* inst) { } void CodeGenerator::cgOpNot(IRInstruction* inst) { - auto const src = inst->getSrc(0); - auto const dstReg = m_regs[inst->getDst()].getReg(); + auto const src = inst->src(0); + auto const dstReg = m_regs[inst->dst()].getReg(); auto& a = m_as; if (src->isConst()) { @@ -1480,9 +1480,9 @@ void CodeGenerator::cgOpCmpHelper( int64_t (*obj_cmp_int)(ObjectData*, int64_t), int64_t (*arr_cmp_arr)( ArrayData*, ArrayData*) ) { - SSATmp* dst = inst->getDst(); - SSATmp* src1 = inst->getSrc(0); - SSATmp* src2 = inst->getSrc(1); + SSATmp* dst = inst->dst(); + SSATmp* src1 = inst->src(0); + SSATmp* src2 = inst->src(1); Type type1 = src1->type(); Type type2 = src2->type(); @@ -1703,7 +1703,7 @@ void CodeGenerator::emitTypeTest(Type type, Loc1 typeSrc, Loc2 dataSrc, template void CodeGenerator::emitIsTypeTest(IRInstruction* inst, JmpFn doJcc) { - auto const src = inst->getSrc(0); + auto const src = inst->src(0); // punt if specialized object for now if (inst->getTypeParam().strictSubtypeOf(Type::Obj)) { @@ -1776,7 +1776,7 @@ void CodeGenerator::emitTypeGuard(Type type, Loc typeSrc, Loc dataSrc) { } void CodeGenerator::emitSetCc(IRInstruction* inst, ConditionCode cc) { - m_as.setcc(cc, rbyte(m_regs[inst->getDst()].getReg())); + m_as.setcc(cc, rbyte(m_regs[inst->dst()].getReg())); } void CodeGenerator::cgIsTypeMemCommon(IRInstruction* inst, bool negate) { @@ -1842,11 +1842,11 @@ HOT_FUNC_VM static bool instanceOfHelper(const Class* objClass, void CodeGenerator::cgInstanceOf(IRInstruction* inst) { cgCallHelper(m_as, TCA(instanceOfHelper), - inst->getDst(), + inst->dst(), kNoSyncPoint, ArgGroup(m_regs) - .ssa(inst->getSrc(0)) - .ssa(inst->getSrc(1))); + .ssa(inst->src(0)) + .ssa(inst->src(1))); } /* @@ -1857,8 +1857,8 @@ void CodeGenerator::cgInstanceOf(IRInstruction* inst) { * and will fail this check. */ void CodeGenerator::emitInstanceBitmaskCheck(IRInstruction* inst) { - auto const rObjClass = m_regs[inst->getSrc(0)].getReg(0); - auto const testClassName = inst->getSrc(1)->getValStr(); + auto const rObjClass = m_regs[inst->src(0)].getReg(0); + auto const testClassName = inst->src(1)->getValStr(); auto& a = m_as; int offset; @@ -1872,13 +1872,13 @@ void CodeGenerator::emitInstanceBitmaskCheck(IRInstruction* inst) { void CodeGenerator::cgInstanceOfBitmask(IRInstruction* inst) { auto& a = m_as; emitInstanceBitmaskCheck(inst); - a. setnz (rbyte(m_regs[inst->getDst()].getReg())); + a. setnz (rbyte(m_regs[inst->dst()].getReg())); } void CodeGenerator::cgNInstanceOfBitmask(IRInstruction* inst) { auto& a = m_as; emitInstanceBitmaskCheck(inst); - a. setz (rbyte(m_regs[inst->getDst()].getReg())); + a. setz (rbyte(m_regs[inst->dst()].getReg())); } void CodeGenerator::cgJmpInstanceOfBitmask(IRInstruction* inst) { @@ -1908,10 +1908,10 @@ void CodeGenerator::cgReqBindJmpNInstanceOfBitmask(IRInstruction* inst) { * Class entry. */ void CodeGenerator::cgExtendsClass(IRInstruction* inst) { - auto const rObjClass = m_regs[inst->getSrc(0)].getReg(); - auto const testClass = inst->getSrc(1)->getValClass(); - auto rTestClass = m_regs[inst->getSrc(1)].getReg(); - auto const rdst = rbyte(m_regs[inst->getDst()].getReg()); + auto const rObjClass = m_regs[inst->src(0)].getReg(); + auto const testClass = inst->src(1)->getValClass(); + auto rTestClass = m_regs[inst->src(1)].getReg(); + auto const rdst = rbyte(m_regs[inst->dst()].getReg()); auto& a = m_as; Label out; @@ -1955,10 +1955,10 @@ asm_label(a, out); } void CodeGenerator::cgConvDblToBool(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); + SSATmp* dst = inst->dst(); auto dstReg = m_regs[dst].getReg(); assert(dstReg != InvalidReg); - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); auto srcReg = m_regs[src].getReg(); if (srcReg == InvalidReg) { assert(src->isConst()); @@ -1977,10 +1977,10 @@ void CodeGenerator::cgConvDblToBool(IRInstruction* inst) { } void CodeGenerator::cgConvIntToBool(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); + SSATmp* dst = inst->dst(); auto dstReg = m_regs[dst].getReg(); assert(dstReg != InvalidReg); - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); auto srcReg = m_regs[src].getReg(); if (srcReg == InvalidReg) { @@ -1999,8 +1999,8 @@ void CodeGenerator::cgConvIntToBool(IRInstruction* inst) { } void CodeGenerator::emitConvBoolOrIntToDbl(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); - SSATmp* dst = inst->getDst(); + SSATmp* src = inst->src(0); + SSATmp* dst = inst->dst(); PhysReg dstReg = m_regs[dst].getReg(); assert(src->isA(Type::Bool) || src->isA(Type::Int)); assert(dstReg != InvalidReg); @@ -2031,10 +2031,10 @@ void CodeGenerator::cgConvIntToDbl(IRInstruction* inst) { } void CodeGenerator::cgConvBoolToInt(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); + SSATmp* dst = inst->dst(); auto dstReg = m_regs[dst].getReg(); assert(dstReg != InvalidReg); - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); auto srcReg = m_regs[src].getReg(); assert(src->isConst() == (srcReg == InvalidReg)); if (srcReg == InvalidReg) { @@ -2050,10 +2050,10 @@ void CodeGenerator::cgConvBoolToInt(IRInstruction* inst) { } void CodeGenerator::cgConvBoolToStr(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); + SSATmp* dst = inst->dst(); auto dstReg = m_regs[dst].getReg(); assert(dstReg != InvalidReg); - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); auto srcReg = m_regs[src].getReg(); assert(src->isConst() == (srcReg == InvalidReg)); if (srcReg == InvalidReg) { @@ -2072,8 +2072,8 @@ void CodeGenerator::cgConvBoolToStr(IRInstruction* inst) { } void CodeGenerator::cgUnboxPtr(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* src = inst->getSrc(0); + SSATmp* dst = inst->dst(); + SSATmp* src = inst->src(0); auto srcReg = m_regs[src].getReg(); auto dstReg = m_regs[dst].getReg(); @@ -2086,8 +2086,8 @@ void CodeGenerator::cgUnboxPtr(IRInstruction* inst) { } void CodeGenerator::cgUnbox(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* src = inst->getSrc(0); + SSATmp* dst = inst->dst(); + SSATmp* src = inst->src(0); auto dstValReg = m_regs[dst].getReg(0); auto dstTypeReg = m_regs[dst].getReg(1); auto srcValReg = m_regs[src].getReg(0); @@ -2117,8 +2117,8 @@ void CodeGenerator::cgUnbox(IRInstruction* inst) { } void CodeGenerator::cgLdFuncCachedCommon(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* methodName = inst->getSrc(0); + SSATmp* dst = inst->dst(); + SSATmp* methodName = inst->src(0); const StringData* name = methodName->getValStr(); CacheHandle ch = TargetCache::allocFixedFunction(name); @@ -2151,8 +2151,8 @@ void CodeGenerator::cgLdFuncCachedSafe(IRInstruction* inst) { } void CodeGenerator::cgLdFunc(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* methodName = inst->getSrc(0); + SSATmp* dst = inst->dst(); + SSATmp* methodName = inst->src(0); TargetCache::CacheHandle ch = TargetCache::FuncCache::alloc(); // raises an error if function not found @@ -2167,17 +2167,17 @@ static void emitLdObjClass(CodeGenerator::Asm& a, } void CodeGenerator::cgLdObjClass(IRInstruction* inst) { - auto dstReg = m_regs[inst->getDst()].getReg(); - auto objReg = m_regs[inst->getSrc(0)].getReg(); + auto dstReg = m_regs[inst->dst()].getReg(); + auto objReg = m_regs[inst->src(0)].getReg(); emitLdObjClass(m_as, objReg, dstReg); } void CodeGenerator::cgLdObjMethod(IRInstruction *inst) { - auto cls = inst->getSrc(0); + auto cls = inst->src(0); auto clsReg = m_regs[cls].getReg(); - auto name = inst->getSrc(1); - auto actRec = inst->getSrc(2); + auto name = inst->src(1); + auto actRec = inst->src(2); auto actRecReg = m_regs[actRec].getReg(); CacheHandle handle = Transl::TargetCache::MethodCache::alloc(); @@ -2209,20 +2209,20 @@ void CodeGenerator::cgLdObjMethod(IRInstruction *inst) { } void CodeGenerator::cgStRetVal(IRInstruction* inst) { - auto const rFp = m_regs[inst->getSrc(0)].getReg(); - auto* const val = inst->getSrc(1); + auto const rFp = m_regs[inst->src(0)].getReg(); + auto* const val = inst->src(1); cgStore(rFp, AROFF(m_r), val); } void CodeGenerator::cgRetAdjustStack(IRInstruction* inst) { - auto const rFp = m_regs[inst->getSrc(0)].getReg(); - auto const dstSp = m_regs[inst->getDst()].getReg(); + auto const rFp = m_regs[inst->src(0)].getReg(); + auto const dstSp = m_regs[inst->dst()].getReg(); auto& a = m_as; a. lea (rFp[AROFF(m_r)], dstSp); } void CodeGenerator::cgLdRetAddr(IRInstruction* inst) { - auto fpReg = m_regs[inst->getSrc(0)].getReg(0); + auto fpReg = m_regs[inst->src(0)].getReg(0); assert(fpReg != InvalidReg); m_as.push(fpReg[AROFF(m_savedRip)]); } @@ -2270,8 +2270,8 @@ void CodeGenerator::emitTraceRet(CodeGenerator::Asm& a) { } void CodeGenerator::cgRetCtrl(IRInstruction* inst) { - SSATmp* sp = inst->getSrc(0); - SSATmp* fp = inst->getSrc(1); + SSATmp* sp = inst->src(0); + SSATmp* fp = inst->src(1); // Make sure rVmFp and rVmSp are set appropriately emitMovRegReg(m_as, m_regs[sp].getReg(), rVmSp); @@ -2299,7 +2299,7 @@ void CodeGenerator::emitReqBindAddr(const Func* func, void CodeGenerator::cgJmpSwitchDest(IRInstruction* inst) { JmpSwitchData* data = inst->getExtra(); - SSATmp* index = inst->getSrc(0); + SSATmp* index = inst->src(0); auto indexReg = m_regs[index].getReg(); if (!index->isConst()) { @@ -2363,10 +2363,10 @@ void CodeGenerator::cgLdSSwitchDestFast(IRInstruction* inst) { cgCallHelper(m_as, TCA(sswitchHelperFast), - inst->getDst(), + inst->dst(), kNoSyncPoint, ArgGroup(m_regs) - .ssa(inst->getSrc(0)) + .ssa(inst->src(0)) .immPtr(table) .immPtr(def)); } @@ -2397,10 +2397,10 @@ void CodeGenerator::cgLdSSwitchDestSlow(IRInstruction* inst) { cgCallHelper(m_as, TCA(sswitchHelperSlow), - inst->getDst(), + inst->dst(), kSyncPoint, ArgGroup(m_regs) - .typedValue(inst->getSrc(0)) + .typedValue(inst->src(0)) .immPtr(strtab) .imm(data->numCases) .immPtr(jmptab)); @@ -2417,7 +2417,7 @@ void CodeGenerator::cgLdSSwitchDestSlow(IRInstruction* inst) { * anyway. */ void CodeGenerator::cgDefInlineFP(IRInstruction* inst) { - auto const fp = m_regs[inst->getSrc(0)].getReg(); + auto const fp = m_regs[inst->src(0)].getReg(); auto const fakeRet = m_tx64->getRetFromInlinedFrame(); auto const retBCOff = inst->getExtra()->retBCOff; @@ -2428,7 +2428,7 @@ void CodeGenerator::cgDefInlineFP(IRInstruction* inst) { } void CodeGenerator::cgInlineReturn(IRInstruction* inst) { - auto fpReg = m_regs[inst->getSrc(0)].getReg(); + auto fpReg = m_regs[inst->src(0)].getReg(); assert(fpReg == rVmFp); m_as. loadq (fpReg[AROFF(m_savedRbp)], rVmFp); } @@ -2438,8 +2438,8 @@ void CodeGenerator::cgReDefSP(IRInstruction* inst) { // non-generator frames) when we don't track rVmSp independently // from rVmFp. In generator frames we'll have to track offsets from // a DefGeneratorSP or something similar. - auto fp = m_regs[inst->getSrc(0)].getReg(); - auto dst = m_regs[inst->getDst()].getReg(); + auto fp = m_regs[inst->src(0)].getReg(); + auto dst = m_regs[inst->dst()].getReg(); auto off = -inst->getExtra()->offset * sizeof(Cell); emitLea(m_as, fp[off], dst); } @@ -2453,13 +2453,13 @@ void CodeGenerator::cgReDefGeneratorSP(IRInstruction* inst) { } void CodeGenerator::cgFreeActRec(IRInstruction* inst) { - m_as.loadq(m_regs[inst->getSrc(0)].getReg()[AROFF(m_savedRbp)], - m_regs[inst->getDst()].getReg()); + m_as.loadq(m_regs[inst->src(0)].getReg()[AROFF(m_savedRbp)], + m_regs[inst->dst()].getReg()); } void CodeGenerator::cgSpill(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* src = inst->getSrc(0); + SSATmp* dst = inst->dst(); + SSATmp* src = inst->src(0); assert(dst->numNeededRegs() == src->numNeededRegs()); for (int locIndex = 0; locIndex < m_regs[src].numAllocatedRegs(); @@ -2484,8 +2484,8 @@ void CodeGenerator::cgSpill(IRInstruction* inst) { } void CodeGenerator::cgReload(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* src = inst->getSrc(0); + SSATmp* dst = inst->dst(); + SSATmp* src = inst->src(0); assert(dst->numNeededRegs() == src->numNeededRegs()); for (int locIndex = 0; locIndex < m_regs[dst].numAllocatedRegs(); @@ -2510,9 +2510,9 @@ void CodeGenerator::cgReload(IRInstruction* inst) { } void CodeGenerator::cgStPropWork(IRInstruction* inst, bool genTypeStore) { - SSATmp* obj = inst->getSrc(0); - SSATmp* prop = inst->getSrc(1); - SSATmp* src = inst->getSrc(2); + SSATmp* obj = inst->src(0); + SSATmp* prop = inst->src(1); + SSATmp* src = inst->src(2); cgStore(m_regs[obj].getReg(), prop->getValInt(), src, genTypeStore); } void CodeGenerator::cgStProp(IRInstruction* inst) { @@ -2523,9 +2523,9 @@ void CodeGenerator::cgStPropNT(IRInstruction* inst) { } void CodeGenerator::cgStMemWork(IRInstruction* inst, bool genStoreType) { - SSATmp* addr = inst->getSrc(0); - SSATmp* offset = inst->getSrc(1); - SSATmp* src = inst->getSrc(2); + SSATmp* addr = inst->src(0); + SSATmp* offset = inst->src(1); + SSATmp* src = inst->src(2); cgStore(m_regs[addr].getReg(), offset->getValInt(), src, genStoreType); } void CodeGenerator::cgStMem(IRInstruction* inst) { @@ -2536,9 +2536,9 @@ void CodeGenerator::cgStMemNT(IRInstruction* inst) { } void CodeGenerator::cgStRefWork(IRInstruction* inst, bool genStoreType) { - auto destReg = m_regs[inst->getDst()].getReg(); - auto addrReg = m_regs[inst->getSrc(0)].getReg(); - SSATmp* src = inst->getSrc(1); + auto destReg = m_regs[inst->dst()].getReg(); + auto addrReg = m_regs[inst->src(0)].getReg(); + SSATmp* src = inst->src(1); cgStore(addrReg, RefData::tvOffset(), src, genStoreType); if (destReg != InvalidReg) emitMovRegReg(m_as, addrReg, destReg); } @@ -2565,22 +2565,22 @@ int CodeGenerator::getIterOffset(SSATmp* tmp) { } void CodeGenerator::cgStLoc(IRInstruction* inst) { - cgStore(m_regs[inst->getSrc(0)].getReg(), + cgStore(m_regs[inst->src(0)].getReg(), getLocalOffset(inst->getExtra()->locId), - inst->getSrc(1), + inst->src(1), true /* store type */); } void CodeGenerator::cgStLocNT(IRInstruction* inst) { - cgStore(m_regs[inst->getSrc(0)].getReg(), + cgStore(m_regs[inst->src(0)].getReg(), getLocalOffset(inst->getExtra()->locId), - inst->getSrc(1), + inst->src(1), false /* store type */); } void CodeGenerator::cgSyncABIRegs(IRInstruction* inst) { - emitMovRegReg(m_as, m_regs[inst->getSrc(0)].getReg(), rVmFp); - emitMovRegReg(m_as, m_regs[inst->getSrc(1)].getReg(), rVmSp); + emitMovRegReg(m_as, m_regs[inst->src(0)].getReg(), rVmFp); + emitMovRegReg(m_as, m_regs[inst->src(1)].getReg(), rVmSp); } void CodeGenerator::cgReqBindJmp(IRInstruction* inst) { @@ -2677,8 +2677,8 @@ void CodeGenerator::cgIncRefWork(Type type, SSATmp* src) { } void CodeGenerator::cgIncRef(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* src = inst->getSrc(0); + SSATmp* dst = inst->dst(); + SSATmp* src = inst->src(0); Type type = src->type(); cgIncRefWork(type, src); @@ -2688,13 +2688,13 @@ void CodeGenerator::cgIncRef(IRInstruction* inst) { void CodeGenerator::cgDecRefStack(IRInstruction* inst) { cgDecRefMem(inst->getTypeParam(), - m_regs[inst->getSrc(0)].getReg(), + m_regs[inst->src(0)].getReg(), cellsToBytes(inst->getExtra()->offset), nullptr); } void CodeGenerator::cgDecRefThis(IRInstruction* inst) { - SSATmp* fp = inst->getSrc(0); + SSATmp* fp = inst->src(0); Block* exit = inst->getTaken(); auto fpReg = m_regs[fp].getReg(); auto scratchReg = m_rScratch; @@ -2726,15 +2726,15 @@ void CodeGenerator::cgDecRefThis(IRInstruction* inst) { void CodeGenerator::cgDecRefLoc(IRInstruction* inst) { cgDecRefMem(inst->getTypeParam(), - m_regs[inst->getSrc(0)].getReg(), + m_regs[inst->src(0)].getReg(), getLocalOffset(inst->getExtra()->locId), inst->getTaken()); } void CodeGenerator::cgGenericRetDecRefs(IRInstruction* inst) { - auto const rFp = m_regs[inst->getSrc(0)].getReg(); - auto const numLocals = inst->getSrc(1)->getValInt(); - auto const rDest = m_regs[inst->getDst()].getReg(); + auto const rFp = m_regs[inst->src(0)].getReg(); + auto const numLocals = inst->src(1)->getValInt(); + auto const rDest = m_regs[inst->dst()].getReg(); auto& a = m_as; assert(rFp == rVmFp && @@ -3099,15 +3099,15 @@ void CodeGenerator::cgDecRefMem(Type type, } void CodeGenerator::cgDecRefMem(IRInstruction* inst) { - assert(inst->getSrc(0)->type().isPtr()); + assert(inst->src(0)->type().isPtr()); cgDecRefMem(inst->getTypeParam(), - m_regs[inst->getSrc(0)].getReg(), - inst->getSrc(1)->getValInt(), + m_regs[inst->src(0)].getReg(), + inst->src(1)->getValInt(), inst->getTaken()); } void CodeGenerator::cgDecRefWork(IRInstruction* inst, bool genZeroCheck) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (!isRefCounted(src)) return; Block* exit = inst->getTaken(); Type type = src->type(); @@ -3141,10 +3141,10 @@ void CodeGenerator::cgDecRefNZOrBranch(IRInstruction* inst) { } void CodeGenerator::cgSpillFrame(IRInstruction* inst) { - auto const sp = inst->getSrc(0); - auto const fp = inst->getSrc(1); - auto const func = inst->getSrc(2); - auto const objOrCls = inst->getSrc(3); + auto const sp = inst->src(0); + auto const fp = inst->src(1); + auto const func = inst->src(2); + auto const objOrCls = inst->src(3); auto const magicName = inst->getExtra()->invName; auto const nArgs = inst->getExtra()->numArgs; @@ -3236,7 +3236,7 @@ void CodeGenerator::cgSpillFrame(IRInstruction* inst) { spReg); emitAdjustSp(spReg, - m_regs[inst->getDst()].getReg(), + m_regs[inst->dst()].getReg(), spOffset); } @@ -3258,8 +3258,8 @@ Instance* createClHelper(Class* cls, int numArgs, ActRec* ar, TypedValue* sp) { } void CodeGenerator::cgAllocObjFast(IRInstruction* inst) { - const Class* cls = inst->getSrc(0)->getValClass(); - auto dstReg = m_regs[inst->getDst()].getReg(); + const Class* cls = inst->src(0)->getValClass(); + auto dstReg = m_regs[inst->dst()].getReg(); // First, make sure our property init vectors are all set up bool props = cls->pinitVec().size() > 0; @@ -3383,12 +3383,12 @@ void CodeGenerator::cgInlineCreateCont(IRInstruction* inst) { cgCallHelper( m_as, reinterpret_cast(helper), - inst->getDst(), + inst->dst(), kSyncPoint, ArgGroup(m_regs) .immPtr(data.origFunc) .immPtr(data.genFunc) - .ssa(inst->getSrc(0)) + .ssa(inst->src(0)) .immPtr(nullptr) // getArgs array // Deliberately ignoring frameStaticClass parameter, because // it's unused if we have a $this pointer, and we don't inline @@ -3396,7 +3396,7 @@ void CodeGenerator::cgInlineCreateCont(IRInstruction* inst) { ); if (data.origFunc->isMethod()) { // We can't support a null $this. - assert(inst->getSrc(0)->isA(Type::Obj)); + assert(inst->src(0)->isA(Type::Obj)); } } @@ -3413,10 +3413,10 @@ void CodeGenerator::cgCallArray(IRInstruction* inst) { } void CodeGenerator::cgCall(IRInstruction* inst) { - SSATmp* actRec = inst->getSrc(0); - SSATmp* returnBcOffset = inst->getSrc(1); - SSATmp* func = inst->getSrc(2); - SrcRange args = inst->getSrcs().subpiece(3); + SSATmp* actRec = inst->src(0); + SSATmp* returnBcOffset = inst->src(1); + SSATmp* func = inst->src(2); + SrcRange args = inst->srcs().subpiece(3); int32_t numArgs = args.size(); auto spReg = m_regs[actRec].getReg(); @@ -3449,7 +3449,7 @@ void CodeGenerator::cgCall(IRInstruction* inst) { void CodeGenerator::cgCastStk(IRInstruction *inst) { Type type = inst->getTypeParam(); - SSATmp* sp = inst->getSrc(0); + SSATmp* sp = inst->src(0); uint32_t offset = inst->getExtra()->offset; PhysReg spReg = m_regs[sp].getReg(); @@ -3479,10 +3479,10 @@ void CodeGenerator::cgCastStk(IRInstruction *inst) { } void CodeGenerator::cgCallBuiltin(IRInstruction* inst) { - SSATmp* f = inst->getSrc(0); - auto args = inst->getSrcs().subpiece(1); + SSATmp* f = inst->src(0); + auto args = inst->srcs().subpiece(1); int32_t numArgs = args.size(); - SSATmp* dst = inst->getDst(); + SSATmp* dst = inst->dst(); auto dstReg = m_regs[dst].getReg(0); auto dstType = m_regs[dst].getReg(1); Type returnType = inst->getTypeParam(); @@ -3574,10 +3574,10 @@ void CodeGenerator::cgCallBuiltin(IRInstruction* inst) { } void CodeGenerator::cgSpillStack(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* sp = inst->getSrc(0); - auto const spDeficit = inst->getSrc(1)->getValInt(); - auto const spillVals = inst->getSrcs().subpiece(2); + SSATmp* dst = inst->dst(); + SSATmp* sp = inst->src(0); + auto const spDeficit = inst->src(1)->getValInt(); + auto const spillVals = inst->srcs().subpiece(2); auto const numSpillSrcs = spillVals.size(); auto const dstReg = m_regs[dst].getReg(); auto const spReg = m_regs[sp].getReg(); @@ -3599,7 +3599,7 @@ void CodeGenerator::cgSpillStack(IRInstruction* inst) { } // If our value came from a LdStack on the same sp and offset, // we don't need to spill it. - if (inst->op() == LdStack && inst->getSrc(0) == sp && + if (inst->op() == LdStack && inst->src(0) == sp && inst->getExtra()->offset * sizeof(Cell) == offset) { FTRACE(6, "{}: Not spilling spill value {} from {}\n", __func__, i, inst->toString()); @@ -3626,8 +3626,8 @@ void CodeGenerator::emitAdjustSp(PhysReg spReg, } void CodeGenerator::cgNativeImpl(IRInstruction* inst) { - SSATmp* func = inst->getSrc(0); - SSATmp* fp = inst->getSrc(1); + SSATmp* func = inst->src(0); + SSATmp* fp = inst->src(1); assert(func->isConst()); assert(func->type() == Type::Func); @@ -3643,8 +3643,8 @@ void CodeGenerator::cgNativeImpl(IRInstruction* inst) { } void CodeGenerator::cgLdThis(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* src = inst->getSrc(0); + SSATmp* dst = inst->dst(); + SSATmp* src = inst->src(0); Block* label = inst->getTaken(); // mov dst, [fp + 0x20] auto dstReg = m_regs[dst].getReg(); @@ -3676,8 +3676,8 @@ static void emitLdClsCctx(CodeGenerator::Asm& a, } void CodeGenerator::cgLdClsCtx(IRInstruction* inst) { - PhysReg srcReg = m_regs[inst->getSrc(0)].getReg(); - PhysReg dstReg = m_regs[inst->getDst()].getReg(); + PhysReg srcReg = m_regs[inst->src(0)].getReg(); + PhysReg dstReg = m_regs[inst->dst()].getReg(); // Context could be either a this object or a class ptr m_as. testb(1, rbyte(srcReg)); ifThenElse(CC_NZ, @@ -3687,14 +3687,14 @@ void CodeGenerator::cgLdClsCtx(IRInstruction* inst) { } void CodeGenerator::cgLdClsCctx(IRInstruction* inst) { - PhysReg srcReg = m_regs[inst->getSrc(0)].getReg(); - PhysReg dstReg = m_regs[inst->getDst()].getReg(); + PhysReg srcReg = m_regs[inst->src(0)].getReg(); + PhysReg dstReg = m_regs[inst->dst()].getReg(); emitLdClsCctx(m_as, srcReg, dstReg); } void CodeGenerator::cgLdCtx(IRInstruction* inst) { - PhysReg dstReg = m_regs[inst->getDst()].getReg(); - PhysReg srcReg = m_regs[inst->getSrc(0)].getReg(); + PhysReg dstReg = m_regs[inst->dst()].getReg(); + PhysReg srcReg = m_regs[inst->src(0)].getReg(); if (dstReg != InvalidReg) { m_as.loadq(srcReg[AROFF(m_this)], dstReg); } @@ -3705,16 +3705,16 @@ void CodeGenerator::cgLdCctx(IRInstruction* inst) { } void CodeGenerator::cgLdConst(IRInstruction* inst) { - auto const dstReg = m_regs[inst->getDst()].getReg(); + auto const dstReg = m_regs[inst->dst()].getReg(); auto const val = inst->getExtra()->as(); if (dstReg == InvalidReg) return; emitLoadImm(m_as, val, dstReg); } void CodeGenerator::cgLdARFuncPtr(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* baseAddr = inst->getSrc(0); - SSATmp* offset = inst->getSrc(1); + SSATmp* dst = inst->dst(); + SSATmp* baseAddr = inst->src(0); + SSATmp* offset = inst->src(1); auto dstReg = m_regs[dst].getReg(); auto baseReg = m_regs[baseAddr].getReg(); @@ -3727,8 +3727,8 @@ void CodeGenerator::cgLdARFuncPtr(IRInstruction* inst) { } void CodeGenerator::cgLdContLocalsPtr(IRInstruction* inst) { - auto rCont = m_regs[inst->getSrc(0)].getReg(); - auto rLocals = m_regs[inst->getDst()].getReg(); + auto rCont = m_regs[inst->src(0)].getReg(); + auto rLocals = m_regs[inst->dst()].getReg(); m_as. loadl (rCont[CONTOFF(m_localsOffset)], r32(rLocals)); m_as. addq (rCont, rLocals); } @@ -3740,9 +3740,9 @@ static int getNativeTypeSize(Type type) { } void CodeGenerator::cgLdRaw(IRInstruction* inst) { - SSATmp* dest = inst->getDst(); - SSATmp* addr = inst->getSrc(0); - SSATmp* offset = inst->getSrc(1); + SSATmp* dest = inst->dst(); + SSATmp* addr = inst->src(0); + SSATmp* offset = inst->src(1); assert(!(dest->isConst())); @@ -3782,9 +3782,9 @@ void CodeGenerator::cgLdRaw(IRInstruction* inst) { } void CodeGenerator::cgStRaw(IRInstruction* inst) { - auto baseReg = m_regs[inst->getSrc(0)].getReg(); - int64_t kind = inst->getSrc(1)->getValInt(); - SSATmp* value = inst->getSrc(2); + auto baseReg = m_regs[inst->src(0)].getReg(); + int64_t kind = inst->src(1)->getValInt(); + SSATmp* value = inst->src(2); RawMemSlot& slot = RawMemSlot::Get(RawMemSlot::Kind(kind)); assert(value->type().equals(slot.type())); @@ -3814,8 +3814,8 @@ void CodeGenerator::cgStRaw(IRInstruction* inst) { } void CodeGenerator::cgLdStaticLocCached(IRInstruction* inst) { - auto ch = inst->getSrc(0)->getValRawInt(); - auto outReg = m_regs[inst->getDst()].getReg(); + auto ch = inst->src(0)->getValRawInt(); + auto outReg = m_regs[inst->dst()].getReg(); m_as.loadq (rVmTl[ch], outReg); m_as.testq (outReg, outReg); @@ -3829,7 +3829,7 @@ void CodeGenerator::cgLoadTypedValue(PhysReg base, IRInstruction* inst) { Block* label = inst->getTaken(); Type type = inst->getTypeParam(); - SSATmp* dst = inst->getDst(); + SSATmp* dst = inst->dst(); assert(type == dst->type()); assert(type.needsReg()); @@ -3943,7 +3943,7 @@ void CodeGenerator::cgLoad(PhysReg base, inst->getTaken()); } if (type.isNull()) return; // these are constants - auto dstReg = m_regs[inst->getDst()].getReg(); + auto dstReg = m_regs[inst->dst()].getReg(); // if dstReg == InvalidReg then the value of this load is dead if (dstReg == InvalidReg) return; @@ -3955,15 +3955,15 @@ void CodeGenerator::cgLoad(PhysReg base, } void CodeGenerator::cgLdProp(IRInstruction* inst) { - cgLoad(m_regs[inst->getSrc(0)].getReg(), inst->getSrc(1)->getValInt(), inst); + cgLoad(m_regs[inst->src(0)].getReg(), inst->src(1)->getValInt(), inst); } void CodeGenerator::cgLdMem(IRInstruction * inst) { - cgLoad(m_regs[inst->getSrc(0)].getReg(), inst->getSrc(1)->getValInt(), inst); + cgLoad(m_regs[inst->src(0)].getReg(), inst->src(1)->getValInt(), inst); } void CodeGenerator::cgLdRef(IRInstruction* inst) { - cgLoad(m_regs[inst->getSrc(0)].getReg(), RefData::tvOffset(), inst); + cgLoad(m_regs[inst->src(0)].getReg(), RefData::tvOffset(), inst); } void CodeGenerator::recordSyncPoint(Asm& as, @@ -3989,40 +3989,40 @@ void CodeGenerator::recordSyncPoint(Asm& as, } void CodeGenerator::cgLdAddr(IRInstruction* inst) { - auto base = m_regs[inst->getSrc(0)].getReg(); - int64_t offset = inst->getSrc(1)->getValInt(); - m_as.lea (base[offset], m_regs[inst->getDst()].getReg()); + auto base = m_regs[inst->src(0)].getReg(); + int64_t offset = inst->src(1)->getValInt(); + m_as.lea (base[offset], m_regs[inst->dst()].getReg()); } void CodeGenerator::cgLdLoc(IRInstruction* inst) { - cgLoad(m_regs[inst->getSrc(0)].getReg(), + cgLoad(m_regs[inst->src(0)].getReg(), getLocalOffset(inst->getExtra()->locId), inst); } void CodeGenerator::cgLdLocAddr(IRInstruction* inst) { - auto const fpReg = m_regs[inst->getSrc(0)].getReg(); + auto const fpReg = m_regs[inst->src(0)].getReg(); auto const offset = getLocalOffset(inst->getExtra()->locId); - if (m_regs[inst->getDst()].hasReg()) { - m_as.lea(fpReg[offset], m_regs[inst->getDst()].getReg()); + if (m_regs[inst->dst()].hasReg()) { + m_as.lea(fpReg[offset], m_regs[inst->dst()].getReg()); } } void CodeGenerator::cgLdStackAddr(IRInstruction* inst) { - auto const base = m_regs[inst->getSrc(0)].getReg(); + auto const base = m_regs[inst->src(0)].getReg(); auto const offset = cellsToBytes(inst->getExtra()->offset); - m_as.lea (base[offset], m_regs[inst->getDst()].getReg()); + m_as.lea (base[offset], m_regs[inst->dst()].getReg()); } void CodeGenerator::cgLdStack(IRInstruction* inst) { assert(inst->getTaken() == nullptr); - cgLoad(m_regs[inst->getSrc(0)].getReg(), + cgLoad(m_regs[inst->src(0)].getReg(), cellsToBytes(inst->getExtra()->offset), inst); } void CodeGenerator::cgGuardStk(IRInstruction* inst) { - auto const rSP = m_regs[inst->getSrc(0)].getReg(); + auto const rSP = m_regs[inst->src(0)].getReg(); auto const baseOff = cellsToBytes(inst->getExtra()->offset); emitTypeGuard(inst->getTypeParam(), rSP[baseOff + TVOFF(m_type)], @@ -4030,14 +4030,14 @@ void CodeGenerator::cgGuardStk(IRInstruction* inst) { } void CodeGenerator::cgCheckStk(IRInstruction* inst) { - auto const rbase = m_regs[inst->getSrc(0)].getReg(); + auto const rbase = m_regs[inst->src(0)].getReg(); auto const baseOff = cellsToBytes(inst->getExtra()->offset); emitTypeCheck(inst->getTypeParam(), rbase[baseOff + TVOFF(m_type)], rbase[baseOff + TVOFF(m_data)], inst->getTaken()); } void CodeGenerator::cgGuardLoc(IRInstruction* inst) { - auto const rFP = m_regs[inst->getSrc(0)].getReg(); + auto const rFP = m_regs[inst->src(0)].getReg(); auto const baseOff = getLocalOffset(inst->getExtra()->locId); emitTypeGuard(inst->getTypeParam(), rFP[baseOff + TVOFF(m_type)], @@ -4045,7 +4045,7 @@ void CodeGenerator::cgGuardLoc(IRInstruction* inst) { } void CodeGenerator::cgCheckLoc(IRInstruction* inst) { - auto const rbase = m_regs[inst->getSrc(0)].getReg(); + auto const rbase = m_regs[inst->src(0)].getReg(); auto const baseOff = getLocalOffset(inst->getExtra()->locId); emitTypeCheck(inst->getTypeParam(), rbase[baseOff + TVOFF(m_type)], rbase[baseOff + TVOFF(m_data)], inst->getTaken()); @@ -4064,7 +4064,7 @@ void CodeGenerator::emitSideExitGuard(Type type, } void CodeGenerator::cgSideExitGuardLoc(IRInstruction* inst) { - auto const fp = m_regs[inst->getSrc(0)].getReg(); + auto const fp = m_regs[inst->src(0)].getReg(); auto const extra = inst->getExtra(); emitSideExitGuard(inst->getTypeParam(), fp[getLocalOffset(extra->checkedSlot) + TVOFF(m_type)], @@ -4073,7 +4073,7 @@ void CodeGenerator::cgSideExitGuardLoc(IRInstruction* inst) { } void CodeGenerator::cgSideExitGuardStk(IRInstruction* inst) { - auto const sp = m_regs[inst->getSrc(0)].getReg(); + auto const sp = m_regs[inst->src(0)].getReg(); auto const extra = inst->getExtra(); emitSideExitGuard(inst->getTypeParam(), sp[cellsToBytes(extra->checkedSlot) + TVOFF(m_type)], @@ -4082,12 +4082,12 @@ void CodeGenerator::cgSideExitGuardStk(IRInstruction* inst) { } void CodeGenerator::cgDefMIStateBase(IRInstruction* inst) { - assert(inst->getDst()->type() == Type::PtrToCell); - assert(m_regs[inst->getDst()].getReg() == rsp); + assert(inst->dst()->type() == Type::PtrToCell); + assert(m_regs[inst->dst()].getReg() == rsp); } void CodeGenerator::cgCheckType(IRInstruction* inst) { - auto const src = inst->getSrc(0); + auto const src = inst->src(0); auto const rData = m_regs[src].getReg(0); auto const rType = m_regs[src].getReg(1); @@ -4095,7 +4095,7 @@ void CodeGenerator::cgCheckType(IRInstruction* inst) { [&](ConditionCode cc) { emitFwdJcc(ccNegate(cc), inst->getTaken()); - auto const dstReg = m_regs[inst->getDst()].getReg(); + auto const dstReg = m_regs[inst->dst()].getReg(); if (dstReg != InvalidReg) { emitMovRegReg(m_as, m_regs[src].getReg(0), dstReg); } @@ -4103,20 +4103,20 @@ void CodeGenerator::cgCheckType(IRInstruction* inst) { } void CodeGenerator::cgCheckTypeMem(IRInstruction* inst) { - auto const reg = m_regs[inst->getSrc(0)].getReg(); + auto const reg = m_regs[inst->src(0)].getReg(); emitTypeCheck(inst->getTypeParam(), reg[TVOFF(m_type)], reg[TVOFF(m_data)], inst->getTaken()); } void CodeGenerator::cgGuardRefs(IRInstruction* inst) { - assert(inst->getNumSrcs() == 6); + assert(inst->numSrcs() == 6); - SSATmp* funcPtrTmp = inst->getSrc(0); - SSATmp* nParamsTmp = inst->getSrc(1); - SSATmp* bitsPtrTmp = inst->getSrc(2); - SSATmp* firstBitNumTmp = inst->getSrc(3); - SSATmp* mask64Tmp = inst->getSrc(4); - SSATmp* vals64Tmp = inst->getSrc(5); + SSATmp* funcPtrTmp = inst->src(0); + SSATmp* nParamsTmp = inst->src(1); + SSATmp* bitsPtrTmp = inst->src(2); + SSATmp* firstBitNumTmp = inst->src(3); + SSATmp* mask64Tmp = inst->src(4); + SSATmp* vals64Tmp = inst->src(5); // Get values in place assert(funcPtrTmp->type() == Type::Func); @@ -4185,9 +4185,9 @@ void CodeGenerator::cgGuardRefs(IRInstruction* inst) { } void CodeGenerator::cgLdPropAddr(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* obj = inst->getSrc(0); - SSATmp* prop = inst->getSrc(1); + SSATmp* dst = inst->dst(); + SSATmp* obj = inst->src(0); + SSATmp* prop = inst->src(1); assert(prop->isConst() && prop->type() == Type::Int); @@ -4202,9 +4202,9 @@ void CodeGenerator::cgLdPropAddr(IRInstruction* inst) { } void CodeGenerator::cgLdClsMethod(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* cls = inst->getSrc(0); - SSATmp* mSlot = inst->getSrc(1); + SSATmp* dst = inst->dst(); + SSATmp* cls = inst->src(0); + SSATmp* mSlot = inst->src(1); assert(cls->type() == Type::Cls); assert(mSlot->isConst() && mSlot->type() == Type::Int); @@ -4231,10 +4231,10 @@ void CodeGenerator::cgLdClsMethod(IRInstruction* inst) { } void CodeGenerator::cgLdClsMethodCache(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* className = inst->getSrc(0); - SSATmp* methodName = inst->getSrc(1); - SSATmp* baseClass = inst->getSrc(2); + SSATmp* dst = inst->dst(); + SSATmp* className = inst->src(0); + SSATmp* methodName = inst->src(1); + SSATmp* baseClass = inst->src(2); Block* label = inst->getTaken(); // Stats::emitInc(a, Stats::TgtCache_StaticMethodHit); @@ -4327,9 +4327,9 @@ void CodeGenerator::emitGetCtxFwdCallWithThisDyn(PhysReg destCtxReg, } void CodeGenerator::cgGetCtxFwdCall(IRInstruction* inst) { - PhysReg destCtxReg = m_regs[inst->getDst()].getReg(0); - SSATmp* srcCtxTmp = inst->getSrc(0); - const Func* callee = inst->getSrc(1)->getValFunc(); + PhysReg destCtxReg = m_regs[inst->dst()].getReg(0); + SSATmp* srcCtxTmp = inst->src(0); + const Func* callee = inst->src(1)->getValFunc(); bool withThis = srcCtxTmp->isA(Type::Obj); // Eagerly move src into the dest reg @@ -4350,11 +4350,11 @@ void CodeGenerator::cgGetCtxFwdCall(IRInstruction* inst) { } void CodeGenerator::cgLdClsMethodFCache(IRInstruction* inst) { - PhysReg funcDestReg = m_regs[inst->getDst()].getReg(0); - PhysReg destCtxReg = m_regs[inst->getDst()].getReg(1); - const Class* cls = inst->getSrc(0)->getValClass(); - const StringData* methName = inst->getSrc(1)->getValStr(); - SSATmp* srcCtxTmp = inst->getSrc(2); + PhysReg funcDestReg = m_regs[inst->dst()].getReg(0); + PhysReg destCtxReg = m_regs[inst->dst()].getReg(1); + const Class* cls = inst->src(0)->getValClass(); + const StringData* methName = inst->src(1)->getValStr(); + SSATmp* srcCtxTmp = inst->src(2); PhysReg srcCtxReg = m_regs[srcCtxTmp].getReg(0); Block* exitLabel = inst->getTaken(); const StringData* clsName = cls->name(); @@ -4411,11 +4411,11 @@ void CodeGenerator::cgLdClsMethodFCache(IRInstruction* inst) { void CodeGenerator::cgLdClsPropAddrCached(IRInstruction* inst) { using namespace Transl::TargetCache; - SSATmp* dst = inst->getDst(); - SSATmp* cls = inst->getSrc(0); - SSATmp* propName = inst->getSrc(1); - SSATmp* clsName = inst->getSrc(2); - SSATmp* cxt = inst->getSrc(3); + SSATmp* dst = inst->dst(); + SSATmp* cls = inst->src(0); + SSATmp* propName = inst->src(1); + SSATmp* clsName = inst->src(2); + SSATmp* cxt = inst->src(3); Block* target = inst->getTaken(); const StringData* propNameString = propName->getValStr(); @@ -4457,10 +4457,10 @@ void CodeGenerator::cgLdClsPropAddrCached(IRInstruction* inst) { } void CodeGenerator::cgLdClsPropAddr(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* cls = inst->getSrc(0); - SSATmp* prop = inst->getSrc(1); - SSATmp* cxt = inst->getSrc(2); + SSATmp* dst = inst->dst(); + SSATmp* cls = inst->src(0); + SSATmp* prop = inst->src(1); + SSATmp* cxt = inst->src(2); Block* target = inst->getTaken(); auto dstReg = m_regs[dst].getReg(); if (dstReg == InvalidReg && target) { @@ -4482,8 +4482,8 @@ void CodeGenerator::cgLdClsPropAddr(IRInstruction* inst) { TargetCache::CacheHandle CodeGenerator::cgLdClsCachedCommon( IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - const StringData* className = inst->getSrc(0)->getValStr(); + SSATmp* dst = inst->dst(); + const StringData* className = inst->src(0)->getValStr(); auto ch = TargetCache::allocKnownClass(className); auto dstReg = m_regs[dst].getReg(); if (dstReg == InvalidReg) { @@ -4503,7 +4503,7 @@ void CodeGenerator::cgLdClsCached(IRInstruction* inst) { // third is ignored in the checkOnly==false case. cgCallHelper(a, (TCA)TargetCache::lookupKnownClass, - inst->getDst(), + inst->dst(), kSyncPoint, ArgGroup(m_regs).addr(rVmTl, intptr_t(ch)).ssas(inst, 0)); }); @@ -4517,8 +4517,8 @@ void CodeGenerator::cgLdClsCachedSafe(IRInstruction* inst) { } void CodeGenerator::cgLdCls(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* className = inst->getSrc(0); + SSATmp* dst = inst->dst(); + SSATmp* className = inst->src(0); CacheHandle ch = ClassCache::alloc(); cgCallHelper(m_as, (TCA)ClassCache::lookup, dst, kSyncPoint, @@ -4532,8 +4532,8 @@ static StringData* fullConstName(SSATmp* cls, SSATmp* cnsName) { } void CodeGenerator::cgLdClsCns(IRInstruction* inst) { - SSATmp* cnsName = inst->getSrc(0); - SSATmp* cls = inst->getSrc(1); + SSATmp* cnsName = inst->src(0); + SSATmp* cls = inst->src(1); StringData* fullName = fullConstName(cls, cnsName); TargetCache::CacheHandle ch = TargetCache::allocClassConstant(fullName); @@ -4544,8 +4544,8 @@ void CodeGenerator::cgLdClsCns(IRInstruction* inst) { } void CodeGenerator::cgLookupClsCns(IRInstruction* inst) { - SSATmp* cnsName = inst->getSrc(0); - SSATmp* cls = inst->getSrc(1); + SSATmp* cnsName = inst->src(0); + SSATmp* cls = inst->src(1); assert(inst->getTypeParam() == Type::Cell); assert(cnsName->isConst() && cnsName->type() == Type::StaticStr); @@ -4561,11 +4561,11 @@ void CodeGenerator::cgLookupClsCns(IRInstruction* inst) { .immPtr(cnsName->getValStr()); cgCallHelper(m_as, TCA(TargetCache::lookupClassConstantTv), - inst->getDst(), kSyncPoint, args, DestType::TV); + inst->dst(), kSyncPoint, args, DestType::TV); } void CodeGenerator::cgLdCns(IRInstruction* inst) { - const StringData* cnsName = inst->getSrc(0)->getValStr(); + const StringData* cnsName = inst->src(0)->getValStr(); TargetCache::CacheHandle ch = StringData::DefCnsHandle(cnsName, false); // Has an unlikely branch to a LookupCns @@ -4601,7 +4601,7 @@ static TypedValue lookupCnsHelper(const TypedValue* tv, StringData* nm) { } void CodeGenerator::cgLookupCns(IRInstruction* inst) { - SSATmp* cnsNameTmp = inst->getSrc(0); + SSATmp* cnsNameTmp = inst->src(0); assert(inst->getTypeParam() == Type::Cell); assert(cnsNameTmp->isConst() && cnsNameTmp->type() == Type::StaticStr); @@ -4614,7 +4614,7 @@ void CodeGenerator::cgLookupCns(IRInstruction* inst) { .immPtr(cnsName); cgCallHelper(m_as, TCA(lookupCnsHelper), - inst->getDst(), kSyncPoint, args, DestType::TV); + inst->dst(), kSyncPoint, args, DestType::TV); } HOT_FUNC_VM @@ -4659,18 +4659,18 @@ static int64_t ak_exist_int_obj(int64_t key, ObjectData* obj) { } void CodeGenerator::cgAKExists(IRInstruction* inst) { - SSATmp* arr = inst->getSrc(0); - SSATmp* key = inst->getSrc(1); + SSATmp* arr = inst->src(0); + SSATmp* key = inst->src(1); if (key->type().isNull()) { if (arr->isA(Type::Arr)) { cgCallHelper(m_as, (TCA)ak_exist_string, - inst->getDst(), + inst->dst(), kNoSyncPoint, ArgGroup(m_regs).immPtr(empty_string.get()).ssa(arr)); } else { - m_as.mov_imm64_reg(0, m_regs[inst->getDst()].getReg()); + m_as.mov_imm64_reg(0, m_regs[inst->dst()].getReg()); } return; } @@ -4682,7 +4682,7 @@ void CodeGenerator::cgAKExists(IRInstruction* inst) { cgCallHelper(m_as, helper_func, - inst->getDst(), + inst->dst(), kNoSyncPoint, ArgGroup(m_regs).ssa(key).ssa(arr)); } @@ -4698,16 +4698,16 @@ HOT_FUNC_VM static TypedValue* ldGblAddrDefHelper(StringData* name) { } void CodeGenerator::cgLdGblAddr(IRInstruction* inst) { - auto dstReg = m_regs[inst->getDst()].getReg(); + auto dstReg = m_regs[inst->dst()].getReg(); cgCallHelper(m_as, (TCA)ldGblAddrHelper, dstReg, kNoSyncPoint, - ArgGroup(m_regs).ssa(inst->getSrc(0))); + ArgGroup(m_regs).ssa(inst->src(0))); m_as.testq(dstReg, dstReg); emitFwdJcc(CC_Z, inst->getTaken()); } void CodeGenerator::cgLdGblAddrDef(IRInstruction* inst) { - cgCallHelper(m_as, (TCA)ldGblAddrDefHelper, inst->getDst(), kNoSyncPoint, - ArgGroup(m_regs).ssa(inst->getSrc(0))); + cgCallHelper(m_as, (TCA)ldGblAddrDefHelper, inst->dst(), kNoSyncPoint, + ArgGroup(m_regs).ssa(inst->src(0))); } void CodeGenerator::emitTestZero(SSATmp* src) { @@ -4733,34 +4733,34 @@ void CodeGenerator::emitTestZero(SSATmp* src) { } void CodeGenerator::cgJmpZero(IRInstruction* inst) { - emitTestZero(inst->getSrc(0)); + emitTestZero(inst->src(0)); emitFwdJcc(CC_Z, inst->getTaken()); } void CodeGenerator::cgJmpNZero(IRInstruction* inst) { - emitTestZero(inst->getSrc(0)); + emitTestZero(inst->src(0)); emitFwdJcc(CC_NZ, inst->getTaken()); } void CodeGenerator::cgReqBindJmpZero(IRInstruction* inst) { // TODO(#2404427): prepareForTestAndSmash? - emitTestZero(inst->getSrc(0)); + emitTestZero(inst->src(0)); emitReqBindJcc(CC_Z, inst->getExtra()); } void CodeGenerator::cgReqBindJmpNZero(IRInstruction* inst) { // TODO(#2404427): prepareForTestAndSmash? - emitTestZero(inst->getSrc(0)); + emitTestZero(inst->src(0)); emitReqBindJcc(CC_NZ, inst->getExtra()); } void CodeGenerator::cgJmp_(IRInstruction* inst) { - assert(inst->getNumSrcs() == inst->getTaken()->getLabel()->getNumDsts()); - if (unsigned n = inst->getNumSrcs()) { + assert(inst->numSrcs() == inst->getTaken()->getLabel()->numDsts()); + if (unsigned n = inst->numSrcs()) { // Parallel-copy sources to the label's destination registers. // TODO: t2040286: this only works if all destinations fit in registers. - SrcRange srcs = inst->getSrcs(); - DstRange dsts = inst->getTaken()->getLabel()->getDsts(); + SrcRange srcs = inst->srcs(); + DstRange dsts = inst->getTaken()->getLabel()->dsts(); ArgGroup args(m_regs); for (unsigned i = 0, j = 0; i < n; i++) { assert(srcs[i]->type().subtypeOf(dsts[i].type())); @@ -4797,13 +4797,13 @@ void CodeGenerator::cgJmp_(IRInstruction* inst) { } void CodeGenerator::cgJmpIndirect(IRInstruction* inst) { - m_as.jmp(m_regs[inst->getSrc(0)].getReg()); + m_as.jmp(m_regs[inst->src(0)].getReg()); } void CodeGenerator::cgCheckInit(IRInstruction* inst) { Block* label = inst->getTaken(); assert(label); - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->type().isInit()) return; @@ -4818,8 +4818,8 @@ void CodeGenerator::cgCheckInit(IRInstruction* inst) { void CodeGenerator::cgCheckInitMem(IRInstruction* inst) { Block* label = inst->getTaken(); assert(label); - SSATmp* base = inst->getSrc(0); - int64_t offset = inst->getSrc(1)->getValInt(); + SSATmp* base = inst->src(0); + int64_t offset = inst->src(1)->getValInt(); Type t = base->type().deref(); if (t.isInit()) return; auto basereg = m_regs[base].getReg(); @@ -4834,7 +4834,7 @@ void CodeGenerator::cgExitWhenSurprised(IRInstruction* inst) { } void CodeGenerator::cgExitOnVarEnv(IRInstruction* inst) { - SSATmp* fp = inst->getSrc(0); + SSATmp* fp = inst->src(0); Block* label = inst->getTaken(); assert(!(fp->isConst())); @@ -4846,7 +4846,7 @@ void CodeGenerator::cgExitOnVarEnv(IRInstruction* inst) { void CodeGenerator::cgReleaseVVOrExit(IRInstruction* inst) { auto* const label = inst->getTaken(); - auto const rFp = m_regs[inst->getSrc(0)].getReg(); + auto const rFp = m_regs[inst->src(0)].getReg(); m_as. cmpq (0, rFp[AROFF(m_varEnv)]); unlikelyIfBlock(CC_NZ, [&] (Asm& a) { @@ -4864,8 +4864,8 @@ void CodeGenerator::cgReleaseVVOrExit(IRInstruction* inst) { } void CodeGenerator::cgBoxPtr(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* addr = inst->getSrc(0); + SSATmp* dst = inst->dst(); + SSATmp* addr = inst->src(0); auto base = m_regs[addr].getReg(); auto dstReg = m_regs[dst].getReg(); emitMovRegReg(m_as, base, dstReg); @@ -4880,9 +4880,9 @@ void CodeGenerator::cgBoxPtr(IRInstruction* inst) { } void CodeGenerator::cgDefCns(IRInstruction* inst) { - UNUSED SSATmp* dst = inst->getDst(); - UNUSED SSATmp* cnsName = inst->getSrc(0); - UNUSED SSATmp* val = inst->getSrc(1); + UNUSED SSATmp* dst = inst->dst(); + UNUSED SSATmp* cnsName = inst->src(0); + UNUSED SSATmp* val = inst->src(1); using namespace TargetCache; CG_PUNT(DefCns); } @@ -4893,9 +4893,9 @@ static StringData* concat_value(TypedValue tv1, TypedValue tv2) { } void CodeGenerator::cgConcat(IRInstruction* inst) { - SSATmp* dst = inst->getDst(); - SSATmp* tl = inst->getSrc(0); - SSATmp* tr = inst->getSrc(1); + SSATmp* dst = inst->dst(); + SSATmp* tl = inst->src(0); + SSATmp* tr = inst->src(1); Type lType = tl->type(); Type rType = tr->type(); @@ -4923,10 +4923,10 @@ void CodeGenerator::cgConcat(IRInstruction* inst) { } void CodeGenerator::cgInterpOne(IRInstruction* inst) { - SSATmp* fp = inst->getSrc(0); - SSATmp* sp = inst->getSrc(1); - SSATmp* pcOffTmp = inst->getSrc(2); - SSATmp* spAdjustmentTmp = inst->getSrc(3); + SSATmp* fp = inst->src(0); + SSATmp* sp = inst->src(1); + SSATmp* pcOffTmp = inst->src(2); + SSATmp* spAdjustmentTmp = inst->src(3); int64_t pcOff = pcOffTmp->getValInt(); auto opc = *(getCurFunc()->unit()->at(pcOff)); @@ -4936,7 +4936,7 @@ void CodeGenerator::cgInterpOne(IRInstruction* inst) { cgCallHelper(m_as, (TCA)interpOneHelper, dstReg, kSyncPoint, ArgGroup(m_regs).ssa(fp).ssa(sp).imm(pcOff)); - auto newSpReg = m_regs[inst->getDst()].getReg(); + auto newSpReg = m_regs[inst->dst()].getReg(); assert(newSpReg == m_regs[sp].getReg()); int64_t spAdjustBytes = cellsToBytes(spAdjustmentTmp->getValInt()); @@ -4946,9 +4946,9 @@ void CodeGenerator::cgInterpOne(IRInstruction* inst) { } void CodeGenerator::cgInterpOneCF(IRInstruction* inst) { - SSATmp* fp = inst->getSrc(0); - SSATmp* sp = inst->getSrc(1); - int64_t pcOff = inst->getSrc(2)->getValInt(); + SSATmp* fp = inst->src(0); + SSATmp* sp = inst->src(1); + int64_t pcOff = inst->src(2)->getValInt(); auto opc = *(getCurFunc()->unit()->at(pcOff)); void* interpOneHelper = interpOneEntryPoints[opc]; @@ -4968,9 +4968,9 @@ void CodeGenerator::cgInterpOneCF(IRInstruction* inst) { } void CodeGenerator::cgFillContThis(IRInstruction* inst) { - SSATmp* cont = inst->getSrc(0); - auto baseReg = m_regs[inst->getSrc(1)].getReg(); - int64_t offset = inst->getSrc(2)->getValInt(); + SSATmp* cont = inst->src(0); + auto baseReg = m_regs[inst->src(1)].getReg(); + int64_t offset = inst->src(2)->getValInt(); auto scratch = m_rScratch; auto contReg = m_regs[cont].getReg(); @@ -4984,10 +4984,10 @@ void CodeGenerator::cgFillContThis(IRInstruction* inst) { } void CodeGenerator::cgContEnter(IRInstruction* inst) { - auto contAR = inst->getSrc(0); - auto addr = inst->getSrc(1); - auto returnOff = inst->getSrc(2); - auto curFp = m_regs[inst->getSrc(3)].getReg(); + auto contAR = inst->src(0); + auto addr = inst->src(1); + auto returnOff = inst->src(2); + auto curFp = m_regs[inst->src(3)].getReg(); auto contARReg = m_regs[contAR].getReg(); m_as. storel (returnOff->getValInt(), contARReg[AROFF(m_soff)]); @@ -5010,25 +5010,25 @@ void CodeGenerator::emitContVarEnvHelperCall(SSATmp* fp, TCA helper) { void CodeGenerator::cgUnlinkContVarEnv(IRInstruction* inst) { emitContVarEnvHelperCall( - inst->getSrc(0), + inst->src(0), (TCA)VMExecutionContext::packContVarEnvLinkage); } void CodeGenerator::cgLinkContVarEnv(IRInstruction* inst) { emitContVarEnvHelperCall( - inst->getSrc(0), + inst->src(0), (TCA)VMExecutionContext::unpackContVarEnvLinkage); } void CodeGenerator::cgContRaiseCheck(IRInstruction* inst) { - SSATmp* cont = inst->getSrc(0); + SSATmp* cont = inst->src(0); m_as.test_imm32_disp_reg32(0x1, CONTOFF(m_should_throw), m_regs[cont].getReg()); emitFwdJcc(CC_NZ, inst->getTaken()); } void CodeGenerator::cgContPreNext(IRInstruction* inst) { - auto contReg = m_regs[inst->getSrc(0)].getReg(); + auto contReg = m_regs[inst->src(0)].getReg(); const Offset doneOffset = CONTOFF(m_done); static_assert((doneOffset + 1) == CONTOFF(m_running), @@ -5045,7 +5045,7 @@ void CodeGenerator::cgContPreNext(IRInstruction* inst) { void CodeGenerator::cgContStartedCheck(IRInstruction* inst) { m_as.cmp_imm64_disp_reg64(0, CONTOFF(m_index), - m_regs[inst->getSrc(0)].getReg()); + m_regs[inst->src(0)].getReg()); emitFwdJcc(CC_L, inst->getTaken()); } @@ -5058,15 +5058,15 @@ void CodeGenerator::cgIterNext(IRInstruction* inst) { } void CodeGenerator::cgIterNextCommon(IRInstruction* inst, bool isNextK) { - PhysReg fpReg = m_regs[inst->getSrc(0)].getReg(); + PhysReg fpReg = m_regs[inst->src(0)].getReg(); ArgGroup args(m_regs); - args.addr(fpReg, getIterOffset(inst->getSrc(1))) - .addr(fpReg, getLocalOffset(inst->getSrc(2))); + args.addr(fpReg, getIterOffset(inst->src(1))) + .addr(fpReg, getLocalOffset(inst->src(2))); if (isNextK) { - args.addr(fpReg, getLocalOffset(inst->getSrc(3))); + args.addr(fpReg, getLocalOffset(inst->src(3))); } TCA helperAddr = isNextK ? (TCA)iter_next_key : (TCA)iter_next; - cgCallHelper(m_as, helperAddr, inst->getDst(), kSyncPoint, args); + cgCallHelper(m_as, helperAddr, inst->dst(), kSyncPoint, args); } void CodeGenerator::cgIterInit(IRInstruction* inst) { @@ -5078,8 +5078,8 @@ void iterFreeHelper(Iter* iter) { } void CodeGenerator::cgIterFree(IRInstruction* inst) { - PhysReg fpReg = m_regs[inst->getSrc(0)].getReg(); - int64_t offset = getIterOffset(inst->getSrc(1)); + PhysReg fpReg = m_regs[inst->src(0)].getReg(); + int64_t offset = getIterOffset(inst->src(1)); cgCallHelper(m_as, (TCA)iterFreeHelper, InvalidReg, kSyncPoint, ArgGroup(m_regs).addr(fpReg, offset)); } @@ -5089,24 +5089,24 @@ void CodeGenerator::cgIterInitK(IRInstruction* inst) { } void CodeGenerator::cgIterInitCommon(IRInstruction* inst, bool isInitK) { - PhysReg fpReg = m_regs[inst->getSrc(1)].getReg(); - int64_t iterOffset = getIterOffset(inst->getSrc(2)); - int64_t valLocalOffset = getLocalOffset(inst->getSrc(3)); - SSATmp* src = inst->getSrc(0); + PhysReg fpReg = m_regs[inst->src(1)].getReg(); + int64_t iterOffset = getIterOffset(inst->src(2)); + int64_t valLocalOffset = getLocalOffset(inst->src(3)); + SSATmp* src = inst->src(0); ArgGroup args(m_regs); args.addr(fpReg, iterOffset).ssa(src); if (src->isArray()) { args.addr(fpReg, valLocalOffset); if (isInitK) { - args.addr(fpReg, getLocalOffset(inst->getSrc(4))); + args.addr(fpReg, getLocalOffset(inst->src(4))); } TCA helperAddr = isInitK ? (TCA)new_iter_array_key : (TCA)new_iter_array; - cgCallHelper(m_as, helperAddr, inst->getDst(), kSyncPoint, args); + cgCallHelper(m_as, helperAddr, inst->dst(), kSyncPoint, args); } else { assert(src->type() == Type::Obj); args.imm(uintptr_t(getCurClass())).addr(fpReg, valLocalOffset); if (isInitK) { - args.addr(fpReg, getLocalOffset(inst->getSrc(4))); + args.addr(fpReg, getLocalOffset(inst->src(4))); } else { args.imm(0); } @@ -5114,17 +5114,17 @@ void CodeGenerator::cgIterInitCommon(IRInstruction* inst, bool isInitK) { // exception out, so we use kSyncPointAdjustOne, which adjusts the // stack pointer by 1 stack element on an unwind, skipping over // the src object. - cgCallHelper(m_as, (TCA)new_iter_object, inst->getDst(), + cgCallHelper(m_as, (TCA)new_iter_object, inst->dst(), kSyncPointAdjustOne, args); } } void CodeGenerator::cgIncStat(IRInstruction *inst) { Stats::emitInc(m_as, - Stats::StatCounter(inst->getSrc(0)->getValInt()), - inst->getSrc(1)->getValInt(), + Stats::StatCounter(inst->src(0)->getValInt()), + inst->src(1)->getValInt(), Transl::CC_None, - inst->getSrc(2)->getValBool()); + inst->src(2)->getValBool()); } void CodeGenerator::cgIncTransCounter(IRInstruction* inst) { @@ -5132,7 +5132,7 @@ void CodeGenerator::cgIncTransCounter(IRInstruction* inst) { } void CodeGenerator::cgDbgAssertRefCount(IRInstruction* inst) { - emitAssertRefCount(m_as, m_regs[inst->getSrc(0)].getReg()); + emitAssertRefCount(m_as, m_regs[inst->src(0)].getReg()); } void traceCallback(ActRec* fp, Cell* sp, int64_t pcOff, void* rip) { @@ -5144,18 +5144,18 @@ void traceCallback(ActRec* fp, Cell* sp, int64_t pcOff, void* rip) { void CodeGenerator::cgDbgAssertType(IRInstruction* inst) { emitTypeTest(inst->getTypeParam(), - m_regs[inst->getSrc(0)].getReg(1), - m_regs[inst->getSrc(0)].getReg(0), + m_regs[inst->src(0)].getReg(1), + m_regs[inst->src(0)].getReg(0), [&](ConditionCode cc) { ifThen(m_as, ccNegate(cc), [&] { m_as.ud2(); }); }); } void CodeGenerator::cgVerifyParamCls(IRInstruction* inst) { - SSATmp* objClass = inst->getSrc(0); + SSATmp* objClass = inst->src(0); assert(!objClass->isConst()); auto objClassReg = m_regs[objClass].getReg(); - SSATmp* constraint = inst->getSrc(1); + SSATmp* constraint = inst->src(1); if (constraint->isConst()) { m_as. cmpq(constraint->getValClass(), objClassReg); @@ -5201,7 +5201,7 @@ static void patchJumps(Asm& as, CodegenState& state, Block* block) { } void CodeGenerator::cgBlock(Block* block, vector* bcMap) { - FTRACE(6, "cgBlock: {}\n", block->getId()); + FTRACE(6, "cgBlock: {}\n", block->id()); for (IRInstruction& instr : *block) { IRInstruction* inst = &instr; @@ -5239,11 +5239,11 @@ LiveRegs computeLiveRegs(const IRFactory* factory, const RegAllocInfo& regs, if (Block* next = block->getNext()) live |= liveMap[next]; for (auto it = block->end(); it != block->begin(); ) { IRInstruction& inst = *--it; - for (const SSATmp& dst : inst.getDsts()) { + for (const SSATmp& dst : inst.dsts()) { live -= regs[dst].getRegs(); } live_regs[inst] = live; - for (SSATmp* src : inst.getSrcs()) { + for (SSATmp* src : inst.srcs()) { live |= regs[src].getRegs(); } } @@ -5279,7 +5279,7 @@ void genCodeForTrace(Trace* trace, auto emitBlock = [&](Asm& a, Block* block, Block* nextBlock) { assert(!isEmitted(block)); - FTRACE(6, "cgBlock {} on {}\n", block->getId(), + FTRACE(6, "cgBlock {} on {}\n", block->id(), &a == &astubs ? "astubs" : "a"); auto const aStart = a.code.frontier; diff --git a/hphp/runtime/vm/translator/hopt/codegen.h b/hphp/runtime/vm/translator/hopt/codegen.h index 4857090ac..3a96dbeab 100644 --- a/hphp/runtime/vm/translator/hopt/codegen.h +++ b/hphp/runtime/vm/translator/hopt/codegen.h @@ -391,8 +391,8 @@ public: None, // Nothing: register will contain garbage }; - PhysReg getDstReg() const { return m_dstReg; } - PhysReg getSrcReg() const { return m_srcReg; } + PhysReg dstReg() const { return m_dstReg; } + PhysReg srcReg() const { return m_srcReg; } Kind getKind() const { return m_kind; } void setDstReg(PhysReg reg) { m_dstReg = reg; } Immed getImm() const { return m_imm; } @@ -484,7 +484,7 @@ struct ArgGroup { } ArgGroup& ssas(IRInstruction* inst, unsigned begin, unsigned count = 1) { - for (SSATmp* s : inst->getSrcs().subpiece(begin, count)) { + for (SSATmp* s : inst->srcs().subpiece(begin, count)) { push_arg(ArgDesc(s, m_regs[s])); } return *this; diff --git a/hphp/runtime/vm/translator/hopt/dce.cpp b/hphp/runtime/vm/translator/hopt/dce.cpp index c6a490c43..b0a7c11a2 100644 --- a/hphp/runtime/vm/translator/hopt/dce.cpp +++ b/hphp/runtime/vm/translator/hopt/dce.cpp @@ -109,7 +109,7 @@ private: }; static_assert(sizeof(DceFlags) == 1, "sizeof(DceFlags) should be 1 byte"); -// DCE state indexed by instr->getId(). +// DCE state indexed by instr->id(). typedef StateVector DceState; typedef hphp_hash_set> SSASet; typedef StateVector SSACache; @@ -130,15 +130,15 @@ void removeDeadInstructions(Trace* trace, const DceState& state) { } bool isUnguardedLoad(IRInstruction* inst) { - if (!inst->hasDst() || !inst->getDst()) return false; + if (!inst->hasDst() || !inst->dst()) return false; Opcode opc = inst->op(); - SSATmp* dst = inst->getDst(); + SSATmp* dst = inst->dst(); Type type = dst->type(); return ((opc == LdStack && (type == Type::Gen || type == Type::Cell)) || (opc == LdLoc && type == Type::Gen) || (opc == LdRef && type == Type::Cell) || (opc == LdMem && type == Type::Cell && - inst->getSrc(0)->type() == Type::PtrToCell) || + inst->src(0)->type() == Type::PtrToCell) || (opc == Unbox && type == Type::Cell)); } @@ -186,7 +186,7 @@ BlockList removeUnreachable(Trace* trace, IRFactory* factory) { ++bit; continue; } - FTRACE(5, "erasing block {}\n", (*bit)->getId()); + FTRACE(5, "erasing block {}\n", (*bit)->id()); if ((*bit)->getTaken() && (*bit)->back()->op() == Jmp_) { needsReflow = true; } @@ -219,7 +219,7 @@ initInstructions(const BlockList& blocks, DceState& state) { wl.push_back(&inst); } if (inst.op() == DecRefNZ) { - auto* srcInst = inst.getSrc(0)->inst(); + auto* srcInst = inst.src(0)->inst(); Opcode srcOpc = srcInst->op(); if (srcOpc != DefConst) { assert(srcInst->op() == IncRef); @@ -257,7 +257,7 @@ void optimizeRefCount(Trace* trace, DceState& state, UseCounts& uses) { s.setDead(); } if (inst->op() == DecRefNZ) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); IRInstruction* srcInst = src->inst(); if (state[srcInst].countConsumedAny()) { state[inst].setLive(); @@ -265,7 +265,7 @@ void optimizeRefCount(Trace* trace, DceState& state, UseCounts& uses) { } } if (inst->op() == DecRef) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (uses[src] == 1 && !src->type().canRunDtor()) { IRInstruction* srcInst = src->inst(); if (srcInst->op() == IncRef) { @@ -279,7 +279,7 @@ void optimizeRefCount(Trace* trace, DceState& state, UseCounts& uses) { }); for (const IRInstruction* decref : decrefs) { assert(decref->op() == DecRef); - SSATmp* src = decref->getSrc(0); + SSATmp* src = decref->src(0); assert(src->inst()->op() == IncRef); assert(!src->type().canRunDtor()); if (uses[src] == 1) { @@ -325,19 +325,19 @@ void sinkIncRefs(Trace* trace, IRFactory* irFactory, DceState& state) { for (auto* inst : boost::adaptors::reverse(toSink)) { // prepend inserts an instruction to the beginning of a block, after // the label. Therefore, we iterate through toSink in the reversed order. - IRInstruction* sunkInst = irFactory->gen(IncRef, inst->getSrc(0)); + IRInstruction* sunkInst = irFactory->gen(IncRef, inst->src(0)); state[sunkInst].setLive(); exit->front()->prepend(sunkInst); - auto dstId = inst->getDst()->getId(); + auto dstId = inst->dst()->id(); assert(!sunkTmps[dstId]); - sunkTmps[dstId] = sunkInst->getDst(); + sunkTmps[dstId] = sunkInst->dst(); } forEachInst(exit, [&](IRInstruction* inst) { // Replace the original tmps with the sunk tmps. - for (uint32_t i = 0; i < inst->getNumSrcs(); ++i) { - SSATmp* src = inst->getSrc(i); - if (SSATmp* sunkTmp = sunkTmps[src->getId()]) { + for (uint32_t i = 0; i < inst->numSrcs(); ++i) { + SSATmp* src = inst->src(i); + if (SSATmp* sunkTmp = sunkTmps[src->id()]) { inst->setSrc(i, sunkTmp); } } @@ -366,7 +366,7 @@ void sinkIncRefs(Trace* trace, IRFactory* irFactory, DceState& state) { } } if (inst->op() == DecRefNZ) { - IRInstruction* srcInst = inst->getSrc(0)->inst(); + IRInstruction* srcInst = inst->src(0)->inst(); if (state[srcInst].isDead()) { state[inst].setDead(); // This may take O(I) time where I is the number of IncRefs @@ -375,8 +375,8 @@ void sinkIncRefs(Trace* trace, IRFactory* irFactory, DceState& state) { } } if (Block* target = inst->getTaken()) { - if (!pushedTo[target->getId()]) { - pushedTo[target->getId()] = 1; + if (!pushedTo[target->id()]) { + pushedTo[target->id()] = 1; Trace* exit = target->getTrace(); if (exit != trace) processExit(exit); } @@ -404,14 +404,14 @@ void optimizeActRecs(Trace* trace, DceState& state, IRFactory* factory, switch (inst->op()) { case CreateCont: { - auto const frameInst = inst->getSrc(1)->inst(); + auto const frameInst = inst->src(1)->inst(); if (frameInst->op() == DefInlineFP) { - auto const spInst = frameInst->getSrc(0)->inst(); + auto const spInst = frameInst->src(0)->inst(); if (spInst->op() == SpillFrame && - spInst->getSrc(3)->type().subtypeOfAny(Type::Obj, Type::Null)) { + spInst->src(3)->type().subtypeOfAny(Type::Obj, Type::Null)) { FTRACE(5, "CreateCont ({}): weak use of frame {}\n", - inst->getId(), - frameInst->getId()); + inst->id(), + frameInst->id()); state[frameInst].incWeakUse(); } } @@ -422,7 +422,7 @@ void optimizeActRecs(Trace* trace, DceState& state, IRFactory* factory, // eliminated. case StLoc: { - auto const frameInst = inst->getSrc(0)->inst(); + auto const frameInst = inst->src(0)->inst(); if (frameInst->op() == DefInlineFP) { state[frameInst].incWeakUse(); } @@ -431,14 +431,14 @@ void optimizeActRecs(Trace* trace, DceState& state, IRFactory* factory, case InlineReturn: { - auto frameUses = uses[inst->getSrc(0)]; - auto srcInst = inst->getSrc(0)->inst(); + auto frameUses = uses[inst->src(0)]; + auto srcInst = inst->src(0)->inst(); if (srcInst->op() == DefInlineFP) { auto weakUses = state[srcInst].weakUseCount(); // We haven't counted this InlineReturn as a weak use yet, // which is where this '1' comes from. if (frameUses - weakUses == 1) { - FTRACE(5, "killing frame {}\n", srcInst->getId()); + FTRACE(5, "killing frame {}\n", srcInst->id()); killedFrames = true; state[srcInst].setDead(); } @@ -463,16 +463,16 @@ void optimizeActRecs(Trace* trace, DceState& state, IRFactory* factory, switch (inst->op()) { case CreateCont: { - auto const fp = inst->getSrc(1); + auto const fp = inst->src(1); if (state[fp->inst()].isDead()) { - FTRACE(5, "CreateCont ({}) -> InlineCreateCont\n", inst->getId()); + FTRACE(5, "CreateCont ({}) -> InlineCreateCont\n", inst->id()); CreateContData data; - data.origFunc = inst->getSrc(3)->getValFunc(); - data.genFunc = inst->getSrc(4)->getValFunc(); + data.origFunc = inst->src(3)->getValFunc(); + data.genFunc = inst->src(4)->getValFunc(); - assert(fp->inst()->getSrc(0)->inst()->op() == SpillFrame); - auto const thisPtr = fp->inst()->getSrc(0)->inst()->getSrc(3); + assert(fp->inst()->src(0)->inst()->op() == SpillFrame); + auto const thisPtr = fp->inst()->src(0)->inst()->src(3); factory->replace( inst, InlineCreateCont, @@ -485,11 +485,11 @@ void optimizeActRecs(Trace* trace, DceState& state, IRFactory* factory, case StLoc: case InlineReturn: { - auto const fp = inst->getSrc(0); + auto const fp = inst->src(0); if (state[fp->inst()].isDead()) { FTRACE(5, "{} ({}) setDead\n", opcodeName(inst->op()), - inst->getId()); + inst->id()); state[inst].setDead(); } } @@ -497,9 +497,9 @@ void optimizeActRecs(Trace* trace, DceState& state, IRFactory* factory, case DefInlineFP: FTRACE(5, "DefInlineFP ({}): weak/strong uses: {}/{}\n", - inst->getId(), + inst->id(), state[inst].weakUseCount(), - uses[inst->getDst()]); + uses[inst->dst()]); break; default: @@ -530,13 +530,13 @@ void consumeIncRef(const IRInstruction* consumer, const SSATmp* src, // srcInst is a CheckType that guards to a refcounted type. We need to // trace through to its source. If the CheckType guards to a non-refcounted // type then the reference is consumed by CheckType itself. - consumeIncRef(consumer, srcInst->getSrc(0), state, ssas, visitedSrcs); + consumeIncRef(consumer, srcInst->src(0), state, ssas, visitedSrcs); } else if (srcInst->op() == DefLabel) { // srcInst is a DefLabel that may be a join node. We need to find // the dst index of src in srcInst and trace through to each jump // providing a value for it. - for (unsigned i = 0, n = srcInst->getNumDsts(); i < n; ++i) { - if (srcInst->getDst(i) == src) { + for (unsigned i = 0, n = srcInst->numDsts(); i < n; ++i) { + if (srcInst->dst(i) == src) { srcInst->getBlock()->forEachSrc(i, [&](IRInstruction* jmp, SSATmp* val) { consumeIncRef(consumer, val, state, ssas, visitedSrcs); @@ -584,8 +584,8 @@ void removeDeadInstructions(Trace* trace, const boost::dynamic_bitset<>& live) { auto cur = it; ++it; Block* block = *cur; block->remove_if([&] (const IRInstruction& inst) { - assert(inst.getId() < live.size()); - return !live.test(inst.getId()); + assert(inst.id() < live.size()); + return !live.test(inst.id()); }); if (block->empty()) blocks.erase(cur); } @@ -614,8 +614,8 @@ void eliminateDeadCode(Trace* trace, IRFactory* irFactory) { while (!wl.empty()) { auto* inst = wl.front(); wl.pop_front(); - for (uint32_t i = 0; i < inst->getNumSrcs(); i++) { - SSATmp* src = inst->getSrc(i); + for (uint32_t i = 0; i < inst->numSrcs(); i++) { + SSATmp* src = inst->src(i); IRInstruction* srcInst = src->inst(); if (srcInst->op() == DefConst) { continue; diff --git a/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp b/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp index 2f5841f32..7a88e79f9 100644 --- a/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/hhbctranslator.cpp @@ -95,7 +95,7 @@ void HhbcTranslator::refineType(SSATmp* tmp, Type type) { // If tmp is incref or move, then chase down its src Opcode opc = inst->op(); if (opc == Mov || opc == IncRef) { - refineType(inst->getSrc(0), type); + refineType(inst->src(0), type); tmp->setType(outputType(inst)); } else if (tmp->type().isNull() && type.isNull()) { // Refining Null to Uninit or InitNull is supported @@ -2067,7 +2067,7 @@ SSATmp* HhbcTranslator::emitDecRefLocalsInline(SSATmp* retVal) { * IncRef/DecRef pair in the main trace. */ if (retValSrcInstr->op() == IncRef) { - retValSrcLoc = retValSrcInstr->getSrc(0); + retValSrcLoc = retValSrcInstr->src(0); retValSrcOpc = retValSrcLoc->inst()->op(); if (retValSrcOpc != LdLoc && retValSrcOpc != LdThis) { retValSrcLoc = nullptr; diff --git a/hphp/runtime/vm/translator/hopt/ir.cpp b/hphp/runtime/vm/translator/hopt/ir.cpp index f65be7211..30acd6d21 100644 --- a/hphp/runtime/vm/translator/hopt/ir.cpp +++ b/hphp/runtime/vm/translator/hopt/ir.cpp @@ -378,7 +378,7 @@ bool IRInstruction::consumesReference(int srcNo) const { // to a notCounted type. if (m_op == CheckType) { assert(srcNo == 0); - return getSrc(0)->type().maybeCounted() && getTypeParam().notCounted(); + return src(0)->type().maybeCounted() && getTypeParam().notCounted(); } // SpillStack consumes inputs 2 and onward if (m_op == SpillStack) return srcNo >= 2; @@ -407,7 +407,7 @@ bool IRInstruction::mayModifyRefs() const { // DecRefNZ does not have side effects other than decrementing the ref // count. Therefore, its MayModifyRefs should be false. if (opc == DecRef) { - auto type = getSrc(0)->type(); + auto type = src(0)->type(); if (isControlFlowInstruction()) { // If the decref has a target label, then it exits if the destructor // has to be called, so it does not have any side effects on the main @@ -433,7 +433,7 @@ bool IRInstruction::isEssential() const { // If the ref count optimization is turned off, mark all DecRefNZ as // essential. if (!RuntimeOption::EvalHHIREnableRefCountOpt || - getSrc(0)->inst()->op() != IncRef) { + src(0)->inst()->op() != IncRef) { return true; } } @@ -517,13 +517,13 @@ bool IRInstruction::stores(uint32_t srcIdx) const { return srcIdx == 4; case SpillStack: - return srcIdx >= 2 && srcIdx < getNumSrcs(); + return srcIdx >= 2 && srcIdx < numSrcs(); case Call: - return srcIdx >= 3 && srcIdx < getNumSrcs(); + return srcIdx >= 3 && srcIdx < numSrcs(); case CallBuiltin: - return srcIdx >= 1 && srcIdx < getNumSrcs(); + return srcIdx >= 1 && srcIdx < numSrcs(); default: return false; @@ -533,7 +533,7 @@ bool IRInstruction::stores(uint32_t srcIdx) const { SSATmp* IRInstruction::getPassthroughValue() const { assert(isPassthrough()); assert(m_op == IncRef || m_op == CheckType || m_op == Mov); - return getSrc(0); + return src(0); } bool IRInstruction::killsSources() const { @@ -573,7 +573,7 @@ bool IRInstruction::modifiesStack() const { SSATmp* IRInstruction::modifiedStkPtr() const { assert(modifiesStack()); assert(VectorEffects::supported(this)); - SSATmp* sp = getDst(hasMainDst() ? 1 : 0); + SSATmp* sp = dst(hasMainDst() ? 1 : 0); assert(sp->isA(Type::StkPtr)); return sp; } @@ -585,26 +585,26 @@ bool IRInstruction::hasMainDst() const { bool IRInstruction::mayReenterHelper() const { if (isCmpOp(op())) { return cmpOpTypesMayReenter(op(), - getSrc(0)->type(), - getSrc(1)->type()); + src(0)->type(), + src(1)->type()); } // Not necessarily actually false; this is just a helper for other // bits. return false; } -SSATmp* IRInstruction::getDst(unsigned i) const { +SSATmp* IRInstruction::dst(unsigned i) const { if (i == 0 && m_numDsts == 0) return nullptr; assert(i < m_numDsts); assert(naryDst() || i == 0); - return hasDst() ? getDst() : &m_dst[i]; + return hasDst() ? dst() : &m_dst[i]; } -DstRange IRInstruction::getDsts() { +DstRange IRInstruction::dsts() { return Range(m_dst, m_numDsts); } -Range IRInstruction::getDsts() const { +Range IRInstruction::dsts() const { return Range(m_dst, m_numDsts); } @@ -617,7 +617,7 @@ const StringData* findClassName(SSATmp* cls) { // Try to get the class name from a LdCls IRInstruction* clsInst = cls->inst(); if (clsInst->op() == LdCls || clsInst->op() == LdClsCached) { - SSATmp* clsName = clsInst->getSrc(0); + SSATmp* clsName = clsInst->src(0); assert(clsName->isA(Type::Str)); if (clsName->isConst()) { return clsName->getValStr(); @@ -848,13 +848,13 @@ IRInstruction* IRInstruction::clone(IRFactory* factory) const { return factory->cloneInstruction(this); } -SSATmp* IRInstruction::getSrc(uint32_t i) const { - if (i >= getNumSrcs()) return nullptr; +SSATmp* IRInstruction::src(uint32_t i) const { + if (i >= numSrcs()) return nullptr; return m_srcs[i]; } void IRInstruction::setSrc(uint32_t i, SSATmp* newSrc) { - assert(i < getNumSrcs()); + assert(i < numSrcs()); m_srcs[i] = newSrc; } @@ -878,8 +878,8 @@ bool IRInstruction::cseEquals(IRInstruction* inst) const { m_numSrcs != inst->m_numSrcs) { return false; } - for (uint32_t i = 0; i < getNumSrcs(); i++) { - if (getSrc(i) != inst->getSrc(i)) { + for (uint32_t i = 0; i < numSrcs(); i++) { + if (src(i) != inst->src(i)) { return false; } } @@ -900,8 +900,8 @@ size_t IRInstruction::cseHash() const { assert(canCSE()); size_t srcHash = 0; - for (unsigned i = 0; i < getNumSrcs(); ++i) { - srcHash = CSEHash::hashCombine(srcHash, getSrc(i)); + for (unsigned i = 0; i < numSrcs(); ++i) { + srcHash = CSEHash::hashCombine(srcHash, src(i)); } if (hasExtra()) { srcHash = CSEHash::hashCombine(srcHash, @@ -1050,7 +1050,7 @@ std::string Trace::toString() const { int32_t spillValueCells(IRInstruction* spillStack) { assert(spillStack->op() == SpillStack); - int32_t numSrcs = spillStack->getNumSrcs(); + int32_t numSrcs = spillStack->numSrcs(); return numSrcs - 2; } @@ -1059,7 +1059,7 @@ bool isConvIntOrPtrToBool(IRInstruction* instr) { case ConvIntToBool: return true; case ConvCellToBool: - return instr->getSrc(0)->type().subtypeOfAny( + return instr->src(0)->type().subtypeOfAny( Type::Func, Type::Cls, Type::FuncCls, Type::VarEnv, Type::TCA); default: return false; diff --git a/hphp/runtime/vm/translator/hopt/irfactory.cpp b/hphp/runtime/vm/translator/hopt/irfactory.cpp index 38ee14dfe..79bfbb04e 100644 --- a/hphp/runtime/vm/translator/hopt/irfactory.cpp +++ b/hphp/runtime/vm/translator/hopt/irfactory.cpp @@ -56,7 +56,7 @@ SSATmp* IRFactory::findConst(ConstData& cdata, Type ctype) { assert(tmp->type().equals(ctype)); return tmp; } - return m_constTable.insert(cloneInstruction(&inst)->getDst()); + return m_constTable.insert(cloneInstruction(&inst)->dst()); } }} diff --git a/hphp/runtime/vm/translator/hopt/irinstruction.h b/hphp/runtime/vm/translator/hopt/irinstruction.h index a923a6b37..a2f2cfca1 100644 --- a/hphp/runtime/vm/translator/hopt/irinstruction.h +++ b/hphp/runtime/vm/translator/hopt/irinstruction.h @@ -174,18 +174,18 @@ struct IRInstruction { void setOpcode(Opcode newOpc) { m_op = newOpc; } Type getTypeParam() const { return m_typeParam; } void setTypeParam(Type t) { m_typeParam = t; } - uint32_t getNumSrcs() const { return m_numSrcs; } + uint32_t numSrcs() const { return m_numSrcs; } void setNumSrcs(uint32_t i) { assert(i <= m_numSrcs); m_numSrcs = i; } - SSATmp* getSrc(uint32_t i) const; + SSATmp* src(uint32_t i) const; void setSrc(uint32_t i, SSATmp* newSrc); - SrcRange getSrcs() const { + SrcRange srcs() const { return SrcRange(m_srcs, m_numSrcs); } - unsigned getNumDsts() const { return m_numDsts; } - SSATmp* getDst() const { + unsigned numDsts() const { return m_numDsts; } + SSATmp* dst() const { assert(!naryDst()); return m_dst; } @@ -197,12 +197,12 @@ struct IRInstruction { /* * Returns the ith dest of this instruction. i == 0 is treated specially: if - * the instruction has no dests, getDst(0) will return nullptr, and if the - * instruction is not naryDest, getDst(0) will return the single dest. + * the instruction has no dests, dst(0) will return nullptr, and if the + * instruction is not naryDest, dst(0) will return the single dest. */ - SSATmp* getDst(unsigned i) const; - DstRange getDsts(); - Range getDsts() const; + SSATmp* dst(unsigned i) const; + DstRange dsts(); + Range dsts() const; void setDsts(unsigned numDsts, SSATmp* newDsts) { assert(naryDst()); m_numDsts = numDsts; @@ -212,7 +212,7 @@ struct IRInstruction { /* * Instruction id is stable and useful as an array index. */ - uint32_t getId() const { + uint32_t id() const { assert(m_id != kTransient); return m_id; } diff --git a/hphp/runtime/vm/translator/hopt/jumpopts.cpp b/hphp/runtime/vm/translator/hopt/jumpopts.cpp index 0414630f6..16a8de78d 100644 --- a/hphp/runtime/vm/translator/hopt/jumpopts.cpp +++ b/hphp/runtime/vm/translator/hopt/jumpopts.cpp @@ -38,12 +38,12 @@ void elimUnconditionalJump(Trace* trace, IRFactory* irFactory) { boost::dynamic_bitset<> havePred(irFactory->numBlocks()); for (Block* block : trace->getBlocks()) { if (block->getTaken()) { - auto id = block->getTaken()->getId(); + auto id = block->getTaken()->id(); isJoin[id] = havePred[id]; havePred[id] = 1; } if (block->getNext()) { - auto id = block->getNext()->getId(); + auto id = block->getNext()->id(); isJoin[id] = havePred[id]; havePred[id] = 1; } @@ -51,7 +51,7 @@ void elimUnconditionalJump(Trace* trace, IRFactory* irFactory) { Block* lastBlock = trace->back(); auto lastInst = lastBlock->backIter(); // iterator to last instruction IRInstruction& jmp = *lastInst; - if (jmp.op() == Jmp_ && !isJoin[jmp.getTaken()->getId()]) { + if (jmp.op() == Jmp_ && !isJoin[jmp.getTaken()->id()]) { Block* target = jmp.getTaken(); lastBlock->splice(lastInst, target, target->skipLabel(), target->end()); lastBlock->erase(lastInst); // delete the jmp @@ -161,12 +161,12 @@ void optimizeCondTraceExit(Trace* trace, IRFactory* irFactory) { data.taken = jccExitTrace->back()->getExtra()->offset; data.notTaken = mainExit->back()->getExtra()->offset; - FTRACE(5, "replacing {} with {}\n", jccInst->getId(), opcodeName(newOpcode)); + FTRACE(5, "replacing {} with {}\n", jccInst->id(), opcodeName(newOpcode)); irFactory->replace( mainExit->back(), newOpcode, data, - std::make_pair(jccInst->getNumSrcs(), jccInst->getSrcs().begin()) + std::make_pair(jccInst->numSrcs(), jccInst->srcs().begin()) ); jccInst->convertToNop(); @@ -190,11 +190,11 @@ void optimizeSideExits(Trace* trace, IRFactory* irFactory) { assert(syncABI->op() == SyncABIRegs); FTRACE(5, "converting jump ({}) to side exit\n", - inst->getId()); + inst->id()); auto const isStack = inst->op() == CheckStk; - auto const fp = syncABI->getSrc(0); - auto const sp = syncABI->getSrc(1); + auto const fp = syncABI->src(0); + auto const sp = syncABI->src(1); SideExitGuardData data; data.checkedSlot = isStack diff --git a/hphp/runtime/vm/translator/hopt/layout.cpp b/hphp/runtime/vm/translator/hopt/layout.cpp index 0c8e61663..3919cbfa6 100644 --- a/hphp/runtime/vm/translator/hopt/layout.cpp +++ b/hphp/runtime/vm/translator/hopt/layout.cpp @@ -83,7 +83,7 @@ LayoutInfo layoutBlocks(Trace* trace, const IRFactory& irFactory) { smart::vector::iterator stop) { folly::toAppend(what, &str); for (; it != stop; ++it) { - folly::toAppend((*it)->getId(), &str); + folly::toAppend((*it)->id(), &str); folly::toAppend(" ", &str); } }; diff --git a/hphp/runtime/vm/translator/hopt/linearscan.cpp b/hphp/runtime/vm/translator/hopt/linearscan.cpp index df843e14e..b1705309b 100644 --- a/hphp/runtime/vm/translator/hopt/linearscan.cpp +++ b/hphp/runtime/vm/translator/hopt/linearscan.cpp @@ -237,7 +237,7 @@ static SSATmp* canonicalize(SSATmp* tmp) { if (opc != IncRef && opc != Mov && opc != StRef && opc != StRefNT) { return tmp; } - tmp = inst->getSrc(0); + tmp = inst->src(0); } } @@ -323,7 +323,7 @@ PhysReg::Type LinearScan::getRegType(const SSATmp* tmp, int locIdx) const { Type tmpType = tmp->type(); - uint32_t tmpId = tmp->getId(); + uint32_t tmpId = tmp->id(); if (tmp->inst()->op() == Reload) { // We don't have an entry for reloaded SSATmps in @@ -334,8 +334,8 @@ PhysReg::Type LinearScan::getRegType(const SSATmp* tmp, int locIdx) const { // to a full XMM register, then so is the reloaded SSATmp. This // might be a bit conservative, but avoids recomputing the analysis. auto* reload = tmp->inst(); - auto* spill = reload->getSrc(0)->inst(); - tmpId = spill->getSrc(0)->getId(); + auto* spill = reload->src(0)->inst(); + tmpId = spill->src(0)->id(); } if (tmpType.equals(Type::Uncounted) || tmpType.equals(Type::UncountedInit)) { @@ -371,9 +371,9 @@ void LinearScan::allocRegToInstruction(InstructionList::iterator it) { for (int regNo = 0; regNo < kNumRegs; ++regNo) { m_regs[regNo].m_pinned = false; } - smart::vector needsReloading(inst->getNumSrcs(), true); - for (uint32_t i = 0; i < inst->getNumSrcs(); ++i) { - SSATmp* tmp = inst->getSrc(i); + smart::vector needsReloading(inst->numSrcs(), true); + for (uint32_t i = 0; i < inst->numSrcs(); ++i) { + SSATmp* tmp = inst->src(i); int32_t slotId = m_spillSlots[tmp]; if (slotId == -1) { needsReloading[i] = false; @@ -387,9 +387,9 @@ void LinearScan::allocRegToInstruction(InstructionList::iterator it) { } } } - for (uint32_t i = 0; i < inst->getNumSrcs(); ++i) { + for (uint32_t i = 0; i < inst->numSrcs(); ++i) { if (needsReloading[i]) { - SSATmp* tmp = inst->getSrc(i); + SSATmp* tmp = inst->src(i); int32_t slotId = m_spillSlots[tmp]; // is spilled, and not reloaded. // Therefore, We need to reload the value into a new SSATmp. @@ -402,7 +402,7 @@ void LinearScan::allocRegToInstruction(InstructionList::iterator it) { // Create which inherits 's slot ID and // 's last use ID. // Replace with in . - SSATmp* reloadTmp = reload->getDst(); + SSATmp* reloadTmp = reload->dst(); m_uses[reloadTmp].lastUse = m_uses[spillTmp].lastUse; m_spillSlots[reloadTmp] = slotId; inst->setSrc(i, reloadTmp); @@ -426,7 +426,7 @@ void LinearScan::allocRegToInstruction(InstructionList::iterator it) { computePreColoringHint(); } - Range dsts = inst->getDsts(); + Range dsts = inst->dsts(); if (dsts.empty()) return; Opcode opc = inst->op(); @@ -442,7 +442,7 @@ void LinearScan::allocRegToInstruction(InstructionList::iterator it) { // pointer to an AR that is not in rVmFp. const bool abnormalFramePtr = (opc == LdRaw && - inst->getSrc(1)->getValInt() == RawMemSlot::ContARPtr); + inst->src(1)->getValInt() == RawMemSlot::ContARPtr); // Note that the point of StashGeneratorSP is to save a StkPtr // somewhere other than rVmSp. (TODO(#2288359): make rbx not @@ -510,7 +510,7 @@ bool LinearScan::crossNativeCall(const SSATmp* tmp) const { int LinearScan::allocRegToTmp(SSATmp* ssaTmp, uint32_t index) { bool preferCallerSaved = true; PhysReg::Type regType = getRegType(ssaTmp, index); - FTRACE(6, "getRegType(SSATmp {}, {}) = {}\n", ssaTmp->getId(), + FTRACE(6, "getRegType(SSATmp {}, {}) = {}\n", ssaTmp->id(), index, int(regType)); assert(regType == PhysReg::GP || index == 0); // no type-only in XMM regs @@ -666,8 +666,8 @@ uint32_t LinearScan::assignSpillLoc() { m_natives.pop_front(); } if (inst.op() == Spill) { - SSATmp* dst = inst.getDst(); - SSATmp* src = inst.getSrc(0); + SSATmp* dst = inst.dst(); + SSATmp* src = inst.src(0); for (int locIndex = 0; locIndex < src->numNeededRegs(); ++locIndex) { @@ -696,7 +696,7 @@ uint32_t LinearScan::assignSpillLoc() { } } if (inst.op() == Reload) { - SSATmp* src = inst.getSrc(0); + SSATmp* src = inst.src(0); for (int locIndex = 0; locIndex < src->numNeededRegs(); ++locIndex) { @@ -729,7 +729,7 @@ void LinearScan::collectInfo(BlockList::iterator it, Trace* trace) { if (!trace->isMain()) return; int lastId = block->getTrace()->getData(); for (IRInstruction& inst : *block) { - for (auto* src : inst.getSrcs()) { + for (auto* src : inst.srcs()) { if (lastId > m_uses[src].lastUse) { m_uses[src].lastUse = lastId; } @@ -737,15 +737,15 @@ void LinearScan::collectInfo(BlockList::iterator it, Trace* trace) { } } else { for (IRInstruction& inst : *block) { - for (auto* src : inst.getSrcs()) { + for (auto* src : inst.srcs()) { m_uses[src].lastUse = m_linear[inst]; } if (inst.isNative()) m_natives.push_back(&inst); } IRInstruction* jmp = block->back(); - if (jmp->op() == Jmp_ && jmp->getNumSrcs() != 0) { - for (SSATmp* src : jmp->getSrcs()) { + if (jmp->op() == Jmp_ && jmp->numSrcs() != 0) { + for (SSATmp* src : jmp->srcs()) { m_jmps[src].push_back(jmp); } } @@ -767,13 +767,13 @@ void LinearScan::computePreColoringHint() { for (auto const& arg : CallMap::getInfo(opc).args) { switch (arg.type) { case SSA: - m_preColoringHint.add(inst->getSrc(arg.srcIdx), 0, reg++); + m_preColoringHint.add(inst->src(arg.srcIdx), 0, reg++); break; case TV: case VecKeyS: case VecKeyIS: - m_preColoringHint.add(inst->getSrc(arg.srcIdx), 0, reg++); - m_preColoringHint.add(inst->getSrc(arg.srcIdx), 1, reg++); + m_preColoringHint.add(inst->src(arg.srcIdx), 0, reg++); + m_preColoringHint.add(inst->src(arg.srcIdx), 1, reg++); break; case Immed: break; @@ -787,29 +787,29 @@ void LinearScan::computePreColoringHint() { // registers. auto normalHint = [&](int count, int srcBase = 0, int argBase = 0) { for (int i = 0; i < count; ++i) { - m_preColoringHint.add(inst->getSrc(i + srcBase), 0, + m_preColoringHint.add(inst->src(i + srcBase), 0, i + argBase); } }; switch (opc) { case LdFunc: - m_preColoringHint.add(inst->getSrc(0), 0, 1); + m_preColoringHint.add(inst->src(0), 0, 1); break; case NativeImpl: - m_preColoringHint.add(inst->getSrc(1), 0, 0); + m_preColoringHint.add(inst->src(1), 0, 0); break; case Concat: { - Type lType = inst->getSrc(0)->type(); - Type rType = inst->getSrc(1)->type(); + Type lType = inst->src(0)->type(); + Type rType = inst->src(1)->type(); if ((lType.isString() && rType.isString()) || (lType.isString() && rType == Type::Int) || (lType == Type::Int && rType.isString())) { - m_preColoringHint.add(inst->getSrc(0), 0, 0); - m_preColoringHint.add(inst->getSrc(1), 0, 1); + m_preColoringHint.add(inst->src(0), 0, 0); + m_preColoringHint.add(inst->src(1), 0, 1); } else { - m_preColoringHint.add(inst->getSrc(0), 0, 1); - m_preColoringHint.add(inst->getSrc(1), 0, 3); + m_preColoringHint.add(inst->src(0), 0, 1); + m_preColoringHint.add(inst->src(1), 0, 3); } } break; @@ -821,8 +821,8 @@ void LinearScan::computePreColoringHint() { case OpSame: case OpNSame: { - auto src1 = inst->getSrc(0); - auto src2 = inst->getSrc(1); + auto src1 = inst->src(0); + auto src2 = inst->src(1); auto type1 = src1->type(); auto type2 = src2->type(); @@ -838,7 +838,7 @@ void LinearScan::computePreColoringHint() { break; case IterInit: { - m_preColoringHint.add(inst->getSrc(0), 0, 1); + m_preColoringHint.add(inst->src(0), 0, 1); } break; case InstanceOf: @@ -858,7 +858,7 @@ void LinearScan::computePreColoringHint() { normalHint(3); break; case LdCls: - m_preColoringHint.add(inst->getSrc(0), 0, 1); + m_preColoringHint.add(inst->src(0), 0, 1); break; case BoxPtr: normalHint(1); @@ -903,8 +903,8 @@ RegNumber LinearScan::getJmpPreColor(SSATmp* tmp, uint32_t regIndex, if (srcInst->op() == DefLabel) { // Figure out which dst of the label is tmp - for (unsigned i = 0, n = srcInst->getNumDsts(); i < n; ++i) { - if (srcInst->getDst(i) == tmp) { + for (unsigned i = 0, n = srcInst->numDsts(); i < n; ++i) { + if (srcInst->dst(i) == tmp) { auto reg = findLabelSrcReg(m_allocInfo, srcInst, i, regIndex); // Until we handle loops, it's a bug to try and allocate a // register to a DefLabel's dest before all of its incoming @@ -928,12 +928,12 @@ RegNumber LinearScan::getJmpPreColor(SSATmp* tmp, uint32_t regIndex, IRInstruction* label = jmp->getTaken()->front(); // Figure out which src of the Jmp_ is tmp - for (unsigned si = 0, sn = jmp->getNumSrcs(); si < sn; ++si) { - SSATmp* src = jmp->getSrc(si); + for (unsigned si = 0, sn = jmp->numSrcs(); si < sn; ++si) { + SSATmp* src = jmp->src(si); if (tmp == src) { // For now, a DefLabel should never have a register assigned // to it before any of its incoming Jmp_ instructions. - always_assert(m_allocInfo[label->getDst(si)].getReg(regIndex) == + always_assert(m_allocInfo[label->dst(si)].getReg(regIndex) == reg::noreg); auto reg = findLabelSrcReg(m_allocInfo, label, si, regIndex); if (reg != reg::noreg) return reg; @@ -958,8 +958,8 @@ void LinearScan::initFreeList() { void LinearScan::coalesce(Trace* trace) { forEachTraceInst(trace, [](IRInstruction* inst) { - for (uint32_t i = 0; i < inst->getNumSrcs(); ++i) { - SSATmp* src = inst->getSrc(i); + for (uint32_t i = 0; i < inst->numSrcs(); ++i) { + SSATmp* src = inst->src(i); SSATmp* origSrc = canonicalize(src); if (origSrc != src) { // Replace every operand with its canonicalized version. @@ -979,7 +979,7 @@ void LinearScan::numberInstructions(const BlockList& blocks) { if (inst.op() == Marker) continue; // don't number markers uint32_t id = nextId++; m_linear[inst] = id; - for (SSATmp* tmp : inst.getSrcs()) { + for (SSATmp* tmp : inst.srcs()) { m_uses[tmp].lastUse = id; m_uses[tmp].count++; } @@ -1064,15 +1064,15 @@ void LinearScan::findFullXMMCandidates() { m_fullXMMCandidates.reset(); for (auto* block : m_blocks) { for (auto& inst : *block) { - for (SSATmp& tmp : inst.getDsts()) { + for (SSATmp& tmp : inst.dsts()) { if (tmp.numNeededRegs() == 2 && inst.isLoad()) { - m_fullXMMCandidates[tmp.getId()] = true; + m_fullXMMCandidates[tmp.id()] = true; } } int idx = 0; - for (SSATmp* tmp : inst.getSrcs()) { + for (SSATmp* tmp : inst.srcs()) { if (tmp->numNeededRegs() == 2 && !inst.stores(idx)) { - notCandidates[tmp->getId()] = true; + notCandidates[tmp->id()] = true; } idx++; } @@ -1153,7 +1153,7 @@ void LinearScan::allocRegsOneTrace(BlockList::iterator& blockIt, } FTRACE(5, "Block{}: {} ({})\n", trace->isMain() ? "" : " (exit trace)", - (*blockIt)->getId(), (*blockIt)->postId()); + (*blockIt)->id(), (*blockIt)->postId()); // clear remembered reloads that don't dominate this block for (SlotInfo& slot : m_slots) { @@ -1191,7 +1191,7 @@ void LinearScan::allocRegsOneTrace(BlockList::iterator& blockIt, while (begin < end) { SlotInfo& slot = m_slots[begin++]; IRInstruction* spill = slot.spillTmp->inst(); - IRInstruction* inst = spill->getSrc(0)->inst(); + IRInstruction* inst = spill->src(0)->inst(); Block* block = inst->getBlock(); if (!isMain && block->getTrace()->isMain()) { // We're on an exit trace, but the def is on the @@ -1226,7 +1226,7 @@ void LinearScan::allocRegsToTrace() { for (auto& b : m_blocks) { s << folly::format("{}{} ", b->isMain() ? "M" : "E", - b->getId()); + b->id()); } s << "\n"; HPHP::Trace::traceRelease("%s\n", s.str().c_str()); @@ -1270,7 +1270,7 @@ bool srcsAreLive(const RegAllocInfo& regs, IRInstruction* inst, // in registers we trust to be live: rVmSp and rVmFp. Ignore DefConst // sources because they're implicitly turned into immediates by every // instruction that uses them. - for (SSATmp* src : inst->getSrcs()) { + for (SSATmp* src : inst->srcs()) { if (!regs[src].hasReg(0) && src->inst()->op() != DefConst) return false; auto reg = regs[src].getReg(0); if (reg != rVmSp && reg != rVmFp) return false; @@ -1289,8 +1289,8 @@ void LinearScan::rematerializeAux() { SSATmp* curFp = nullptr; smart::vector localValues; auto killLocal = [&](IRInstruction& inst, unsigned src) { - if (src < inst.getNumSrcs()) { - unsigned loc = inst.getSrc(src)->getValInt(); + if (src < inst.numSrcs()) { + unsigned loc = inst.src(src)->getValInt(); if (loc < localValues.size()) localValues[loc] = nullptr; } }; @@ -1338,18 +1338,18 @@ void LinearScan::rematerializeAux() { IRInstruction& inst = *it; Opcode opc = inst.op(); if (opc == DefFP || opc == FreeActRec) { - assert(m_allocInfo[inst.getDst()].getReg() == rVmFp); - curFp = inst.getDst(); + assert(m_allocInfo[inst.dst()].getReg() == rVmFp); + curFp = inst.dst(); } else if (opc == Reload) { // s = Spill t0 // t = Reload s - SSATmp* dst = inst.getDst(); + SSATmp* dst = inst.dst(); SSATmp* spilledTmp = getSpilledTmp(dst); IRInstruction* spilledInst = spilledTmp->inst(); IRInstruction* newInst = NULL; if (spilledInst->isRematerializable() || (spilledInst->op() == LdStack && - spilledInst->getSrc(0) == curSp)) { + spilledInst->src(0) == curSp)) { // XXX: could change to the non-check version. // Rematerialize those rematerializable instructions (i.e., // isRematerializable returns true) and LdStack. @@ -1386,14 +1386,14 @@ void LinearScan::rematerializeAux() { } // Updating curSp and localValues - if (inst.hasDst() && m_allocInfo[inst.getDst()].getReg() == rVmSp) { + if (inst.hasDst() && m_allocInfo[inst.dst()].getReg() == rVmSp) { // inst modifies the stack pointer. - curSp = inst.getDst(); + curSp = inst.dst(); } if (opc == LdLoc || opc == StLoc || opc == StLocNT) { setLocal(inst.getExtra()->locId, - opc == LdLoc ? inst.getDst() : inst.getSrc(1)); + opc == LdLoc ? inst.dst() : inst.src(1)); } // Other instructions that may have side effects on locals must // kill the local variable values. @@ -1417,10 +1417,10 @@ void LinearScan::rematerializeAux() { void LinearScan::removeUnusedSpills() { for (SlotInfo& slot : m_slots) { IRInstruction* spill = slot.spillTmp->inst(); - if (m_uses[spill->getDst()].count == 0) { + if (m_uses[spill->dst()].count == 0) { Block* block = spill->getBlock(); block->erase(block->iteratorTo(spill)); - SSATmp* src = spill->getSrc(0); + SSATmp* src = spill->src(0); auto uses = m_uses[src].count - 1; m_uses[src].count = uses; if (uses == 0) { @@ -1583,7 +1583,7 @@ uint32_t LinearScan::createSpillSlot(SSATmp* tmp) { uint32_t slotId = m_slots.size(); m_spillSlots[tmp] = slotId; IRInstruction* spillInst = m_irFactory->gen(Spill, tmp); - SSATmp* spillTmp = spillInst->getDst(); + SSATmp* spillTmp = spillInst->dst(); SlotInfo si; si.spillTmp = spillTmp; si.latestReload = tmp; @@ -1604,9 +1604,9 @@ uint32_t LinearScan::getNextNativeId() const { SSATmp* LinearScan::getSpilledTmp(SSATmp* tmp) { assert(tmp->inst()->op() == Reload); - SSATmp* slot = tmp->inst()->getSrc(0); + SSATmp* slot = tmp->inst()->src(0); assert(slot->inst()->op() == Spill); - return slot->inst()->getSrc(0); + return slot->inst()->src(0); } // If is a reloaded value, follow the spill-reload chain to find diff --git a/hphp/runtime/vm/translator/hopt/memelim.cpp b/hphp/runtime/vm/translator/hopt/memelim.cpp index 86fedcd2a..e15386ed0 100644 --- a/hphp/runtime/vm/translator/hopt/memelim.cpp +++ b/hphp/runtime/vm/translator/hopt/memelim.cpp @@ -123,13 +123,13 @@ private: void update(IRInstruction* inst) { assert(inst != nullptr); - int offset = inst->getSrc(1)->getValInt(); + int offset = inst->src(1)->getValInt(); PropList::iterator it, end; for (it = accesses.begin(), end = accesses.end(); it != end; ++it) { if (it->offset == offset) { it->access = inst; - it->value = inst->getSrc(2); + it->value = inst->src(2); } } @@ -216,13 +216,13 @@ private: Opcode op = inst->op(); if (isLoad(op)) { - return inst->getDst(); + return inst->dst(); } if (isStore(op)) { if (op == StProp || op == StPropNT) { - return inst->getSrc(2); + return inst->src(2); } - return inst->getSrc(1); + return inst->src(1); } if (isVectorOp(op)) { // Vector instructions may change boxes such that the new value @@ -230,7 +230,7 @@ private: return nullptr; } if (op == Box) { - return inst->getSrc(0); + return inst->src(0); } // no support for extracting the value from this instruction, so return NULL @@ -241,12 +241,12 @@ private: assert(inst != nullptr); switch (inst->op()) { case LdRef: - return inst->getDst(); + return inst->dst(); case StRef: case StRefNT: - return inst->getSrc(1); + return inst->src(1); case Box: - return inst->getSrc(0); + return inst->src(0); default: // no support for extracting the value from this instruction return nullptr; @@ -267,13 +267,13 @@ private: } bool isLive(IRInstruction* inst) const { - assert(inst->getId() < m_liveInsts.size()); - return m_liveInsts.test(inst->getId()); + assert(inst->id() < m_liveInsts.size()); + return m_liveInsts.test(inst->id()); } void setLive(IRInstruction& inst, bool live) { - assert(inst.getId() < m_liveInsts.size()); - m_liveInsts.set(inst.getId(), live); + assert(inst.id() < m_liveInsts.size()); + m_liveInsts.set(inst.id(), live); } private: @@ -293,7 +293,7 @@ void MemMap::killRefInfo(IRInstruction* save) { // if 'save' is a load, then don't kill access info of refs that have a // different type than 'save' if ((isLoad(save->op()) || save->op() == LdMem)) { - auto saveType = save->getDst()->type(); + auto saveType = save->dst()->type(); if (it->second->value != nullptr && it->second->value->type() != saveType && it->second->value->type().isKnownDataType() && @@ -320,7 +320,7 @@ void MemMap::killPropInfo(IRInstruction* save) { assert(save != nullptr); PropInfoList* propInfoList = nullptr; - PropMap::iterator find = m_props.find(save->getSrc(0)); + PropMap::iterator find = m_props.find(save->src(0)); if (find != m_props.end()) { propInfoList = find->second; } @@ -329,7 +329,7 @@ void MemMap::killPropInfo(IRInstruction* save) { // of a LdMem or StMem), otherwise -1 Opcode op = save->op(); int offset = (op == LdProp || op == StProp || op == StPropNT) ? - save->getSrc(1)->getValInt() : -1; + save->src(1)->getValInt() : -1; for (PropMap::iterator it = m_props.begin(), end = m_props.end(); it != end; ++it) { @@ -350,9 +350,9 @@ void MemMap::killPropInfo(IRInstruction* save) { // have a different type than 'save' if ((isLoad(save->op()) || save->op() == LdMem) && copy->value != nullptr && - copy->value->type() != save->getDst()->type() && + copy->value->type() != save->dst()->type() && copy->value->type().isKnownDataType() && - save->getDst()->type().isKnownDataType()) { + save->dst()->type().isKnownDataType()) { continue; } // TODO consider doing the same with the type of the base ref pointer @@ -411,7 +411,7 @@ void MemMap::processInstruction(IRInstruction* inst, bool isPseudoMain) { switch (op) { case Box: { - m_unescaped[inst->getDst()] = new RefInfo(inst); + m_unescaped[inst->dst()] = new RefInfo(inst); break; } @@ -431,7 +431,7 @@ void MemMap::processInstruction(IRInstruction* inst, bool isPseudoMain) { } case Unbox: case LdRef: { - SSATmp* ref = inst->getSrc(0); + SSATmp* ref = inst->src(0); // only need to kill access info of possibly escaped refs if (m_unescaped.count(ref) > 0) { @@ -453,8 +453,8 @@ void MemMap::processInstruction(IRInstruction* inst, bool isPseudoMain) { case Mov: case IncRef: { - SSATmp* dest = inst->getDst(); - SSATmp* source = inst->getSrc(0); + SSATmp* dest = inst->dst(); + SSATmp* source = inst->src(0); // figure out which map the new alias is supposed to be inserted into if (source->type().isBoxed()) { @@ -497,13 +497,13 @@ void MemMap::processInstruction(IRInstruction* inst, bool isPseudoMain) { case StLoc: case StLocNT: { - storeLocal(inst->getExtra()->locId, inst->getSrc(1)); + storeLocal(inst->getExtra()->locId, inst->src(1)); break; } case StRef: case StRefNT: { - SSATmp* ref = inst->getSrc(0); - SSATmp* alias = inst->getDst(); + SSATmp* ref = inst->src(0); + SSATmp* alias = inst->dst(); // StRef* instructions create a new alias that doesn't affect our tracked // ref count. after a StRef, the source temp is no longer used, so it just @@ -543,18 +543,18 @@ void MemMap::processInstruction(IRInstruction* inst, bool isPseudoMain) { case LdProp: case StProp: case StPropNT: { - SSATmp* obj = inst->getSrc(0); + SSATmp* obj = inst->src(0); // if we're storing out an unescaped ref, then it has now escaped - if (op != LdProp && m_unescaped.count(inst->getSrc(2)) > 0) { - escapeRef(inst->getSrc(2)); + if (op != LdProp && m_unescaped.count(inst->src(2)) > 0) { + escapeRef(inst->src(2)); } if (m_props.count(obj) > 0) { m_props[obj]->update(inst); } else { PropInfoList* list = new PropInfoList; - int offset = inst->getSrc(1)->getValInt(); + int offset = inst->src(1)->getValInt(); list->accesses.push_back(PropInfo(inst, offset)); m_props[obj] = list; } @@ -564,8 +564,8 @@ void MemMap::processInstruction(IRInstruction* inst, bool isPseudoMain) { } case DecRef: case DecRefNZ: { - SSATmp* ref = inst->getSrc(0); - Type ty = inst->getSrc(0)->type(); + SSATmp* ref = inst->src(0); + Type ty = inst->src(0)->type(); if (ref->isConst()) { // cannot be ref-counted @@ -613,7 +613,7 @@ void MemMap::processInstruction(IRInstruction* inst, bool isPseudoMain) { // escape any boxes that are on the right hand side of the current // instruction RefMap::iterator end = m_unescaped.end(); - for (SSATmp* src : inst->getSrcs()) { + for (SSATmp* src : inst->srcs()) { RefMap::iterator find = m_unescaped.find(src); if (find != end) { escapeRef(find->first); @@ -688,7 +688,7 @@ void MemMap::optimizeMemoryAccesses(Trace* trace) { if (isLoad(op)) { if (op == LdProp) { - offset = inst.getSrc(1)->getValInt(); + offset = inst.src(1)->getValInt(); } // initialize each instruction as live setLive(inst, true); @@ -696,14 +696,14 @@ void MemMap::optimizeMemoryAccesses(Trace* trace) { optimizeLoad(&inst, offset); } else if (isStore(op)) { if (op == StProp || op == StPropNT) { - offset = inst.getSrc(1)->getValInt(); + offset = inst.src(1)->getValInt(); } // if we see a store, first check if its last available access is a store // if it is, then the last access is a dead store auto access = inst.op() == StLoc || inst.op() == StLocNT ? lastLocalAccess(inst.getExtra()->locId) - : getLastAccess(inst.getSrc(0), offset); + : getLastAccess(inst.src(0), offset); if (access && isStore(access->op())) { // if a dead St* is followed by a St*NT, then the second store needs to // now write in the type because the first store will be removed @@ -760,12 +760,12 @@ void MemMap::optimizeLoad(IRInstruction* inst, int offset) { // then replace the load with a Mov auto value = inst->op() == LdLoc ? getLocalValue(inst->getExtra()->locId) - : getValue(inst->getSrc(0), offset); + : getValue(inst->src(0), offset); if (value == nullptr) { return; } - Type instTy = inst->getDst()->type(); + Type instTy = inst->dst()->type(); Type valTy = value->type(); // check for loads that have a guard that will definitely fail @@ -781,7 +781,7 @@ void MemMap::optimizeLoad(IRInstruction* inst, int offset) { inst->setSrc(1, nullptr); inst->setNumSrcs(1); } else { - assert(inst->getNumSrcs() == 1); + assert(inst->numSrcs() == 1); } inst->setTaken(nullptr); diff --git a/hphp/runtime/vm/translator/hopt/mutation.cpp b/hphp/runtime/vm/translator/hopt/mutation.cpp index 47206c7ae..ac2c9c0ac 100644 --- a/hphp/runtime/vm/translator/hopt/mutation.cpp +++ b/hphp/runtime/vm/translator/hopt/mutation.cpp @@ -32,10 +32,10 @@ void cloneToBlock(const BlockList& rpoBlocks, StateVector rewriteMap(irFactory, nullptr); auto rewriteSources = [&] (IRInstruction* inst) { - for (int i = 0; i < inst->getNumSrcs(); ++i) { - if (auto newTmp = rewriteMap[inst->getSrc(i)]) { + for (int i = 0; i < inst->numSrcs(); ++i) { + if (auto newTmp = rewriteMap[inst->src(i)]) { FTRACE(5, " rewrite: {} -> {}\n", - inst->getSrc(i)->toString(), + inst->src(i)->toString(), newTmp->toString()); inst->setSrc(i, newTmp); } @@ -46,15 +46,15 @@ void cloneToBlock(const BlockList& rpoBlocks, for (auto it = first; it != last; ++it) { assert(!it->isControlFlowInstruction()); - FTRACE(5, "cloneToBlock({}): {}\n", target->getId(), it->toString()); + FTRACE(5, "cloneToBlock({}): {}\n", target->id(), it->toString()); auto const newInst = irFactory->cloneInstruction(&*it); - if (auto const numDests = newInst->getNumDsts()) { + if (auto const numDests = newInst->numDsts()) { for (int i = 0; i < numDests; ++i) { FTRACE(5, " add rewrite: {} -> {}\n", - it->getDst(i)->toString(), - newInst->getDst(i)->toString()); - rewriteMap[it->getDst(i)] = newInst->getDst(i); + it->dst(i)->toString(), + newInst->dst(i)->toString()); + rewriteMap[it->dst(i)] = newInst->dst(i); } } @@ -64,7 +64,7 @@ void cloneToBlock(const BlockList& rpoBlocks, auto it = rpoIteratorTo(rpoBlocks, target); for (; it != rpoBlocks.end(); ++it) { - FTRACE(5, "cloneToBlock: rewriting block {}\n", (*it)->getId()); + FTRACE(5, "cloneToBlock: rewriting block {}\n", (*it)->id()); for (auto& inst : **it) { FTRACE(5, " rewriting {}\n", inst.toString()); rewriteSources(&inst); @@ -85,7 +85,7 @@ void moveToBlock(Block::iterator const first, assert(!inst->isControlFlowInstruction()); FTRACE(5, "moveToBlock({}): {}\n", - target->getId(), + target->id(), inst->toString()); it = srcBlock->erase(it); @@ -98,7 +98,7 @@ void reflowTypes(Block* const changed, const BlockList& blocks) { assert(isRPOSorted(blocks)); auto retypeDst = [&] (IRInstruction* inst, int num) { - auto ssa = inst->getDst(num); + auto ssa = inst->dst(num); /* * The type of a tmp defined by DefLabel is the union of the @@ -117,8 +117,8 @@ void reflowTypes(Block* const changed, const BlockList& blocks) { }; auto visit = [&] (IRInstruction* inst) { - for (int i = 0; i < inst->getNumDsts(); ++i) { - auto const ssa = inst->getDst(i); + for (int i = 0; i < inst->numDsts(); ++i) { + auto const ssa = inst->dst(i); auto const oldType = ssa->type(); retypeDst(inst, i); if (ssa->type() != oldType) { @@ -131,7 +131,7 @@ void reflowTypes(Block* const changed, const BlockList& blocks) { auto it = rpoIteratorTo(blocks, changed); assert(it != blocks.end()); for (; it != blocks.end(); ++it) { - FTRACE(5, "reflowTypes: visiting block {}\n", (*it)->getId()); + FTRACE(5, "reflowTypes: visiting block {}\n", (*it)->id()); for (auto& inst : **it) visit(&inst); } } diff --git a/hphp/runtime/vm/translator/hopt/nativecalls.cpp b/hphp/runtime/vm/translator/hopt/nativecalls.cpp index 65ae63824..c8bef0371 100644 --- a/hphp/runtime/vm/translator/hopt/nativecalls.cpp +++ b/hphp/runtime/vm/translator/hopt/nativecalls.cpp @@ -45,7 +45,7 @@ static const DestType DNone = DestType::None; * Func * A value describing the function to call: * (TCA) - Raw function pointer - * {FSSA, idx} - Use a const TCA from inst->getSrc(idx) + * {FSSA, idx} - Use a const TCA from inst->src(idx) * * Dest * DSSA - The helper returns a single-register value @@ -59,8 +59,8 @@ static const DestType DNone = DestType::None; * * Args * A list of tuples describing the arguments to pass to the helper - * {SSA, idx} - Pass the value in inst->getSrc(idx) - * {TV, idx} - Pass the value in inst->getSrc(idx) as a + * {SSA, idx} - Pass the value in inst->src(idx) + * {TV, idx} - Pass the value in inst->src(idx) as a * TypedValue, in two registers * {VecKeyS, idx} - Like TV, but Str values are passed as a raw * StringData*, in a single register diff --git a/hphp/runtime/vm/translator/hopt/opt.cpp b/hphp/runtime/vm/translator/hopt/opt.cpp index e4ffb75fc..955d6aa2a 100644 --- a/hphp/runtime/vm/translator/hopt/opt.cpp +++ b/hphp/runtime/vm/translator/hopt/opt.cpp @@ -42,7 +42,7 @@ static void insertAfter(IRInstruction* definer, IRInstruction* inst) { * to check the _count field. */ static void insertRefCountAsserts(IRInstruction& inst, IRFactory* factory) { - for (SSATmp& dst : inst.getDsts()) { + for (SSATmp& dst : inst.dsts()) { Type t = dst.type(); if (t.subtypeOf(Type::Counted | Type::StaticStr | Type::StaticArr)) { insertAfter(&inst, factory->gen(DbgAssertRefCount, &dst)); @@ -55,8 +55,8 @@ static void insertRefCountAsserts(IRInstruction& inst, IRFactory* factory) { * a SpillStack instruction. */ static void insertSpillStackAsserts(IRInstruction& inst, IRFactory* factory) { - SSATmp* sp = inst.getDst(); - auto const vals = inst.getSrcs().subpiece(2); + SSATmp* sp = inst.dst(); + auto const vals = inst.srcs().subpiece(2); auto* block = inst.getBlock(); auto pos = block->iteratorTo(&inst); ++pos; for (unsigned i = 0, n = vals.size(); i < n; ++i) { @@ -67,7 +67,7 @@ static void insertSpillStackAsserts(IRInstruction& inst, IRFactory* factory) { StackOffset(i), sp); block->insert(pos, addr); - IRInstruction* check = factory->gen(DbgAssertPtr, addr->getDst()); + IRInstruction* check = factory->gen(DbgAssertPtr, addr->dst()); block->insert(pos, check); } } @@ -87,13 +87,13 @@ static void insertAsserts(Trace* trace, IRFactory* factory) { continue; } if (inst.op() == Call) { - SSATmp* sp = inst.getDst(); + SSATmp* sp = inst.dst(); IRInstruction* addr = factory->gen(LdStackAddr, Type::PtrToGen, StackOffset(0), sp); insertAfter(&inst, addr); - insertAfter(addr, factory->gen(DbgAssertPtr, addr->getDst())); + insertAfter(addr, factory->gen(DbgAssertPtr, addr->dst())); continue; } if (!inst.isBlockEnd()) insertRefCountAsserts(inst, factory); diff --git a/hphp/runtime/vm/translator/hopt/predictionopts.cpp b/hphp/runtime/vm/translator/hopt/predictionopts.cpp index f951287a8..5d2b1809b 100644 --- a/hphp/runtime/vm/translator/hopt/predictionopts.cpp +++ b/hphp/runtime/vm/translator/hopt/predictionopts.cpp @@ -82,11 +82,11 @@ void optimizePredictions(Trace* const trace, IRFactory* const irFactory) { * type-specialized versions. */ auto optLdMem = [&] (IRInstruction* checkType, IRInstruction* lastMarker) { - auto const incRef = checkType->getSrc(0)->inst(); + auto const incRef = checkType->src(0)->inst(); if (incRef->op() != IncRef) return; - auto const ldMem = incRef->getSrc(0)->inst(); + auto const ldMem = incRef->src(0)->inst(); if (ldMem->op() != LdMem) return; - if (ldMem->getSrc(1)->getValInt() != 0) return; + if (ldMem->src(1)->getValInt() != 0) return; if (!ldMem->getTypeParam().equals(Type::Cell)) return; FTRACE(5, "candidate: {}\n", ldMem->toString()); @@ -117,7 +117,7 @@ void optimizePredictions(Trace* const trace, IRFactory* const irFactory) { CheckTypeMem, checkType->getTypeParam(), checkType->getTaken(), - ldMem->getSrc(0) + ldMem->src(0) ); mainBlock->insert(mainBlock->iteratorTo(ldMem), newCheckType); @@ -140,7 +140,7 @@ void optimizePredictions(Trace* const trace, IRFactory* const irFactory) { irFactory->replace( checkType, Mov, - incRef->getDst() + incRef->dst() ); // Move the fallthrough case to specialized. @@ -169,7 +169,7 @@ void optimizePredictions(Trace* const trace, IRFactory* const irFactory) { } if (inst.op() == CheckType && - inst.getSrc(0)->type().equals(Type::Cell)) { + inst.src(0)->type().equals(Type::Cell)) { assert(lastMarker); optLdMem(&inst, lastMarker); break; diff --git a/hphp/runtime/vm/translator/hopt/print.cpp b/hphp/runtime/vm/translator/hopt/print.cpp index f5891f173..03c62e579 100644 --- a/hphp/runtime/vm/translator/hopt/print.cpp +++ b/hphp/runtime/vm/translator/hopt/print.cpp @@ -67,10 +67,10 @@ void printOpcode(std::ostream& os, const IRInstruction* inst) { void printDst(std::ostream& os, const IRInstruction* inst, const RegAllocInfo* regs, const LifetimeInfo* lifetime) { - if (inst->getNumDsts() == 0) return; + if (inst->numDsts() == 0) return; const char* sep = ""; - for (const SSATmp& dst : inst->getDsts()) { + for (const SSATmp& dst : inst->dsts()) { os << punc(sep); print(os, &dst, regs, lifetime, true); sep = ", "; @@ -80,7 +80,7 @@ void printDst(std::ostream& os, const IRInstruction* inst, void printSrc(std::ostream& ostream, const IRInstruction* inst, uint32_t i, const RegAllocInfo* regs, const LifetimeInfo* lifetime) { - SSATmp* src = inst->getSrc(i); + SSATmp* src = inst->src(i); if (src != nullptr) { if (lifetime && lifetime->linear[inst] != 0 && !src->isConst() && lifetime->uses[src].lastUse == lifetime->linear[inst]) { @@ -100,11 +100,11 @@ void printSrcs(std::ostream& os, const IRInstruction* inst, const LifetimeInfo* lifetime) { bool first = true; if (inst->op() == IncStat) { - os << " " << Stats::g_counterNames[inst->getSrc(0)->getValInt()] - << ", " << inst->getSrc(1)->getValInt(); + os << " " << Stats::g_counterNames[inst->src(0)->getValInt()] + << ", " << inst->src(1)->getValInt(); return; } - for (uint32_t i = 0, n = inst->getNumSrcs(); i < n; i++) { + for (uint32_t i = 0, n = inst->numSrcs(); i < n; i++) { if (!first) { os << punc(", "); } else { @@ -117,7 +117,7 @@ void printSrcs(std::ostream& os, const IRInstruction* inst, void printLabel(std::ostream& os, const Block* block) { os << color(ANSI_COLOR_MAGENTA); - os << "L" << block->getId(); + os << "L" << block->id(); switch (block->getHint()) { case Block::Unlikely: os << ""; break; case Block::Likely: os << ""; break; @@ -143,9 +143,9 @@ void print(std::ostream& ostream, const IRInstruction* inst, if (!inst->isTransient()) { ostream << color(ANSI_COLOR_YELLOW); if (!lifetime || !lifetime->linear[inst]) { - ostream << folly::format("({:02d}) ", inst->getId()); + ostream << folly::format("({:02d}) ", inst->id()); } else { - ostream << folly::format("({:02d}@{:02d}) ", inst->getId(), + ostream << folly::format("({:02d}@{:02d}) ", inst->id(), lifetime->linear[inst]); } ostream << color(ANSI_COLOR_END); @@ -224,7 +224,7 @@ void print(std::ostream& os, const SSATmp* tmp, const RegAllocInfo* regs, return; } os << color(ANSI_COLOR_WHITE); - os << "t" << tmp->getId(); + os << "t" << tmp->id(); os << color(ANSI_COLOR_END); if (printLastUse && lifetime && lifetime->uses[tmp].lastUse != 0) { os << color(ANSI_COLOR_GRAY) @@ -359,11 +359,11 @@ void print(std::ostream& os, const Trace* trace, const RegAllocInfo* regs, printLabel(os, inst.getBlock()); os << punc(":") << "\n"; // print phi pseudo-instructions - for (unsigned i = 0, n = inst.getNumDsts(); i < n; ++i) { + for (unsigned i = 0, n = inst.numDsts(); i < n; ++i) { os << std::string(kIndent + - folly::format("({}) ", inst.getId()).str().size(), + folly::format("({}) ", inst.id()).str().size(), ' '); - JIT::print(os, inst.getDst(i), regs, lifetime, false); + JIT::print(os, inst.dst(i), regs, lifetime, false); os << punc(" = ") << color(ANSI_COLOR_CYAN) << "phi " << color(ANSI_COLOR_END); bool first = true; diff --git a/hphp/runtime/vm/translator/hopt/simplifier.cpp b/hphp/runtime/vm/translator/hopt/simplifier.cpp index 850f93cca..d693871d4 100644 --- a/hphp/runtime/vm/translator/hopt/simplifier.cpp +++ b/hphp/runtime/vm/translator/hopt/simplifier.cpp @@ -40,13 +40,13 @@ StackValueInfo getStackValue(SSATmp* sp, uint32_t index) { case ReDefGeneratorSP: case StashGeneratorSP: - return getStackValue(inst->getSrc(0), index); + return getStackValue(inst->src(0), index); case ReDefSP: - return getStackValue(inst->getSrc(1), index); + return getStackValue(inst->src(1), index); case ExceptionBarrier: - return getStackValue(inst->getSrc(0), index); + return getStackValue(inst->src(0), index); case SideExitGuardStk: always_assert(0 && "simplifier is not tested for running after jumpopts"); @@ -63,7 +63,7 @@ StackValueInfo getStackValue(SSATmp* sp, uint32_t index) { if (inst->getExtra()->offset == index) { return StackValueInfo { inst->getTypeParam() }; } - return getStackValue(inst->getSrc(0), index); + return getStackValue(inst->src(0), index); case CallArray: { if (index == 0) { @@ -71,7 +71,7 @@ StackValueInfo getStackValue(SSATmp* sp, uint32_t index) { return StackValueInfo { nullptr }; } auto info = - getStackValue(inst->getSrc(0), + getStackValue(inst->src(0), // Pushes a return value, pops an ActRec and args Array index - (1 /* pushed */ - kNumActRecCells + 1 /* popped */)); @@ -85,7 +85,7 @@ StackValueInfo getStackValue(SSATmp* sp, uint32_t index) { return StackValueInfo { nullptr }; } auto info = - getStackValue(inst->getSrc(0), + getStackValue(inst->src(0), index - (1 /* pushed */ - kNumActRecCells /* popped */)); info.spansCall = true; @@ -94,13 +94,13 @@ StackValueInfo getStackValue(SSATmp* sp, uint32_t index) { case SpillStack: { int64_t numPushed = 0; - int32_t numSpillSrcs = inst->getNumSrcs() - 2; + int32_t numSpillSrcs = inst->numSrcs() - 2; for (int i = 0; i < numSpillSrcs; ++i) { - SSATmp* tmp = inst->getSrc(i + 2); + SSATmp* tmp = inst->src(i + 2); if (index == numPushed) { if (tmp->inst()->op() == IncRef) { - tmp = tmp->inst()->getSrc(0); + tmp = tmp->inst()->src(0); } if (!tmp->type().equals(Type::None)) { return StackValueInfo { tmp }; @@ -111,16 +111,16 @@ StackValueInfo getStackValue(SSATmp* sp, uint32_t index) { // This is not one of the values pushed onto the stack by this // spillstack instruction, so continue searching. - SSATmp* prevSp = inst->getSrc(0); - int64_t numPopped = inst->getSrc(1)->getValInt(); + SSATmp* prevSp = inst->src(0); + int64_t numPopped = inst->src(1)->getValInt(); return getStackValue(prevSp, // pop values pushed by spillstack index - (numPushed - numPopped)); } case InterpOne: { - SSATmp* prevSp = inst->getSrc(1); - int64_t spAdjustment = inst->getSrc(3)->getValInt(); // # popped - # pushed + SSATmp* prevSp = inst->src(1); + int64_t spAdjustment = inst->src(3)->getValInt(); // # popped - # pushed Type resultType = inst->getTypeParam(); if (index == 0 && !resultType.equals(Type::None)) { return StackValueInfo { resultType }; @@ -129,7 +129,7 @@ StackValueInfo getStackValue(SSATmp* sp, uint32_t index) { } case SpillFrame: - return getStackValue(inst->getSrc(0), + return getStackValue(inst->src(0), // pushes an ActRec index - kNumActRecCells); @@ -137,14 +137,14 @@ StackValueInfo getStackValue(SSATmp* sp, uint32_t index) { { // Assume it's a vector instruction. This will assert in // vectorBaseIdx if not. - auto const base = inst->getSrc(vectorBaseIdx(inst)); + auto const base = inst->src(vectorBaseIdx(inst)); assert(base->inst()->op() == LdStackAddr); if (base->inst()->getExtra()->offset == index) { VectorEffects ve(inst); assert(ve.baseTypeChanged || ve.baseValChanged); return StackValueInfo { ve.baseType.derefIfPtr() }; } - return getStackValue(base->inst()->getSrc(0), index); + return getStackValue(base->inst()->src(0), index); } } @@ -167,18 +167,18 @@ smart::vector collectStackValues(SSATmp* sp, uint32_t stackDepth) { ////////////////////////////////////////////////////////////////////// static void copyPropSrc(IRInstruction* inst, int index) { - auto tmp = inst->getSrc(index); + auto tmp = inst->src(index); auto srcInst = tmp->inst(); switch (srcInst->op()) { case Mov: - inst->setSrc(index, srcInst->getSrc(0)); + inst->setSrc(index, srcInst->src(0)); break; case IncRef: - if (!isRefCounted(srcInst->getSrc(0))) { + if (!isRefCounted(srcInst->src(0))) { srcInst->setOpcode(Mov); - inst->setSrc(index, srcInst->getSrc(0)); + inst->setSrc(index, srcInst->src(0)); } break; @@ -188,7 +188,7 @@ static void copyPropSrc(IRInstruction* inst, int index) { } void copyProp(IRInstruction* inst) { - for (uint32_t i = 0; i < inst->getNumSrcs(); i++) { + for (uint32_t i = 0; i < inst->numSrcs(); i++) { copyPropSrc(inst, i); } } @@ -242,8 +242,8 @@ template SSATmp* Simplifier::gen(Args&&... args) { ////////////////////////////////////////////////////////////////////// SSATmp* Simplifier::simplify(IRInstruction* inst) { - SSATmp* src1 = inst->getSrc(0); - SSATmp* src2 = inst->getSrc(1); + SSATmp* src1 = inst->src(0); + SSATmp* src2 = inst->src(1); Opcode opc = inst->op(); switch (opc) { @@ -348,9 +348,9 @@ SSATmp* Simplifier::simplify(IRInstruction* inst) { } SSATmp* Simplifier::simplifySpillStack(IRInstruction* inst) { - auto const sp = inst->getSrc(0); - auto const spDeficit = inst->getSrc(1)->getValInt(); - auto spillVals = inst->getSrcs().subpiece(2); + auto const sp = inst->src(0); + auto const spDeficit = inst->src(1)->getValInt(); + auto spillVals = inst->srcs().subpiece(2); auto const numSpillSrcs = spillVals.size(); auto const spillCells = spillValueCells(inst); int64_t adjustment = spDeficit - spillCells; @@ -364,7 +364,7 @@ SSATmp* Simplifier::simplifySpillStack(IRInstruction* inst) { for (uint32_t i = 0, cellOff = 0; i < numSpillSrcs; i++) { const int64_t offset = cellOff + adjustment; auto* srcInst = spillVals[i]->inst(); - if (srcInst->op() == LdStack && srcInst->getSrc(0) == sp && + if (srcInst->op() == LdStack && srcInst->src(0) == sp && srcInst->getExtra()->offset == offset) { spillVals[i] = m_tb->genDefNone(); } @@ -377,14 +377,14 @@ SSATmp* Simplifier::simplifySpillStack(IRInstruction* inst) { } SSATmp* Simplifier::simplifyCall(IRInstruction* inst) { - auto spillVals = inst->getSrcs().subpiece(3); - auto const spillStack = inst->getSrc(0)->inst(); + auto spillVals = inst->srcs().subpiece(3); + auto const spillStack = inst->src(0)->inst(); if (spillStack->op() != SpillStack) { return nullptr; } - SSATmp* sp = spillStack->getSrc(0); - int baseOffset = spillStack->getSrc(1)->getValInt() - + SSATmp* sp = spillStack->src(0); + int baseOffset = spillStack->src(1)->getValInt() - spillValueCells(spillStack); auto const numSpillSrcs = spillVals.size(); for (int32_t i = 0; i < numSpillSrcs; i++) { @@ -393,7 +393,7 @@ SSATmp* Simplifier::simplifyCall(IRInstruction* inst) { IRInstruction* srcInst = spillVals[i]->inst(); // If our value came from a LdStack on the same sp and offset, // we don't need to spill it. - if (srcInst->op() == LdStack && srcInst->getSrc(0) == sp && + if (srcInst->op() == LdStack && srcInst->src(0) == sp && srcInst->getExtra()->offset == offset) { spillVals[i] = m_tb->genDefNone(); } @@ -407,7 +407,7 @@ SSATmp* Simplifier::simplifyCall(IRInstruction* inst) { // We never inline functions that could have a VarEnv, so an // ExitOnVarEnv that has a frame based on DefInlineFP can be removed. SSATmp* Simplifier::simplifyExitOnVarEnv(IRInstruction* inst) { - auto const frameInst = inst->getSrc(0)->inst(); + auto const frameInst = inst->src(0)->inst(); if (frameInst->op() == DefInlineFP) { inst->convertToNop(); } @@ -415,17 +415,17 @@ SSATmp* Simplifier::simplifyExitOnVarEnv(IRInstruction* inst) { } SSATmp* Simplifier::simplifyLdCtx(IRInstruction* inst) { - const Func* func = inst->getSrc(1)->getValFunc(); + const Func* func = inst->src(1)->getValFunc(); if (func->isStatic()) { // ActRec->m_cls of a static function is always a valid class pointer with // the bottom bit set - return gen(LdCctx, inst->getSrc(0)); + return gen(LdCctx, inst->src(0)); } return nullptr; } SSATmp* Simplifier::simplifyLdClsCtx(IRInstruction* inst) { - SSATmp* ctx = inst->getSrc(0); + SSATmp* ctx = inst->src(0); Type ctxType = ctx->type(); if (ctxType.equals(Type::Obj)) { // this pointer... load its class ptr @@ -438,7 +438,7 @@ SSATmp* Simplifier::simplifyLdClsCtx(IRInstruction* inst) { } SSATmp* Simplifier::simplifyGetCtxFwdCall(IRInstruction* inst) { - SSATmp* srcCtx = inst->getSrc(0); + SSATmp* srcCtx = inst->src(0); if (srcCtx->isA(Type::Cctx)) { return srcCtx; } @@ -446,7 +446,7 @@ SSATmp* Simplifier::simplifyGetCtxFwdCall(IRInstruction* inst) { } SSATmp* Simplifier::simplifyLdCls(IRInstruction* inst) { - SSATmp* clsName = inst->getSrc(0); + SSATmp* clsName = inst->src(0); if (clsName->isConst()) { const Class* cls = Unit::lookupClass(clsName->getValStr()); if (cls) { @@ -454,7 +454,7 @@ SSATmp* Simplifier::simplifyLdCls(IRInstruction* inst) { // the class is always defined return cns(cls); } - const Class* ctx = inst->getSrc(1)->getValClass(); + const Class* ctx = inst->src(1)->getValClass(); if (ctx && ctx->classof(cls)) { // the class of the current function being compiled is the // same as or derived from cls, so cls must be defined and @@ -469,7 +469,7 @@ SSATmp* Simplifier::simplifyLdCls(IRInstruction* inst) { SSATmp* Simplifier::simplifyCheckType(IRInstruction* inst) { Type type = inst->getTypeParam(); - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); Type srcType = src->type(); if (srcType.subtypeOf(type)) { @@ -507,8 +507,8 @@ SSATmp* Simplifier::simplifyCheckType(IRInstruction* inst) { } SSATmp* Simplifier::simplifyQueryJmp(IRInstruction* inst) { - SSATmp* src1 = inst->getSrc(0); - SSATmp* src2 = inst->getSrc(1); + SSATmp* src1 = inst->src(0); + SSATmp* src2 = inst->src(1); Opcode opc = inst->op(); // reuse the logic in simplifyCmp. SSATmp* newCmp = simplifyCmp(queryJmpToQueryOp(opc), src1, src2); @@ -547,7 +547,7 @@ SSATmp* Simplifier::simplifyNot(SSATmp* src) { switch (op) { // !!X --> X case OpNot: - return inst->getSrc(0); + return inst->src(0); // !(X cmp Y) --> X opposite_cmp Y case OpLt: @@ -559,9 +559,9 @@ SSATmp* Simplifier::simplifyNot(SSATmp* src) { case OpSame: case OpNSame: // Not for Dbl: (x < NaN) != !(x >= NaN) - if (!inst->getSrc(0)->isA(Type::Dbl) && - !inst->getSrc(1)->isA(Type::Dbl)) { - return gen(negateQueryOp(op), inst->getSrc(0), inst->getSrc(1)); + if (!inst->src(0)->isA(Type::Dbl) && + !inst->src(1)->isA(Type::Dbl)) { + return gen(negateQueryOp(op), inst->src(0), inst->src(1)); } break; @@ -571,7 +571,7 @@ SSATmp* Simplifier::simplifyNot(SSATmp* src) { // add an isNegatable. return gen( negateQueryOp(op), - std::make_pair(inst->getNumSrcs(), inst->getSrcs().begin()) + std::make_pair(inst->numSrcs(), inst->srcs().begin()) ); return nullptr; // TODO !(X | non_zero) --> 0 @@ -691,18 +691,18 @@ SSATmp* Simplifier::simplifyNot(SSATmp* src) { if (src1->isA(Type::Int) && src2->isA(Type::Int)) { \ IRInstruction* inst1 = src1->inst(); \ IRInstruction* inst2 = src2->inst(); \ - if (inst1->op() == Op##NAME && inst1->getSrc(1)->isConst()) { \ + if (inst1->op() == Op##NAME && inst1->src(1)->isConst()) { \ /* (X + C1) + C2 --> X + C3 */ \ if (src2->isConst()) { \ - int64_t right = inst1->getSrc(1)->getValInt(); \ + int64_t right = inst1->src(1)->getValInt(); \ right OP##= src2->getValInt(); \ - return gen(Op##NAME, inst1->getSrc(0), cns(right)); \ + return gen(Op##NAME, inst1->src(0), cns(right)); \ } \ /* (X + C1) + (Y + C2) --> X + Y + C3 */ \ - if (inst2->op() == Op##NAME && inst2->getSrc(1)->isConst()) { \ - int64_t right = inst1->getSrc(1)->getValInt(); \ - right OP##= inst2->getSrc(1)->getValInt(); \ - SSATmp* left = gen(Op##NAME, inst1->getSrc(0), inst2->getSrc(0)); \ + if (inst2->op() == Op##NAME && inst2->src(1)->isConst()) { \ + int64_t right = inst1->src(1)->getValInt(); \ + right OP##= inst2->src(1)->getValInt(); \ + SSATmp* left = gen(Op##NAME, inst1->src(0), inst2->src(0)); \ return gen(Op##NAME, left, cns(right)); \ } \ } \ @@ -718,21 +718,21 @@ SSATmp* Simplifier::simplifyNot(SSATmp* src) { Opcode op2 = inst2->op(); \ /* all combinations of X * Y + X * Z --> X * (Y + Z) */ \ if (op1 == Op##INNAME && op2 == Op##INNAME) { \ - if (inst1->getSrc(0) == inst2->getSrc(0)) { \ - SSATmp* fold = gen(Op##OUTNAME, inst1->getSrc(1), inst2->getSrc(1)); \ - return gen(Op##INNAME, inst1->getSrc(0), fold); \ + if (inst1->src(0) == inst2->src(0)) { \ + SSATmp* fold = gen(Op##OUTNAME, inst1->src(1), inst2->src(1)); \ + return gen(Op##INNAME, inst1->src(0), fold); \ } \ - if (inst1->getSrc(0) == inst2->getSrc(1)) { \ - SSATmp* fold = gen(Op##OUTNAME, inst1->getSrc(1), inst2->getSrc(0)); \ - return gen(Op##INNAME, inst1->getSrc(0), fold); \ + if (inst1->src(0) == inst2->src(1)) { \ + SSATmp* fold = gen(Op##OUTNAME, inst1->src(1), inst2->src(0)); \ + return gen(Op##INNAME, inst1->src(0), fold); \ } \ - if (inst1->getSrc(1) == inst2->getSrc(0)) { \ - SSATmp* fold = gen(Op##OUTNAME, inst1->getSrc(0), inst2->getSrc(1)); \ - return gen(Op##INNAME, inst1->getSrc(1), fold); \ + if (inst1->src(1) == inst2->src(0)) { \ + SSATmp* fold = gen(Op##OUTNAME, inst1->src(0), inst2->src(1)); \ + return gen(Op##INNAME, inst1->src(1), fold); \ } \ - if (inst1->getSrc(1) == inst2->getSrc(1)) { \ - SSATmp* fold = gen(Op##OUTNAME, inst1->getSrc(0), inst2->getSrc(0)); \ - return gen(Op##INNAME, inst1->getSrc(1), fold); \ + if (inst1->src(1) == inst2->src(1)) { \ + SSATmp* fold = gen(Op##OUTNAME, inst1->src(0), inst2->src(0)); \ + return gen(Op##INNAME, inst1->src(1), fold); \ } \ } \ } while (0) @@ -757,10 +757,10 @@ SSATmp* Simplifier::simplifyAdd(SSATmp* src1, SSATmp* src2) { IRInstruction* inst2 = src2->inst(); Opcode op2 = inst2->op(); if (op2 == OpSub) { - SSATmp* src = inst2->getSrc(0); + SSATmp* src = inst2->src(0); if (src->isConst() && src->type() == Type::Int) { if (src->getValInt() == 0) { - return gen(OpSub, src1, inst2->getSrc(1)); + return gen(OpSub, src1, inst2->src(1)); } } } @@ -791,10 +791,10 @@ SSATmp* Simplifier::simplifySub(SSATmp* src1, SSATmp* src2) { IRInstruction* inst2 = src2->inst(); Opcode op2 = inst2->op(); if (op2 == OpSub) { - SSATmp* src = inst2->getSrc(0); + SSATmp* src = inst2->src(0); if (src->isConst() && src->type() == Type::Int) { if (src->getValInt() == 0) { - return gen(OpAdd, src1, inst2->getSrc(1)); + return gen(OpAdd, src1, inst2->src(1)); } } } @@ -910,7 +910,7 @@ SSATmp* Simplifier::simplifyLogicXor(SSATmp* src1, SSATmp* src2) { static SSATmp* chaseIncRefs(SSATmp* tmp) { while (tmp->inst()->op() == IncRef) { - tmp = tmp->inst()->getSrc(0); + tmp = tmp->inst()->src(0); } return tmp; } @@ -1190,7 +1190,7 @@ SSATmp* Simplifier::simplifyIsType(IRInstruction* inst) { bool trueSense = inst->op() == IsType || inst->op() == JmpIsType; auto type = inst->getTypeParam(); - auto src = inst->getSrc(0); + auto src = inst->src(0); auto srcType = src->type(); // The comparisons below won't work for these cases covered by this @@ -1231,7 +1231,7 @@ SSATmp* Simplifier::simplifyConcat(SSATmp* src1, SSATmp* src2) { } SSATmp* Simplifier::simplifyConvToArr(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { Array arr = Array::Create(src->getValVariant()); return cns(ArrayData::GetScalarArray(arr.get())); @@ -1240,7 +1240,7 @@ SSATmp* Simplifier::simplifyConvToArr(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvArrToBool(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { if (src->getValArr()->empty()) { return cns(false); @@ -1251,7 +1251,7 @@ SSATmp* Simplifier::simplifyConvArrToBool(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvDblToBool(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { return cns(bool(src->getValDbl())); } @@ -1259,7 +1259,7 @@ SSATmp* Simplifier::simplifyConvDblToBool(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvIntToBool(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { return cns(bool(src->getValInt())); } @@ -1267,7 +1267,7 @@ SSATmp* Simplifier::simplifyConvIntToBool(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvStrToBool(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { // only the strings "", and "0" convert to false, all other strings // are converted to true @@ -1278,7 +1278,7 @@ SSATmp* Simplifier::simplifyConvStrToBool(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvArrToDbl(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { if (src->getValArr()->empty()) { return cns(0.0); @@ -1288,7 +1288,7 @@ SSATmp* Simplifier::simplifyConvArrToDbl(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvBoolToDbl(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { return cns(double(src->getValBool())); } @@ -1296,7 +1296,7 @@ SSATmp* Simplifier::simplifyConvBoolToDbl(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvIntToDbl(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { return cns(double(src->getValInt())); } @@ -1304,7 +1304,7 @@ SSATmp* Simplifier::simplifyConvIntToDbl(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvStrToDbl(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { const StringData *str = src->getValStr(); int64_t lval; @@ -1321,7 +1321,7 @@ SSATmp* Simplifier::simplifyConvStrToDbl(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvArrToInt(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { if (src->getValArr()->empty()) { return cns(0); @@ -1332,7 +1332,7 @@ SSATmp* Simplifier::simplifyConvArrToInt(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvBoolToInt(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { return cns(int(src->getValBool())); } @@ -1340,7 +1340,7 @@ SSATmp* Simplifier::simplifyConvBoolToInt(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvDblToInt(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { return cns(toInt64(src->getValDbl())); } @@ -1348,7 +1348,7 @@ SSATmp* Simplifier::simplifyConvDblToInt(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvStrToInt(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { const StringData *str = src->getValStr(); int64_t lval; @@ -1365,7 +1365,7 @@ SSATmp* Simplifier::simplifyConvStrToInt(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvBoolToStr(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { if (src->getValBool()) { return cns(StringData::GetStaticString("1")); @@ -1376,7 +1376,7 @@ SSATmp* Simplifier::simplifyConvBoolToStr(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvDblToStr(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { return cns( StringData::convert_double_helper(src->getValDbl())); @@ -1385,7 +1385,7 @@ SSATmp* Simplifier::simplifyConvDblToStr(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvIntToStr(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (src->isConst()) { return cns( StringData::convert_integer_helper(src->getValInt())); @@ -1394,7 +1394,7 @@ SSATmp* Simplifier::simplifyConvIntToStr(IRInstruction* inst) { } SSATmp* Simplifier::simplifyConvCellToBool(IRInstruction* inst) { - auto const src = inst->getSrc(0); + auto const src = inst->src(0); auto const srcType = src->type(); if (srcType.isBool()) return src; @@ -1409,11 +1409,11 @@ SSATmp* Simplifier::simplifyConvCellToBool(IRInstruction* inst) { } SSATmp* Simplifier::simplifyLdClsPropAddr(IRInstruction* inst) { - SSATmp* propName = inst->getSrc(1); + SSATmp* propName = inst->src(1); if (!propName->isConst()) return nullptr; - SSATmp* cls = inst->getSrc(0); - auto ctxCls = inst->getSrc(2)->getValClass(); + SSATmp* cls = inst->src(0); + auto ctxCls = inst->src(2)->getValClass(); if (canUseSPropCache(cls, propName->getValStr(), ctxCls)) { @@ -1424,7 +1424,7 @@ SSATmp* Simplifier::simplifyLdClsPropAddr(IRInstruction* inst) { cls, propName, cns(clsNameStr), - inst->getSrc(2)); + inst->src(2)); } return nullptr; @@ -1437,12 +1437,12 @@ SSATmp* Simplifier::simplifyLdClsPropAddr(IRInstruction* inst) { * calls that will have that.) */ SSATmp* Simplifier::simplifyLdThis(IRInstruction* inst) { - auto fpInst = inst->getSrc(0)->inst(); + auto fpInst = inst->src(0)->inst(); if (fpInst->op() == DefInlineFP) { - auto spInst = fpInst->getSrc(0)->inst(); + auto spInst = fpInst->src(0)->inst(); if (spInst->op() == SpillFrame && - spInst->getSrc(3)->isA(Type::Obj)) { - return spInst->getSrc(3); + spInst->src(3)->isA(Type::Obj)) { + return spInst->src(3); } return nullptr; } @@ -1451,7 +1451,7 @@ SSATmp* Simplifier::simplifyLdThis(IRInstruction* inst) { } SSATmp* Simplifier::simplifyUnbox(IRInstruction* inst) { - auto* src = inst->getSrc(0); + auto* src = inst->src(0); auto type = outputType(inst); Type srcType = src->type(); @@ -1468,15 +1468,15 @@ SSATmp* Simplifier::simplifyUnbox(IRInstruction* inst) { } SSATmp* Simplifier::simplifyUnboxPtr(IRInstruction* inst) { - if (inst->getSrc(0)->isA(Type::PtrToCell)) { + if (inst->src(0)->isA(Type::PtrToCell)) { // Nothing to unbox - return inst->getSrc(0); + return inst->src(0); } return nullptr; } SSATmp* Simplifier::simplifyCheckInit(IRInstruction* inst) { - Type srcType = inst->getSrc(0)->type(); + Type srcType = inst->src(0)->type(); srcType = inst->op() == CheckInitMem ? srcType.deref() : srcType; assert(srcType.notPtr()); assert(inst->getTaken()); @@ -1487,21 +1487,21 @@ SSATmp* Simplifier::simplifyCheckInit(IRInstruction* inst) { } SSATmp* Simplifier::simplifyPrint(IRInstruction* inst) { - if (inst->getSrc(0)->type().isNull()) { + if (inst->src(0)->type().isNull()) { inst->convertToNop(); } return nullptr; } SSATmp* Simplifier::simplifyDecRef(IRInstruction* inst) { - if (!isRefCounted(inst->getSrc(0))) { + if (!isRefCounted(inst->src(0))) { inst->convertToNop(); } return nullptr; } SSATmp* Simplifier::simplifyIncRef(IRInstruction* inst) { - SSATmp* src = inst->getSrc(0); + SSATmp* src = inst->src(0); if (!isRefCounted(src)) { return src; } @@ -1509,7 +1509,7 @@ SSATmp* Simplifier::simplifyIncRef(IRInstruction* inst) { } SSATmp* Simplifier::simplifyCondJmp(IRInstruction* inst) { - SSATmp* const src = inst->getSrc(0); + SSATmp* const src = inst->src(0); IRInstruction* const srcInst = src->inst(); const Opcode srcOpcode = srcInst->op(); @@ -1536,7 +1536,7 @@ SSATmp* Simplifier::simplifyCondJmp(IRInstruction* inst) { if (src->inst()->op() == OpNot) { return gen(inst->op() == JmpZero ? JmpNZero : JmpZero, inst->getTaken(), - srcInst->getSrc(0)); + srcInst->src(0)); } /* @@ -1545,19 +1545,19 @@ SSATmp* Simplifier::simplifyCondJmp(IRInstruction* inst) { * are refcounted, since we may have dec refs between the src * instruction and the jump. */ - for (auto& src : srcInst->getSrcs()) { + for (auto& src : srcInst->srcs()) { if (isRefCounted(src)) return nullptr; } // If the source is conversion of an int or pointer to boolean, we // can test the int/ptr value directly. if (isConvIntOrPtrToBool(srcInst)) { - return gen(inst->op(), inst->getTaken(), srcInst->getSrc(0)); + return gen(inst->op(), inst->getTaken(), srcInst->src(0)); } // Fuse jumps with query operators. if (isQueryOp(srcOpcode)) { - SrcRange ssas = srcInst->getSrcs(); + SrcRange ssas = srcInst->srcs(); return gen( queryToJmpOp( inst->op() == JmpZero @@ -1573,7 +1573,7 @@ SSATmp* Simplifier::simplifyCondJmp(IRInstruction* inst) { } SSATmp* Simplifier::simplifyCastStk(IRInstruction* inst) { - auto const info = getStackValue(inst->getSrc(0), + auto const info = getStackValue(inst->src(0), inst->getExtra()->offset); if (info.knownType.subtypeOf(inst->getTypeParam())) { // No need to cast---the type was as good or better. @@ -1583,7 +1583,7 @@ SSATmp* Simplifier::simplifyCastStk(IRInstruction* inst) { } SSATmp* Simplifier::simplifyAssertStk(IRInstruction* inst) { - auto const info = getStackValue(inst->getSrc(0), + auto const info = getStackValue(inst->src(0), inst->getExtra()->offset); // AssertStk indicated that we knew the type from static analysis, @@ -1597,7 +1597,7 @@ SSATmp* Simplifier::simplifyAssertStk(IRInstruction* inst) { } SSATmp* Simplifier::simplifyLdStack(IRInstruction* inst) { - auto const info = getStackValue(inst->getSrc(0), + auto const info = getStackValue(inst->src(0), inst->getExtra()->offset); // We don't want to extend live ranges of tmps across calls, so we @@ -1632,8 +1632,8 @@ SSATmp* Simplifier::simplifyLdLoc(IRInstruction* inst) { // Replace StRef with StRefNT when we know we aren't going to change // its m_type field. SSATmp* Simplifier::simplifyStRef(IRInstruction* inst) { - auto const oldUnbox = inst->getSrc(0)->type().unbox(); - auto const newType = inst->getSrc(1)->type(); + auto const oldUnbox = inst->src(0)->type().unbox(); + auto const newType = inst->src(1)->type(); if (oldUnbox.isKnownDataType() && oldUnbox.equals(newType) && !oldUnbox.isString()) { inst->setOpcode(StRefNT); @@ -1642,7 +1642,7 @@ SSATmp* Simplifier::simplifyStRef(IRInstruction* inst) { } SSATmp* Simplifier::simplifyLdStackAddr(IRInstruction* inst) { - auto const info = getStackValue(inst->getSrc(0), + auto const info = getStackValue(inst->src(0), inst->getExtra()->offset); if (!info.knownType.equals(Type::None)) { inst->setTypeParam( @@ -1657,7 +1657,7 @@ SSATmp* Simplifier::simplifyDecRefStack(IRInstruction* inst) { inst->convertToNop(); return nullptr; } - auto const info = getStackValue(inst->getSrc(0), + auto const info = getStackValue(inst->src(0), inst->getExtra()->offset); if (info.value && !info.spansCall) { inst->convertToNop(); diff --git a/hphp/runtime/vm/translator/hopt/ssatmp.h b/hphp/runtime/vm/translator/hopt/ssatmp.h index 0b1c26387..8270edd06 100644 --- a/hphp/runtime/vm/translator/hopt/ssatmp.h +++ b/hphp/runtime/vm/translator/hopt/ssatmp.h @@ -23,7 +23,7 @@ namespace HPHP { namespace JIT { class SSATmp { public: - uint32_t getId() const { return m_id; } + uint32_t id() const { return m_id; } IRInstruction* inst() const { return m_inst; } void setInstruction(IRInstruction* i) { m_inst = i; } Type type() const { return m_type; } diff --git a/hphp/runtime/vm/translator/hopt/state_vector.h b/hphp/runtime/vm/translator/hopt/state_vector.h index 011675a8e..d4f43cf2b 100644 --- a/hphp/runtime/vm/translator/hopt/state_vector.h +++ b/hphp/runtime/vm/translator/hopt/state_vector.h @@ -28,7 +28,7 @@ namespace HPHP { namespace JIT { /* * Utility to keep a vector of state about each key, indexed by - * key->getId(), where key can be an IRInstruction, Block, or SSATmp. + * key->id(), where key can be an IRInstruction, Block, or SSATmp. * * Takes an `init' element, which everything is defaulted to. Calls * to reset() restore all entries to this state. @@ -61,7 +61,7 @@ struct StateVector { reference operator[](const Key& k) { return (*this)[&k]; } reference operator[](const Key* k) { - auto id = k->getId(); + auto id = k->id(); if (id >= m_info.size()) grow(); assert(id < m_info.size()); return m_info[id]; @@ -69,8 +69,8 @@ struct StateVector { const_reference operator[](const Key& k) const { return (*this)[&k]; } const_reference operator[](const Key* k) const { - assert(k->getId() < numIds(m_factory, (Key*)nullptr)); - auto id = k->getId(); + assert(k->id() < numIds(m_factory, (Key*)nullptr)); + auto id = k->id(); return id < m_info.size() ? m_info[id] : m_init; } diff --git a/hphp/runtime/vm/translator/hopt/tracebuilder.cpp b/hphp/runtime/vm/translator/hopt/tracebuilder.cpp index d8de4ec5f..bba89a532 100644 --- a/hphp/runtime/vm/translator/hopt/tracebuilder.cpp +++ b/hphp/runtime/vm/translator/hopt/tracebuilder.cpp @@ -106,9 +106,9 @@ SSATmp* TraceBuilder::genDefNone() { void TraceBuilder::trackDefInlineFP(IRInstruction* inst) { auto const target = inst->getExtra()->target; auto const savedSPOff = inst->getExtra()->retSPOff; - auto const calleeFP = inst->getDst(); - auto const calleeSP = inst->getSrc(0); - auto const savedSP = inst->getSrc(1); + auto const calleeFP = inst->dst(); + auto const calleeSP = inst->src(0); + auto const savedSP = inst->src(1); // Saved tracebuilder state will include the "return" fp/sp. // Whatever the current fpValue is is good enough, but we have to be @@ -176,7 +176,7 @@ void TraceBuilder::updateTrackedState(IRInstruction* inst) { break; case Call: - m_spValue = inst->getDst(); + m_spValue = inst->dst(); // A call pops the ActRec and pushes a return value. m_spOffset -= kNumActRecCells; m_spOffset += 1; @@ -186,7 +186,7 @@ void TraceBuilder::updateTrackedState(IRInstruction* inst) { break; case CallArray: - m_spValue = inst->getDst(); + m_spValue = inst->dst(); // A CallArray pops the ActRec an array arg and pushes a return value. m_spOffset -= kNumActRecCells; assert(m_spOffset >= 0); @@ -201,13 +201,13 @@ void TraceBuilder::updateTrackedState(IRInstruction* inst) { case DefFP: case FreeActRec: - m_fpValue = inst->getDst(); + m_fpValue = inst->dst(); break; case ReDefGeneratorSP: case DefSP: case ReDefSP: - m_spValue = inst->getDst(); + m_spValue = inst->dst(); m_spOffset = inst->getExtra()->offset; break; @@ -216,26 +216,26 @@ void TraceBuilder::updateTrackedState(IRInstruction* inst) { case CheckStk: case GuardStk: case ExceptionBarrier: - m_spValue = inst->getDst(); + m_spValue = inst->dst(); break; case SpillStack: { - m_spValue = inst->getDst(); + m_spValue = inst->dst(); // Push the spilled values but adjust for the popped values - int64_t stackAdjustment = inst->getSrc(1)->getValInt(); + int64_t stackAdjustment = inst->src(1)->getValInt(); m_spOffset -= stackAdjustment; m_spOffset += spillValueCells(inst); break; } case SpillFrame: - m_spValue = inst->getDst(); + m_spValue = inst->dst(); m_spOffset += kNumActRecCells; break; case InterpOne: { - m_spValue = inst->getDst(); - int64_t stackAdjustment = inst->getSrc(3)->getValInt(); + m_spValue = inst->dst(); + int64_t stackAdjustment = inst->src(3)->getValInt(); // push the return value if any and adjust for the popped values m_spOffset -= stackAdjustment; break; @@ -246,20 +246,20 @@ void TraceBuilder::updateTrackedState(IRInstruction* inst) { // fall through to StMem; stored value is the same arg number (2) case StMem: case StMemNT: - m_refCountedMemValue = inst->getSrc(2); + m_refCountedMemValue = inst->src(2); break; case LdMem: case LdProp: case LdRef: - m_refCountedMemValue = inst->getDst(); + m_refCountedMemValue = inst->dst(); break; case StRefNT: case StRef: { - m_refCountedMemValue = inst->getSrc(2); - SSATmp* newRef = inst->getDst(); - SSATmp* prevRef = inst->getSrc(0); + m_refCountedMemValue = inst->src(2); + SSATmp* newRef = inst->dst(); + SSATmp* prevRef = inst->src(0); // update other tracked locals that also contain prevRef updateLocalRefValues(prevRef, newRef); break; @@ -268,11 +268,11 @@ void TraceBuilder::updateTrackedState(IRInstruction* inst) { case StLocNT: case StLoc: setLocalValue(inst->getExtra()->locId, - inst->getSrc(1)); + inst->src(1)); break; case LdLoc: - setLocalValue(inst->getExtra()->locId, inst->getDst()); + setLocalValue(inst->getExtra()->locId, inst->dst()); break; case OverrideLoc: @@ -290,24 +290,24 @@ void TraceBuilder::updateTrackedState(IRInstruction* inst) { case IterInitK: // kill the locals to which this instruction stores iter's key and value - killLocalValue(inst->getSrc(3)->getValInt()); - killLocalValue(inst->getSrc(4)->getValInt()); + killLocalValue(inst->src(3)->getValInt()); + killLocalValue(inst->src(4)->getValInt()); break; case IterInit: // kill the local to which this instruction stores iter's value - killLocalValue(inst->getSrc(3)->getValInt()); + killLocalValue(inst->src(3)->getValInt()); break; case IterNextK: // kill the locals to which this instruction stores iter's key and value - killLocalValue(inst->getSrc(2)->getValInt()); - killLocalValue(inst->getSrc(3)->getValInt()); + killLocalValue(inst->src(2)->getValInt()); + killLocalValue(inst->src(3)->getValInt()); break; case IterNext: // kill the local to which this instruction stores iter's value - killLocalValue(inst->getSrc(2)->getValInt()); + killLocalValue(inst->src(2)->getValInt()); break; case LdThis: @@ -340,9 +340,9 @@ void TraceBuilder::updateTrackedState(IRInstruction* inst) { // if the instruction kills any of its sources, remove them from the // CSE table if (inst->killsSources()) { - for (int i = 0; i < inst->getNumSrcs(); ++i) { + for (int i = 0; i < inst->numSrcs(); ++i) { if (inst->killsSource(i)) { - cseKill(inst->getSrc(i)); + cseKill(inst->src(i)); } } } @@ -520,7 +520,7 @@ CSEHash* TraceBuilder::getCSEHashTable(IRInstruction* inst) { } void TraceBuilder::cseInsert(IRInstruction* inst) { - getCSEHashTable(inst)->insert(inst->getDst()); + getCSEHashTable(inst)->insert(inst->dst()); } void TraceBuilder::cseKill(SSATmp* src) { @@ -592,9 +592,9 @@ SSATmp* TraceBuilder::preOptimizeDecRef(IRInstruction* inst) { * available. I.e. by the time they get to the DecRef we won't see * it in isValueAvailable anymore and won't convert to DecRefNZ. */ - auto const srcInst = inst->getSrc(0)->inst(); + auto const srcInst = inst->src(0)->inst(); if (srcInst->op() == IncRef) { - if (isValueAvailable(srcInst->getSrc(0))) { + if (isValueAvailable(srcInst->src(0))) { inst->setOpcode(DecRefNZ); } } @@ -621,13 +621,13 @@ SSATmp* TraceBuilder::preOptimizeDecRefThis(IRInstruction* inst) { * frame, so debug_backtrace() can't see a non-live pointer value. */ if (thisInst->op() == IncRef && - callerHasValueAvailable(thisInst->getSrc(0))) { + callerHasValueAvailable(thisInst->src(0))) { gen(DecRefNZ, thiss); inst->convertToNop(); return nullptr; } - assert(inst->getSrc(0) == m_fpValue); + assert(inst->src(0) == m_fpValue); gen(DecRef, thiss); inst->convertToNop(); return nullptr; @@ -693,7 +693,7 @@ SSATmp* TraceBuilder::preOptimizeLdLocAddr(IRInstruction* inst) { SSATmp* TraceBuilder::preOptimizeStLoc(IRInstruction* inst) { auto const curType = getLocalType(inst->getExtra()->locId); - auto const newType = inst->getSrc(1)->type(); + auto const newType = inst->src(1)->type(); assert(inst->getTypeParam().equals(Type::None)); @@ -789,7 +789,7 @@ SSATmp* TraceBuilder::optimizeInst(IRInstruction* inst) { appendInstruction(inst); // returns nullptr if instruction has no dest, returns the first // (possibly only) dest otherwise - return inst->getDst(0); + return inst->dst(0); } return nullptr; } @@ -850,7 +850,7 @@ void TraceBuilder::reoptimize() { Block* block = blocks.front(); blocks.pop_front(); assert(block->getTrace() == m_trace.get()); - FTRACE(5, "Block: {}\n", block->getId()); + FTRACE(5, "Block: {}\n", block->id()); m_trace->push_back(block); if (m_snapshots[block]) { @@ -871,7 +871,7 @@ void TraceBuilder::reoptimize() { updateTrackedState(inst); continue; } - SSATmp* dst = inst->getDst(); + SSATmp* dst = inst->dst(); if (dst->type() != Type::None && dst != tmp) { // The result of optimization has a different destination than the inst. // Generate a mov(tmp->dst) to get result into dst. If we get here then @@ -990,7 +990,7 @@ void TraceBuilder::killLocals() { // make the new DefConst instruction IRInstruction* clone = t->inst()->clone(&m_irFactory); clone->setOpcode(DefConst); - m_localValues[i] = clone->getDst(); + m_localValues[i] = clone->dst(); continue; } assert(!t->isConst()); diff --git a/hphp/runtime/vm/translator/hopt/tracebuilder.h b/hphp/runtime/vm/translator/hopt/tracebuilder.h index 482569c37..0f42b7e49 100644 --- a/hphp/runtime/vm/translator/hopt/tracebuilder.h +++ b/hphp/runtime/vm/translator/hopt/tracebuilder.h @@ -142,7 +142,7 @@ struct TraceBuilder { SSATmp* genFor(Trace* t, Args... args) { auto instr = m_irFactory.gen(args...); t->back()->push_back(instr); - return instr->getDst(); + return instr->dst(); } ////////////////////////////////////////////////////////////////////// @@ -200,7 +200,7 @@ struct TraceBuilder { SSATmp* v2 = taken(); gen(Jmp_, done_block, v2); appendBlock(done_block); - SSATmp* result = done_block->getLabel()->getDst(0); + SSATmp* result = done_block->getLabel()->dst(0); result->setType(Type::unionOf(v1->type(), v2->type())); return result; } diff --git a/hphp/runtime/vm/translator/hopt/type.cpp b/hphp/runtime/vm/translator/hopt/type.cpp index dc94615e7..c5460809d 100644 --- a/hphp/runtime/vm/translator/hopt/type.cpp +++ b/hphp/runtime/vm/translator/hopt/type.cpp @@ -62,7 +62,7 @@ Type builtinReturn(const IRInstruction* inst) { } Type boxReturn(const IRInstruction* inst, int srcId) { - auto t = inst->getSrc(srcId)->type(); + auto t = inst->src(srcId)->type(); // If t contains Uninit, replace it with InitNull. t = t.maybe(Type::Uninit) ? (t - Type::Uninit) | Type::InitNull : t; // We don't try to track when a BoxedStaticStr might be converted to @@ -109,8 +109,8 @@ Type binArithResultType(Opcode op, Type t1, Type t2) { Type outputType(const IRInstruction* inst, int dstId) { #define D(type) return Type::type; -#define DofS(n) return inst->getSrc(n)->type(); -#define DUnbox(n) return inst->getSrc(n)->type().unbox(); +#define DofS(n) return inst->src(n)->type(); +#define DUnbox(n) return inst->src(n)->type().unbox(); #define DBox(n) return boxReturn(inst, n); #define DParam return inst->getTypeParam(); #define DMulti return Type::None; @@ -120,8 +120,8 @@ Type outputType(const IRInstruction* inst, int dstId) { #define ND assert(0 && "outputType requires HasDest or NaryDest"); #define DBuiltin return builtinReturn(inst); #define DArith return binArithResultType(inst->op(), \ - inst->getSrc(0)->type(), \ - inst->getSrc(1)->type()); + inst->src(0)->type(), \ + inst->src(1)->type()); #define O(name, dstinfo, srcinfo, flags) case name: dstinfo not_reached(); @@ -186,9 +186,9 @@ void assertOperandTypes(const IRInstruction* inst) { always_assert(false && "instruction operand type check failure"); }; - auto getSrc = [&]() -> SSATmp* { - if (curSrc < inst->getNumSrcs()) { - return inst->getSrc(curSrc); + auto src = [&]() -> SSATmp* { + if (curSrc < inst->numSrcs()) { + return inst->src(curSrc); } bail(folly::format( @@ -211,13 +211,13 @@ void assertOperandTypes(const IRInstruction* inst) { curSrc, inst->toString(), expected, - inst->getSrc(curSrc)->type().toString() + inst->src(curSrc)->type().toString() ).str() ); }; auto checkNoArgs = [&]{ - if (inst->getNumSrcs() == 0) return; + if (inst->numSrcs() == 0) return; bail(folly::format( "Error: instruction expected no operands\n" " instruction: {}\n", @@ -227,7 +227,7 @@ void assertOperandTypes(const IRInstruction* inst) { }; auto countCheck = [&]{ - if (inst->getNumSrcs() == curSrc) return; + if (inst->numSrcs() == curSrc) return; bail(folly::format( "Error: instruction had too many operands\n" " instruction: {}\n" @@ -249,10 +249,10 @@ void assertOperandTypes(const IRInstruction* inst) { }; auto checkSpills = [&] { - for (; curSrc < inst->getNumSrcs(); ++curSrc) { + for (; curSrc < inst->numSrcs(); ++curSrc) { // SpillStack slots may be stack types or None, if the // simplifier removed some. - auto const valid = inst->getSrc(curSrc)->type() + auto const valid = inst->src(curSrc)->type() .subtypeOfAny(Type::Gen, Type::Cls, Type::None); check(valid, "Gen|Cls|None"); } @@ -265,11 +265,11 @@ void assertOperandTypes(const IRInstruction* inst) { #define NA return checkNoArgs(); #define S(...) { \ Type t = buildUnion(__VA_ARGS__); \ - check(getSrc()->isA(t), t.toString()); \ + check(src()->isA(t), t.toString()); \ ++curSrc; \ } -#define C(type) check(getSrc()->isConst() && \ - getSrc()->isA(type), \ +#define C(type) check(src()->isConst() && \ + src()->isA(type), \ "constant " #type); \ ++curSrc; #define CStr C(StaticStr) @@ -283,11 +283,11 @@ void assertOperandTypes(const IRInstruction* inst) { #define DVector #define D(...) #define DBuiltin -#define DUnbox(src) checkDst(src < inst->getNumSrcs(), \ +#define DUnbox(src) checkDst(src < inst->numSrcs(), \ "invalid src num"); -#define DBox(src) checkDst(src < inst->getNumSrcs(), \ +#define DBox(src) checkDst(src < inst->numSrcs(), \ "invalid src num"); -#define DofS(src) checkDst(src < inst->getNumSrcs(), \ +#define DofS(src) checkDst(src < inst->numSrcs(), \ "invalid src num"); #define DParam checkDst(inst->getTypeParam() != Type::None || \ inst->op() == DefConst /* for DefNone */, \ diff --git a/hphp/runtime/vm/translator/hopt/vectortranslator.cpp b/hphp/runtime/vm/translator/hopt/vectortranslator.cpp index a3c368143..3856aa9b1 100644 --- a/hphp/runtime/vm/translator/hopt/vectortranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/vectortranslator.cpp @@ -48,10 +48,10 @@ void VectorEffects::get(const IRInstruction* inst, SetLocTypeFunc setLocalType) { // If the base for this instruction is a local address, the // helper call might have side effects on the local's value - SSATmp* base = inst->getSrc(vectorBaseIdx(inst)); + SSATmp* base = inst->src(vectorBaseIdx(inst)); IRInstruction* locInstr = base->inst(); if (locInstr->op() == LdLocAddr) { - UNUSED Type baseType = locInstr->getDst()->type(); + UNUSED Type baseType = locInstr->dst()->type(); assert(baseType.equals(base->type())); assert(baseType.isPtr() || baseType.isKnownDataType()); int loc = locInstr->getExtra()->locId; @@ -94,9 +94,9 @@ VectorEffects::VectorEffects(const IRInstruction* inst) { int keyIdx = vectorKeyIdx(inst); int valIdx = vectorValIdx(inst); init(inst->op(), - inst->getSrc(vectorBaseIdx(inst))->type(), - keyIdx == -1 ? Type::None : inst->getSrc(keyIdx)->type(), - valIdx == -1 ? Type::None : inst->getSrc(valIdx)->type()); + inst->src(vectorBaseIdx(inst))->type(), + keyIdx == -1 ? Type::None : inst->src(keyIdx)->type(), + valIdx == -1 ? Type::None : inst->src(valIdx)->type()); } VectorEffects::VectorEffects(Opcode op, Type base, Type key, Type val) { @@ -2068,8 +2068,8 @@ bool HhbcTranslator::VectorTranslator::usePredictedResult() { // where the result of a SetM might have the same type as its input without // being the same value. IRInstruction* inst = m_result->inst(); - SSATmp* base = inst->getSrc(vectorBaseIdx(inst)); - SSATmp* value = inst->getSrc(vectorValIdx(inst)); + SSATmp* base = inst->src(vectorBaseIdx(inst)); + SSATmp* value = inst->src(vectorValIdx(inst)); return base->type().strip().not(Type::Str) || value->type().strip().not(Type::Str); }