本文整理汇总了C++中AnalysisResultPtr::incOptCounter方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalysisResultPtr::incOptCounter方法的具体用法?C++ AnalysisResultPtr::incOptCounter怎么用?C++ AnalysisResultPtr::incOptCounter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnalysisResultPtr
的用法示例。
在下文中一共展示了AnalysisResultPtr::incOptCounter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: optimize
void ExpressionList::optimize(AnalysisResultPtr ar) {
bool changed = false;
size_t i = m_exps.size();
if (m_kind != ListKindParam) {
size_t skip = m_kind == ListKindLeft ? 0 : i - 1;
while (i--) {
if (i != skip) {
ExpressionPtr &e = m_exps[i];
if (!e || e->getContainedEffects() == NoEffect) {
removeElement(i);
changed = true;
} else if (e->is(KindOfExpressionList)) {
ExpressionListPtr el(static_pointer_cast<ExpressionList>(e));
removeElement(i);
for (size_t j = el->getCount(); j--; ) {
insertElement((*el)[j], i);
}
changed = true;
} else if (e->getLocalEffects() == NoEffect) {
e = e->unneeded(ar);
// changed already handled by unneeded
}
}
}
if (m_exps.size() == 1) {
m_kind = ListKindWrapped;
} else if (m_kind == ListKindLeft && m_exps[0]->isScalar()) {
ExpressionPtr e = m_exps[0];
removeElement(0);
addElement(e);
m_kind = ListKindWrapped;
}
} else {
if (hasContext(UnsetContext) &&
ar->getPhase() >= AnalysisResult::PostOptimize) {
while (i--) {
ExpressionPtr &e = m_exps[i];
if (e->is(Expression::KindOfSimpleVariable)) {
SimpleVariablePtr var = dynamic_pointer_cast<SimpleVariable>(e);
if (var->checkUnused(ar)) {
const std::string &name = var->getName();
VariableTablePtr variables = getScope()->getVariables();
if (!variables->isNeeded(name)) {
removeElement(i);
changed = true;
}
}
}
}
}
}
if (changed) {
ar->incOptCounter();
}
}
示例2: optimize
bool ExpressionList::optimize(AnalysisResultPtr ar) {
bool changed = false;
size_t i = m_exps.size();
if (m_kind != ListKindParam) {
if (i--) {
while (i--) {
ExpressionPtr &e = m_exps[i];
if (!e || e->getContainedEffects() == NoEffect) {
ar->incOptCounter();
removeElement(i);
changed = true;
} else if (e->getLocalEffects() == NoEffect) {
e = e->unneeded(ar);
changed = true;
}
}
}
return changed;
}
if (hasContext(UnsetContext) &&
ar->getPhase() >= AnalysisResult::PostOptimize) {
while (i--) {
ExpressionPtr &e = m_exps[i];
if (e->is(Expression::KindOfSimpleVariable)) {
SimpleVariablePtr var = dynamic_pointer_cast<SimpleVariable>(e);
const std::string &name = var->getName();
VariableTablePtr variables = ar->getScope()->getVariables();
if (variables->checkUnused(name)) {
removeElement(i);
changed = true;
}
}
}
}
return changed;
}