当前位置: 首页>>代码示例>>C++>>正文


C++ AnalysisResultPtr::postOptimize方法代码示例

本文整理汇总了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();
}
开发者ID:sumitk,项目名称:hiphop-php,代码行数:7,代码来源:function_call.cpp

示例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();
}
开发者ID:Bittarman,项目名称:hiphop-php,代码行数:7,代码来源:foreach_statement.cpp

示例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();
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:9,代码来源:while_statement.cpp

示例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();
}
开发者ID:edv4rd0,项目名称:hiphop-php,代码行数:10,代码来源:interface_statement.cpp

示例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();
}
开发者ID:Bittarman,项目名称:hiphop-php,代码行数:11,代码来源:for_statement.cpp

示例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();
}
开发者ID:kreshano,项目名称:hiphop-php,代码行数:35,代码来源:unary_op_expression.cpp

示例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();
}
开发者ID:yigithub,项目名称:hiphop-php,代码行数:7,代码来源:expression_list.cpp

示例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();
}
开发者ID:Bittarman,项目名称:hiphop-php,代码行数:8,代码来源:binary_op_expression.cpp

示例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();
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:18,代码来源:assignment_expression.cpp

示例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();
}
开发者ID:yigithub,项目名称:hiphop-php,代码行数:22,代码来源:method_statement.cpp

示例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();
}
开发者ID:Neomeng,项目名称:hiphop-php,代码行数:23,代码来源:assignment_expression.cpp

示例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();
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:15,代码来源:statement_list.cpp

示例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();
}
开发者ID:edv4rd0,项目名称:hiphop-php,代码行数:16,代码来源:include_expression.cpp

示例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();
}
开发者ID:Bittarman,项目名称:hiphop-php,代码行数:17,代码来源:statement_list.cpp

示例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();
}
开发者ID:mukulu,项目名称:hiphop-php,代码行数:18,代码来源:unary_op_expression.cpp


注:本文中的AnalysisResultPtr::postOptimize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。