本文整理汇总了C++中Vout类的典型用法代码示例。如果您正苦于以下问题:C++ Vout类的具体用法?C++ Vout怎么用?C++ Vout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emitCall
void emitCall(Vout& v, CppCall target, RegSet args) {
switch (target.kind()) {
case CppCall::Kind::Direct:
v << call{static_cast<TCA>(target.address()), args};
return;
case CppCall::Kind::Virtual:
// Virtual call. Load method's address from proper offset off of object in
// rdi, using rax as scratch.
v << load{*reg::rdi, reg::rax};
v << callm{reg::rax[target.vtableOffset()], args};
return;
case CppCall::Kind::ArrayVirt: {
auto const addr = reinterpret_cast<intptr_t>(target.arrayTable());
v << loadzbl{reg::rdi[HeaderKindOffset], reg::eax};
if (deltaFits(addr, sz::dword)) {
v << callm{baseless(reg::rax * 8 + addr), args};
} else {
auto const base = v.makeReg();
v << ldimmq{addr, base};
v << callm{base[reg::rax * 8], args};
}
static_assert(sizeof(HeaderKind) == 1, "");
return;
}
case CppCall::Kind::Destructor:
// this movzbq is only needed because callers aren't required to
// zero-extend the type.
auto zextType = v.makeReg();
v << movzbq{target.reg(), zextType};
auto dtor_ptr = lookupDestructor(v, zextType);
v << callm{dtor_ptr, args};
return;
}
not_reached();
}
示例2:
PhysRegSaverParity::PhysRegSaverParity(int parity, Vout& v,
RegSet regs)
: m_as(nullptr)
, m_v(&v)
, m_regs(regs)
{
auto xmm = regs & x64::kXMMRegs;
auto gpr = regs - xmm;
m_adjust = (parity & 0x1) == (gpr.size() & 0x1) ? 8 : 0;
if (!xmm.empty()) {
v << subqi{16 * xmm.size(), reg::rsp, reg::rsp, v.makeReg()};
int offset = 0;
xmm.forEach([&](PhysReg pr) {
v << storedqu{pr, reg::rsp[offset]};
offset += 16;
});
}
gpr.forEach([&] (PhysReg pr) {
v << push{pr};
});
if (m_adjust) {
// Maintain stack evenness for SIMD compatibility.
v << subqi{m_adjust, reg::rsp, reg::rsp, v.makeReg()};
}
}
示例3: storeTV
void storeTV(Vout& v, Vptr dst, Vloc srcLoc, const SSATmp* src) {
auto const type = src->type();
if (srcLoc.isFullSIMD()) {
// The whole TV is stored in a single SIMD reg.
assertx(RuntimeOption::EvalHHIRAllocSIMDRegs);
v << storeups{srcLoc.reg(), dst};
return;
}
if (type.needsReg()) {
assertx(srcLoc.hasReg(1));
v << storeb{srcLoc.reg(1), dst + TVOFF(m_type)};
} else {
v << storeb{v.cns(type.toDataType()), dst + TVOFF(m_type)};
}
// We ignore the values of statically nullish types.
if (src->isA(TNull) || src->isA(TNullptr)) return;
// Store the value.
if (src->hasConstVal()) {
// Skip potential zero-extend if we know the value.
v << store{v.cns(src->rawVal()), dst + TVOFF(m_data)};
} else {
assertx(srcLoc.hasReg(0));
auto const extended = zeroExtendIfBool(v, src->type(), srcLoc.reg(0));
v << store{extended, dst + TVOFF(m_data)};
}
}
示例4: emitRB
void emitRB(Vout& v, Trace::RingBufferType t, const char* msg) {
if (!Trace::moduleEnabled(Trace::ringbuffer, 1)) {
return;
}
v << vcall{CppCall::direct(Trace::ringbufferMsg),
v.makeVcallArgs({{v.cns(msg), v.cns(strlen(msg)), v.cns(t)}}),
v.makeTuple({})};
}
示例5: check_subcls
Vreg check_subcls(Vout& v, Vreg sf, Vreg d, Vreg lhs, Cls rhs, Len rhsVecLen) {
return cond(v, CC_NB, sf, d,
[&] (Vout& v) {
return check_clsvec(v, v.makeReg(), lhs, rhs, rhsVecLen);
},
[&] (Vout& v) { return v.cns(false); }
);
}
示例6: checkRDSHandleInitialized
Vreg checkRDSHandleInitialized(Vout& v, rds::Handle ch) {
assertx(rds::isNormalHandle(ch));
auto const gen = v.makeReg();
auto const sf = v.makeReg();
v << loadb{rvmtl()[rds::genNumberHandleFrom(ch)], gen};
v << cmpbm{gen, rvmtl()[rds::currentGenNumberHandle()], sf};
return sf;
}
示例7: emitAssertRefCount
void emitAssertRefCount(Vout& v, Vreg base) {
auto const sf = v.makeReg();
v << cmplim{StaticValue, base[FAST_REFCOUNT_OFFSET], sf};
ifThen(v, CC_NLE, sf, [&](Vout& v) {
auto const sf = v.makeReg();
v << cmplim{RefCountMaxRealistic, base[FAST_REFCOUNT_OFFSET], sf};
ifThen(v, CC_NBE, sf, [&](Vout& v) { v << ud2{}; });
});
}
示例8: ifThen
void ifThen(Vout& v, ConditionCode cc, Vreg sf, Then thenBlock) {
auto then = v.makeBlock();
auto done = v.makeBlock();
v << jcc{cc, sf, {done, then}};
v = then;
thenBlock(v);
if (!v.closed()) v << jmp{done};
v = done;
}
示例9: ifZero
void ifZero(Vout& v, unsigned bit, Vreg r, Then thenBlock) {
auto then = v.makeBlock();
auto done = v.makeBlock();
v << tbcc{vixl::eq, bit, r, {done, then}};
v = then;
thenBlock(v);
if (!v.closed()) v << jmp{done};
v = done;
}
示例10: lookupDestructor
Vptr lookupDestructor(Vout& v, Vreg type) {
auto const table = reinterpret_cast<intptr_t>(g_destructors);
always_assert_flog(deltaFits(table, sz::dword),
"Destructor function table is expected to be in the data "
"segment, with addresses less than 2^31"
);
auto index = v.makeReg();
v << shrli{kShiftDataTypeToDestrIndex, type, index, v.makeReg()};
return baseless(index * 8 + safe_cast<int>(table));
}
示例11: cmpLowPtrImpl
void cmpLowPtrImpl(Vout& v, Vreg sf, const void* ptr, Vptr mem, size_t size) {
if (size == 8) {
v << cmpqm{v.cns(ptr), mem, sf};
} else if (size == 4) {
auto const ptrImm = safe_cast<uint32_t>(reinterpret_cast<intptr_t>(ptr));
v << cmplm{v.cns(ptrImm), mem, sf};
} else {
not_implemented();
}
}
示例12: emitCmpClass
void emitCmpClass(Vout& v, Vreg sf, const Class* cls, Vptr mem) {
auto size = sizeof(LowPtr<Class>);
if (size == 8) {
v << cmpqm{v.cns(cls), mem, sf};
} else if (size == 4) {
auto const clsImm = safe_cast<uint32_t>(reinterpret_cast<intptr_t>(cls));
v << cmplm{v.cns(clsImm), mem, sf};
} else {
not_implemented();
}
}
示例13: emitIncRefWork
void emitIncRefWork(Vout& v, Vreg data, Vreg type) {
auto const sf = v.makeReg();
emitCmpTVType(v, sf, KindOfRefCountThreshold, type);
// ifRefCountType
ifThen(v, CC_G, sf, [&] (Vout& v) {
auto const sf2 = v.makeReg();
// ifNonStatic
v << cmplim{0, data[FAST_REFCOUNT_OFFSET], sf2};
ifThen(v, CC_GE, sf2, [&] (Vout& v) { emitIncRef(v, data); });
});
}
示例14: ifThenElse
void ifThenElse(Vout& v, ConditionCode cc, Vreg sf, Then thenBlock,
Else elseBlock) {
auto thenLabel = v.makeBlock();
auto elseLabel = v.makeBlock();
auto done = v.makeBlock();
v << jcc{cc, sf, {elseLabel, thenLabel}};
v = thenLabel;
thenBlock(v);
if (!v.closed()) v << jmp{done};
v = elseLabel;
elseBlock(v);
if (!v.closed()) v << jmp{done};
v = done;
}
示例15: emitDecRefWorkObj
void emitDecRefWorkObj(Vout& v, Vreg obj) {
auto const shouldRelease = v.makeReg();
v << cmplim{1, obj[FAST_REFCOUNT_OFFSET], shouldRelease};
ifThenElse(
v, CC_E, shouldRelease,
[&] (Vout& v) {
// Put fn inside vcall{} triggers a compiler internal error (gcc 4.4.7)
auto const fn = CallSpec::method(&ObjectData::release);
v << vcall{fn, v.makeVcallArgs({{obj}}), v.makeTuple({})};
},
[&] (Vout& v) {
emitDecRef(v, obj);
}
);
}