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


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

本文整理汇总了C++中AnalysisResultPtr::preOptimize方法的典型用法代码示例。如果您正苦于以下问题:C++ AnalysisResultPtr::preOptimize方法的具体用法?C++ AnalysisResultPtr::preOptimize怎么用?C++ AnalysisResultPtr::preOptimize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AnalysisResultPtr的用法示例。


在下文中一共展示了AnalysisResultPtr::preOptimize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: preOptimize

StatementPtr ForEachStatement::preOptimize(AnalysisResultPtr ar) {
  ar->preOptimize(m_array);
  ar->preOptimize(m_name);
  ar->preOptimize(m_value);
  ar->preOptimize(m_stmt);
  return StatementPtr();
}
开发者ID:Bittarman,项目名称:hiphop-php,代码行数:7,代码来源:foreach_statement.cpp

示例2: preOptimize

ExpressionPtr FunctionCall::preOptimize(AnalysisResultPtr ar) {
    if (m_class) {
        ar->preOptimize(m_class);
        updateClassName();
    }
    ar->preOptimize(m_nameExp);
    ar->preOptimize(m_params);
    return ExpressionPtr();
}
开发者ID:kreshano,项目名称:hiphop-php,代码行数:9,代码来源:function_call.cpp

示例3: preOptimize

StatementPtr WhileStatement::preOptimize(AnalysisResultPtr ar) {
  ar->preOptimize(m_condition);
  if (m_stmt) {
    ar->getScope()->incLoopNestedLevel();
    ar->preOptimize(m_stmt);
    ar->getScope()->decLoopNestedLevel();
  }
  return StatementPtr();
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:9,代码来源:while_statement.cpp

示例4: preOptimize

ExpressionPtr AssignmentExpression::preOptimize(AnalysisResultPtr ar) {
  ar->preOptimize(m_variable);
  ar->preOptimize(m_value);
  if (Option::EliminateDeadCode &&
      ar->getPhase() >= AnalysisResult::FirstPreOptimize) {
    // otherwise used & needed flags may not be up to date yet
    return optimize(ar);
  }
  return ExpressionPtr();
}
开发者ID:mukulu,项目名称:hiphop-php,代码行数:10,代码来源:assignment_expression.cpp

示例5: preOptimize

StatementPtr ForStatement::preOptimize(AnalysisResultPtr ar) {
  ar->preOptimize(m_exp1);
  ar->preOptimize(m_exp2);
  ar->preOptimize(m_exp3);
  if (m_stmt) {
    ar->getScope()->incLoopNestedLevel();
    ar->preOptimize(m_stmt);
    ar->getScope()->decLoopNestedLevel();
  }
  return StatementPtr();
}
开发者ID:Bittarman,项目名称:hiphop-php,代码行数:11,代码来源:for_statement.cpp

示例6: preOptimize

ExpressionPtr QOpExpression::preOptimize(AnalysisResultPtr ar) {
  ar->preOptimize(m_condition);
  ar->preOptimize(m_expYes);
  ar->preOptimize(m_expNo);
  Variant value;
  if (m_condition->getScalarValue(value)) {
    if (value.toBoolean()) return m_expYes; else return m_expNo;
  } else {
    return ExpressionPtr();
  }
}
开发者ID:phpfalcon,项目名称:hiphop-php,代码行数:11,代码来源:qop_expression.cpp

示例7: preOptimize

StatementPtr InterfaceStatement::preOptimize(AnalysisResultPtr ar) {
  ar->preOptimize(m_base);
  if (m_stmt) {
    ClassScopePtr classScope = m_classScope.lock();
    ar->pushScope(classScope);
    ar->preOptimize(m_stmt);
    ar->popScope();
  }
  if (ar->getPhase() >= AnalysisResult::AnalyzeAll) {
    checkVolatile(ar);
  }
  return StatementPtr();
}
开发者ID:edv4rd0,项目名称:hiphop-php,代码行数:13,代码来源:interface_statement.cpp

示例8: preOptimize

StatementPtr StatementList::preOptimize(AnalysisResultPtr ar) {
  bool del = false;
  bool changed = false;
  for (unsigned int i = 0; i < m_stmts.size(); i++) {
    StatementPtr &s = m_stmts[i];
    if (del) {
      switch (s->getKindOf()) {
      case Statement::KindOfBlockStatement:
      case Statement::KindOfIfBranchStatement:
      case Statement::KindOfIfStatement:
      case Statement::KindOfWhileStatement:
      case Statement::KindOfDoStatement:
      case Statement::KindOfForStatement:
      case Statement::KindOfSwitchStatement:
      case Statement::KindOfCaseStatement:
      case Statement::KindOfBreakStatement:
      case Statement::KindOfContinueStatement:
      case Statement::KindOfReturnStatement:
      case Statement::KindOfGlobalStatement:
      case Statement::KindOfStaticStatement:
      case Statement::KindOfEchoStatement:
      case Statement::KindOfUnsetStatement:
      case Statement::KindOfExpStatement:
      case Statement::KindOfForEachStatement:
      case Statement::KindOfCatchStatement:
      case Statement::KindOfTryStatement:
      case Statement::KindOfThrowStatement:
        removeElement(i--);
        changed = true;
        continue;
      default:
        break;
      }
    }

    if (s) {
      ar->preOptimize(s);
      if (ar->getPhase() != AnalysisResult::AnalyzeInclude &&
          Option::EliminateDeadCode) {
        if (s->is(KindOfBreakStatement) ||
            s->is(KindOfContinueStatement) ||
            s->is(KindOfReturnStatement) ||
            s->is(KindOfThrowStatement)) {
          del = true;
        } else if (s->is(KindOfExpStatement)) {
          ExpressionPtr e =
            dynamic_pointer_cast<ExpStatement>(s)->getExpression();
          if (!e->hasEffect()) {
            removeElement(i--);
            changed = true;
          }
        }
      }
    }
  }

  if (mergeConcatAssign(ar)) changed = true;
  return changed ? static_pointer_cast<Statement>(shared_from_this())
                 : StatementPtr();
}
开发者ID:Bittarman,项目名称:hiphop-php,代码行数:60,代码来源:statement_list.cpp

示例9: preOptimize

ExpressionPtr ExpressionList::preOptimize(AnalysisResultPtr ar) {
  for (unsigned int i = 0; i < m_exps.size(); i++) {
    ar->preOptimize(m_exps[i]);
  }
  return optimize(ar) ? static_pointer_cast<Expression>(shared_from_this())
                      : ExpressionPtr();
}
开发者ID:yigithub,项目名称:hiphop-php,代码行数:7,代码来源:expression_list.cpp

示例10: preOptimize

ExpressionPtr UnaryOpExpression::preOptimize(AnalysisResultPtr ar) {
  Variant value;
  Variant result;

  ar->preOptimize(m_exp);
  if (m_exp && ar->getPhase() >= AnalysisResult::FirstPreOptimize) {
    if (m_op == '(') {
      return m_exp;
    }
    if (m_op == T_UNSET) {
      if (m_exp->isScalar() ||
          (m_exp->is(KindOfExpressionList) &&
           static_pointer_cast<ExpressionList>(m_exp)->getCount() == 0)) {
        return CONSTANT("null");
      }
      return ExpressionPtr();
    }
  }

  if (m_op != T_ARRAY &&
      m_exp &&
      m_exp->isScalar() &&
      m_exp->getScalarValue(value) &&
      preCompute(value, result)) {
    return replaceValue(MakeScalarExpression(ar, getLocation(), result));
  }
  return ExpressionPtr();
}
开发者ID:mukulu,项目名称:hiphop-php,代码行数:28,代码来源:unary_op_expression.cpp

示例11: preOptimize

ExpressionPtr UnaryOpExpression::preOptimize(AnalysisResultPtr ar) {
    Variant value;
    Variant result;
    bool hasResult;

    ar->preOptimize(m_exp);

    if (!m_exp || !m_exp->isScalar()) return ExpressionPtr();
    if (!m_exp->getScalarValue(value)) return ExpressionPtr();
    hasResult = preCompute(ar, value, result);
    if (hasResult) {
        if (result.isNull()) {
            return CONSTANT("null");
        } else if (result.isBoolean()) {
            return CONSTANT(result ? "true" : "false");
        } else if (result.isDouble() && !finite(result.getDouble())) {
            return ExpressionPtr();
        } else if (result.isArray()) {
            return ExpressionPtr();
        } else {
            return ScalarExpressionPtr
                   (new ScalarExpression(m_exp->getLocation(),
                                         Expression::KindOfScalarExpression,
                                         result));
        }
    }
    return ExpressionPtr();
}
开发者ID:sumitk,项目名称:hiphop-php,代码行数:28,代码来源:unary_op_expression.cpp

示例12: preOptimize

StatementPtr ExpStatement::preOptimize(AnalysisResultPtr ar) {
  if (ar->getPhase() != AnalysisResult::AnalyzeInclude) {
    m_exp = m_exp->unneeded(ar);
  }
  ar->preOptimize(m_exp);
  return StatementPtr();
}
开发者ID:F4m3uS,项目名称:hiphop-php,代码行数:7,代码来源:exp_statement.cpp

示例13: preOptimize

StatementPtr MethodStatement::preOptimize(AnalysisResultPtr ar) {
  ar->preOptimize(m_modifiers);
  ar->preOptimize(m_params);
  FunctionScopePtr funcScope = m_funcScope.lock();
  ar->pushScope(funcScope);
  if (ar->getPhase() != AnalysisResult::AnalyzeInclude &&
      AliasManager::doLocalCopyProp()) {
    bool flag;
    do {
      AliasManager am;
      MethodStatementPtr self =
        static_pointer_cast<MethodStatement>(shared_from_this());
      flag = am.optimize(ar, self);
      ar->preOptimize(m_stmt);
    } while (flag);
  } else {
    ar->preOptimize(m_stmt);
  }
  ar->popScope();
  return StatementPtr();
}
开发者ID:yigithub,项目名称:hiphop-php,代码行数:21,代码来源:method_statement.cpp

示例14: preOptimize

ExpressionPtr BinaryOpExpression::preOptimize(AnalysisResultPtr ar) {
  ar->preOptimize(m_exp1);
  ar->preOptimize(m_exp2);
  if (!m_exp2->isScalar()) {
    if (!m_exp1->isScalar()) return ExpressionPtr();
  }
  ExpressionPtr optExp;
  try {
    optExp = foldConst(ar);
  } catch (Exception &e) {
    // runtime/base threw an exception, perhaps bad operands
  }
  if (optExp) return optExp;
  if (isShortCircuitOperator()) return simplifyLogical(ar);
  return ExpressionPtr();
}
开发者ID:Bittarman,项目名称:hiphop-php,代码行数:16,代码来源:binary_op_expression.cpp

示例15: preOptimize

ExpressionPtr DynamicVariable::preOptimize(AnalysisResultPtr ar) {
  ar->preOptimize(m_exp);
  return ExpressionPtr();
}
开发者ID:edv4rd0,项目名称:hiphop-php,代码行数:4,代码来源:dynamic_variable.cpp


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