本文整理汇总了C++中AnalysisResultPtr::postOptimize方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalysisResultPtr::postOptimize方法的具体用法?C++ AnalysisResultPtr::postOptimize怎么用?C++ AnalysisResultPtr::postOptimize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnalysisResultPtr
的用法示例。
在下文中一共展示了AnalysisResultPtr::postOptimize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: postOptimize
ExpressionPtr FunctionCall::postOptimize(AnalysisResultPtr ar) {
if (m_class) ar->postOptimize(m_class);
ar->postOptimize(m_nameExp);
ar->postOptimize(m_params);
optimizeArgArray(ar);
return ExpressionPtr();
}
示例2: postOptimize
StatementPtr ForEachStatement::postOptimize(AnalysisResultPtr ar) {
ar->postOptimize(m_array);
ar->postOptimize(m_name);
ar->postOptimize(m_value);
ar->postOptimize(m_stmt);
return StatementPtr();
}
示例3: postOptimize
StatementPtr WhileStatement::postOptimize(AnalysisResultPtr ar) {
ar->postOptimize(m_condition);
if (m_stmt) {
ar->getScope()->incLoopNestedLevel();
ar->postOptimize(m_stmt);
ar->getScope()->decLoopNestedLevel();
}
return StatementPtr();
}
示例4: postOptimize
StatementPtr InterfaceStatement::postOptimize(AnalysisResultPtr ar) {
ar->postOptimize(m_base);
if (m_stmt) {
ClassScopePtr classScope = m_classScope.lock();
ar->pushScope(classScope);
ar->postOptimize(m_stmt);
ar->popScope();
}
return StatementPtr();
}
示例5: postOptimize
StatementPtr ForStatement::postOptimize(AnalysisResultPtr ar) {
ar->postOptimize(m_exp1);
ar->postOptimize(m_exp2);
ar->postOptimize(m_exp3);
if (m_stmt) {
ar->getScope()->incLoopNestedLevel();
ar->postOptimize(m_stmt);
ar->getScope()->decLoopNestedLevel();
}
return StatementPtr();
}
示例6: postOptimize
ExpressionPtr UnaryOpExpression::postOptimize(AnalysisResultPtr ar) {
bool insideScalarArray = ar->getInsideScalarArray();
if (m_op == T_ARRAY &&
(getContext() & (RefValue|LValue)) == 0) {
if (m_exp) {
ExpressionListPtr pairs = dynamic_pointer_cast<ExpressionList>(m_exp);
if (pairs && pairs->isScalarArrayPairs()) {
m_arrayId = ar->registerScalarArray(m_exp);
ar->setInsideScalarArray(true);
}
} else {
m_arrayId = ar->registerScalarArray(m_exp); // empty array
}
}
ar->postOptimize(m_exp);
if (m_op == T_PRINT && m_exp->is(KindOfEncapsListExpression) &&
!m_exp->hasEffect()) {
EncapsListExpressionPtr e = static_pointer_cast<EncapsListExpression>
(m_exp);
e->stripConcat();
}
ar->setInsideScalarArray(insideScalarArray);
if (m_op == T_UNSET_CAST && !hasEffect()) {
return CONSTANT("null");
} else if (m_op == T_UNSET && m_exp->is(KindOfExpressionList) &&
!static_pointer_cast<ExpressionList>(m_exp)->getCount()) {
return CONSTANT("null");
}
return ExpressionPtr();
}
示例7: postOptimize
ExpressionPtr ExpressionList::postOptimize(AnalysisResultPtr ar) {
for (unsigned int i = 0; i < m_exps.size(); i++) {
ar->postOptimize(m_exps[i]);
}
return optimize(ar) ? static_pointer_cast<Expression>(shared_from_this())
: ExpressionPtr();
}
示例8: postOptimize
ExpressionPtr BinaryOpExpression::postOptimize(AnalysisResultPtr ar) {
ar->postOptimize(m_exp1);
ar->postOptimize(m_exp2);
ExpressionPtr optExp = simplifyArithmetic(ar);
if (optExp) return optExp;
if (isShortCircuitOperator()) return simplifyLogical(ar);
return ExpressionPtr();
}
示例9: postOptimize
ExpressionPtr AssignmentExpression::postOptimize(AnalysisResultPtr ar) {
ar->postOptimize(m_variable);
ar->postOptimize(m_value);
if (m_variable->is(Expression::KindOfSimpleVariable)) {
SimpleVariablePtr var =
dynamic_pointer_cast<SimpleVariable>(m_variable);
const std::string &name = var->getName();
VariableTablePtr variables = ar->getScope()->getVariables();
if (variables->checkUnused(name)) {
variables->addUnused(name);
if (m_value->getContainedEffects() != getContainedEffects()) {
s_effectsTag++;
}
return m_value;
}
}
return ExpressionPtr();
}
示例10: postOptimize
StatementPtr MethodStatement::postOptimize(AnalysisResultPtr ar) {
ar->postOptimize(m_modifiers);
ar->postOptimize(m_params);
FunctionScopePtr funcScope = m_funcScope.lock();
ar->pushScope(funcScope);
if (ar->getPhase() != AnalysisResult::AnalyzeInclude &&
(AliasManager::doLocalCopyProp() ||
AliasManager::doStringOpts())) {
bool flag;
do {
AliasManager am;
MethodStatementPtr self =
static_pointer_cast<MethodStatement>(shared_from_this());
flag = am.optimize(ar, self);
ar->postOptimize(m_stmt);
} while (flag);
} else {
ar->postOptimize(m_stmt);
}
ar->popScope();
return StatementPtr();
}
示例11: postOptimize
ExpressionPtr AssignmentExpression::postOptimize(AnalysisResultPtr ar) {
ar->postOptimize(m_variable);
ar->postOptimize(m_value);
if (m_variable->is(Expression::KindOfSimpleVariable)) {
SimpleVariablePtr var =
dynamic_pointer_cast<SimpleVariable>(m_variable);
const std::string &name = var->getName();
VariableTablePtr variables = ar->getScope()->getVariables();
if (!variables->isPseudoMainTable() &&
!variables->getAttribute(VariableTable::ContainsDynamicVariable) &&
!variables->isReferenced(name) &&
variables->isLocal(name)) {
variables->addUnused(name);
if (m_value->isScalar()) {
m_value->setExpectedType(m_expectedType);
return m_value;
} else {
return makeIdCall(ar);
}
}
}
return ExpressionPtr();
}
示例12: postOptimize
StatementPtr StatementList::postOptimize(AnalysisResultPtr ar) {
bool changed = false;
for (unsigned int i = 0; i < m_stmts.size(); i++) {
StatementPtr &s = m_stmts[i];
ar->postOptimize(s);
if (AliasManager::doDeadCodeElim() &&
s->is(KindOfExpStatement) && !s->hasEffect()) {
removeElement(i--);
changed = true;
continue;
}
}
return changed ? static_pointer_cast<Statement>(shared_from_this())
: StatementPtr();
}
示例13: postOptimize
ExpressionPtr IncludeExpression::postOptimize(AnalysisResultPtr ar) {
ar->postOptimize(m_exp);
if (!m_include.empty()) {
FileScopePtr fs = ar->findFileScope(m_include, false);
if (fs) {
if (!Option::KeepStatementsWithNoEffect && !fs->hasImpl(ar)) {
return ScalarExpressionPtr
(new ScalarExpression(getLocation(),
Expression::KindOfScalarExpression,
1));
}
m_exp.reset();
}
}
return ExpressionPtr();
}
示例14: postOptimize
StatementPtr StatementList::postOptimize(AnalysisResultPtr ar) {
bool changed = false;
for (unsigned int i = 0; i < m_stmts.size(); i++) {
StatementPtr &s = m_stmts[i];
ar->postOptimize(s);
if (s->is(KindOfExpStatement) && !s->hasEffect()) {
if (Option::EliminateDeadCode ||
static_pointer_cast<ExpStatement>(s)->getExpression()->isScalar()) {
removeElement(i--);
changed = true;
continue;
}
}
}
return changed ? static_pointer_cast<Statement>(shared_from_this())
: StatementPtr();
}
示例15: postOptimize
ExpressionPtr UnaryOpExpression::postOptimize(AnalysisResultPtr ar) {
ar->postOptimize(m_exp);
if (m_op == T_PRINT && m_exp->is(KindOfEncapsListExpression) &&
!m_exp->hasEffect()) {
EncapsListExpressionPtr e = static_pointer_cast<EncapsListExpression>
(m_exp);
e->stripConcat();
}
if (m_op == T_UNSET_CAST && !hasEffect()) {
return CONSTANT("null");
} else if (m_op == T_UNSET && m_exp->is(KindOfExpressionList) &&
!static_pointer_cast<ExpressionList>(m_exp)->getCount()) {
return CONSTANT("null");
}
return ExpressionPtr();
}