本文整理汇总了C++中UserList::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ UserList::insert方法的具体用法?C++ UserList::insert怎么用?C++ UserList::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserList
的用法示例。
在下文中一共展示了UserList::insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
/// Analyze the use graph of AllocRef for any uses that would prevent us from
/// zapping it completely.
static bool
hasUnremovableUsers(SILInstruction *AllocRef, UserList &Users,
bool acceptRefCountInsts) {
SmallVector<SILInstruction *, 16> Worklist;
Worklist.push_back(AllocRef);
LLVM_DEBUG(llvm::dbgs() << " Analyzing Use Graph.");
while (!Worklist.empty()) {
SILInstruction *I = Worklist.pop_back_val();
LLVM_DEBUG(llvm::dbgs() << " Visiting: " << *I);
// Insert the instruction into our InvolvedInstructions set. If we have
// already seen it, then don't reprocess all of the uses.
if (!Users.insert(I)) {
LLVM_DEBUG(llvm::dbgs() << " Already seen skipping...\n");
continue;
}
// If we can't zap this instruction... bail...
if (!canZapInstruction(I, acceptRefCountInsts)) {
LLVM_DEBUG(llvm::dbgs() << " Found instruction we can't zap...\n");
return true;
}
// At this point, we can remove the instruction as long as all of its users
// can be removed as well. Scan its users and add them to the worklist for
// recursive processing.
for (auto result : I->getResults()) {
for (auto *Op : result->getUses()) {
auto *User = Op->getUser();
// Make sure that we are only storing into our users, not storing our
// users which would be an escape.
if (auto *SI = dyn_cast<StoreInst>(User))
if (Op->get() == SI->getSrc()) {
LLVM_DEBUG(llvm::dbgs() << " Found store of pointer. "
"Failure: "
<< *SI);
return true;
}
// Otherwise, add normal instructions to the worklist for processing.
Worklist.push_back(User);
}
}
}
return false;
}