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


C++ Solver::GetBitTerms方法代码示例

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


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

示例1: SetTest

void CheckerPropagate::SetTest(Bit *safe_bit)
{
  Assert(!m_where);

  Vector<Exp*> safe_terms;

  Solver *solver = m_frame->State()->GetSolver();
  solver->GetBitTerms(m_frame->Id(), safe_bit, &safe_terms);
  SortVector< Exp*, SortObjectsCompare<Exp> >(&safe_terms);

  // setup the initial where info in a pass over the whole bit. the bit might
  // be outright ignored or we might be forced to go to the caller because
  // of an ExpFrame subexpression.
  PropagateScanVisitor visitor;
  safe_bit->DoVisit(&visitor);

  if (visitor.ignore)
    m_where = new WhereNone(RK_None);
  else if (visitor.has_frame)
    m_where = WherePrecondition::Make(m_frame->Memory(), safe_bit);

  // try to find a direction which accomodates all terms in the bit.
  for (size_t ind = 0; ind < safe_terms.Size(); ind++) {
    Where *new_where = TryPropagate(safe_bit, safe_terms[ind]);

    if (new_where) {
      if (m_where) {
        // replace with the new direction only if it has higher priority.
        int priority = Where::PriorityCompare(new_where, m_where);
        if (priority < 0) {
          delete m_where;
          m_where = new_where;
        }
        else {
          delete new_where;
        }
      }
      else {
        m_where = new_where;
      }
    }
  }

  if (!m_where) {
    if (!safe_terms.Empty()) {
      // couldn't find a way to propagate from this point, generate Unexpected.
      m_where = new WhereNone(RK_Unexpected);
    }
    else {
      // nowhere to go from here.
      m_where = new WhereNone(RK_Finished);
    }
  }

  DecRefVector<Exp>(safe_terms, &safe_terms);
}
开发者ID:wh5a,项目名称:xgill,代码行数:56,代码来源:propagate.cpp

示例2: SetBaseBit

void CheckerPropagate::SetBaseBit(Bit *base_bit, Bit *point_bit)
{
  Assert(!m_base_bit);
  Assert(!m_point_bit);

  base_bit->IncRef(this);
  m_base_bit = base_bit;

  point_bit->IncRef(this);
  m_point_bit = point_bit;

  Solver *solver = m_frame->State()->GetSolver();
  solver->GetBitTerms(m_frame->Id(), point_bit, &m_point_terms);
  SortVector< Exp*, SortObjectsCompare<Exp> >(&m_point_terms);
}
开发者ID:wh5a,项目名称:xgill,代码行数:15,代码来源:propagate.cpp


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