本文整理汇总了C++中Promise::srcPoolIdx方法的典型用法代码示例。如果您正苦于以下问题:C++ Promise::srcPoolIdx方法的具体用法?C++ Promise::srcPoolIdx怎么用?C++ Promise::srcPoolIdx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Promise
的用法示例。
在下文中一共展示了Promise::srcPoolIdx方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clone
BB* BBTransform::clone(BB* src, Code* target, ClosureVersion* targetClosure) {
std::vector<BB*> bbs;
// Copy instructions and remember old -> new instruction map.
std::unordered_map<Value*, Instruction*> relocation_table;
Visitor::run(src, [&](BB* bb) {
BB* theClone = BB::cloneInstrs(bb, target->nextBBId++, target);
assert(bb->size() == theClone->size());
if (bb->id >= bbs.size())
bbs.resize(bb->id + 5);
bbs[bb->id] = theClone;
for (size_t i = 0; i < bb->size(); ++i)
relocation_table[bb->at(i)] = theClone->at(i);
});
// Fixup CFG: next pointers of copied BB's need to be filled in.
Visitor::run(src, [&](BB* bb) {
bbs[bb->id]->next0 = bbs[bb->id]->next1 = nullptr;
if (bb->next0)
bbs[bb->id]->next0 = bbs[bb->next0->id];
if (bb->next1)
bbs[bb->id]->next1 = bbs[bb->next1->id];
});
std::unordered_map<Promise*, Promise*> promMap;
// Relocate argument pointers using old -> new map
BB* newEntry = bbs[src->id];
Visitor::run(newEntry, [&](Instruction* i) {
auto phi = Phi::Cast(i);
if (phi) {
for (size_t j = 0; j < phi->nargs(); ++j)
phi->updateInputAt(j, bbs[phi->inputAt(j)->id]);
}
i->eachArg([&](InstrArg& arg) {
if (arg.val()->isInstruction()) {
assert(relocation_table.count(arg.val()));
arg.val() = relocation_table.at(arg.val());
}
});
if (auto mk = MkArg::Cast(i)) {
Promise* p = mk->prom();
if (p->owner != targetClosure) {
if (promMap.count(p)) {
mk->updatePromise(promMap.at(p));
} else {
auto c = targetClosure->createProm(p->srcPoolIdx());
c->entry = clone(p->entry, c, targetClosure);
mk->updatePromise(c);
}
}
}
});
return newEntry;
}