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


C++ ASTVec类代码示例

本文整理汇总了C++中ASTVec的典型用法代码示例。如果您正苦于以下问题:C++ ASTVec类的具体用法?C++ ASTVec怎么用?C++ ASTVec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CreateSimpXor

 ASTNode STPMgr::CreateSimpXor(const ASTNode& form1, const ASTNode& form2)
 {
   ASTVec children;
   children.push_back(form1);
   children.push_back(form2);
   return CreateSimpXor(children);
 }
开发者ID:DidwardFrenkel,项目名称:stp,代码行数:7,代码来源:SimpBool.cpp

示例2: searchTerm

bool PropagateEqualities::searchTerm(const ASTNode& lhs, const ASTNode& rhs)
{
  const unsigned width = lhs.GetValueWidth();

  if (lhs == rhs)
    return true;

  if (lhs.GetKind() == SYMBOL)
    return simp->UpdateSubstitutionMap(lhs, rhs); // checks whether it's been
                                                  // solved for, or if the RHS
                                                  // contains the LHS.

  if (lhs.GetKind() == BVUMINUS)
    return searchTerm(lhs[0], nf->CreateTerm(BVUMINUS, width, rhs));

  if (lhs.GetKind() == BVNEG)
    return searchTerm(lhs[0], nf->CreateTerm(BVNEG, width, rhs));

  if (lhs.GetKind() == BVXOR || lhs.GetKind() == BVPLUS)
    for (size_t i = 0; i < lhs.Degree(); i++)
    {
      ASTVec others;
      for (size_t j = 0; j < lhs.Degree(); j++)
        if (j != i)
          others.push_back(lhs[j]);

      ASTNode new_rhs;
      if (lhs.GetKind() == BVXOR)
      {
        others.push_back(rhs);
        assert(others.size() > 1);
        new_rhs = nf->CreateTerm(lhs.GetKind(), width, others);
      }
      else if (lhs.GetKind() == BVPLUS)
      {
        if (others.size() > 1)
          new_rhs = nf->CreateTerm(BVPLUS, width, others);
        else
          new_rhs = others[0];

        new_rhs = nf->CreateTerm(BVUMINUS, width, new_rhs);
        new_rhs = nf->CreateTerm(BVPLUS, width, new_rhs, rhs);
      }
      else
        FatalError("sdafasfsdf2q3234423");

      bool result = searchTerm(lhs[i], new_rhs);
      if (result)
        return true;
    }

  if (lhs.Degree() == 2 && lhs.GetKind() == BVMULT && lhs[0].isConstant() &&
      simp->BVConstIsOdd(lhs[0]))
    return searchTerm(lhs[1],
                      nf->CreateTerm(BVMULT, width,
                                     simp->MultiplicativeInverse(lhs[0]), rhs));

  return false;
}
开发者ID:cambridgehackers,项目名称:stp,代码行数:59,代码来源:PropagateEqualities.cpp

示例3: if

  // Does some simple caching of prior results.
  void
  Cpp_interface::checkSat(const ASTVec & assertionsSMT2)
  {
    if (ignoreCheckSatRequest)
      return;

    bm.GetRunTimes()->stop(RunTimes::Parsing);

    checkInvariant();
    assert(assertionsSMT2.size() == cache.size());

    Entry& last_run = cache.back();
    if ((last_run.node_number != assertionsSMT2.back().GetNodeNum()) && (last_run.result == SOLVER_SATISFIABLE))
      {
        // extra asserts might have been added to it,
        // flipping from sat to unsat. But never from unsat to sat.
        last_run.result =  SOLVER_UNDECIDED;
      }

    // We might have run this query before, or it might already be shown to be unsat. If it was sat,
    // we've stored the result (but not the model), so we can shortcut and return what we know.
    if (!((last_run.result == SOLVER_SATISFIABLE) || last_run.result == SOLVER_UNSATISFIABLE))
        {
          resetSolver();

          ASTNode query;

          if (assertionsSMT2.size() > 1)
            query = nf->CreateNode(AND, assertionsSMT2);
          else if (assertionsSMT2.size() == 1)
            query = assertionsSMT2[0];
          else
            query = bm.ASTTrue;

          SOLVER_RETURN_TYPE last_result = GlobalSTP->TopLevelSTP(query, bm.ASTFalse);

          // Store away the answer. Might be timeout, or error though..
          last_run = Entry(last_result);
          last_run.node_number = assertionsSMT2.back().GetNodeNum();

          // It's satisfiable, so everything beneath it is satisfiable too.
          if (last_result == SOLVER_SATISFIABLE)
            {
              for (int i = 0; i < cache.size(); i++)
                {
                  assert(cache[i].result != SOLVER_UNSATISFIABLE);
                  cache[i].result = SOLVER_SATISFIABLE;
                }
            }
        }

    if (bm.UserFlags.quick_statistics_flag)
      {
        bm.GetRunTimes()->print();
      }

    (GlobalSTP->tosat)->PrintOutput(last_run.result);
    bm.GetRunTimes()->start(RunTimes::Parsing);
  }
开发者ID:Sjlver,项目名称:stp,代码行数:60,代码来源:cpp_interface.cpp

示例4: CreateSimpAndOr

 ASTNode STPMgr::CreateSimpAndOr(bool IsAnd, 
                                 const ASTNode& form1, const ASTNode& form2)
 {
   ASTVec children;
   children.push_back(form1);
   children.push_back(form2);
   return CreateSimpAndOr(IsAnd, children);
 }
开发者ID:DidwardFrenkel,项目名称:stp,代码行数:8,代码来源:SimpBool.cpp

示例5: CreateSimpForm

 ASTNode STPMgr::CreateSimpForm(Kind kind, const ASTNode& child0)
 {
   ASTVec children;
   //child_stack.clear();      // could just reset top pointer.
   children.push_back(child0);
   //child_stack.push_back(child0);
   return CreateSimpForm(kind, children);
   //return CreateSimpForm(kind, child_stack);
 }
开发者ID:DidwardFrenkel,项目名称:stp,代码行数:9,代码来源:SimpBool.cpp

示例6: checkChildrenAreBV

  void checkChildrenAreBV(const ASTVec& v, const ASTNode&n) {
	for (ASTVec::const_iterator it = v.begin(), itend = v.end(); it != itend; it++)
		if (BITVECTOR_TYPE != it->GetType()) {
			cerr << "The type is: " << it->GetType() << endl;
			FatalError(
					"BVTypeCheck:ChildNodes of bitvector-terms must be bitvectors\n",
					n);
		}
}
开发者ID:chubbymaggie,项目名称:Tac-Symbolic-Executor,代码行数:9,代码来源:ASTmisc.cpp

示例7: CreateNode

ASTNode NodeFactory::CreateNode(Kind kind, const ASTNode& child0,
                                const ASTVec & back_children)
{
    ASTVec front_children;
    front_children.reserve(1 + back_children.size());
    front_children.push_back(child0);
    front_children.insert(front_children.end(), back_children.begin(),
                          back_children.end());
    return CreateNode(kind, front_children);
}
开发者ID:khooyp,项目名称:stp,代码行数:10,代码来源:NodeFactory.cpp

示例8: GetAsserts

void STPMgr::printAssertsToStream(ostream& os)
{
  ASTVec v = GetAsserts();
  for (ASTVec::iterator i = v.begin(), iend = v.end(); i != iend; i++)
  {
    ASTNode q = *i;
    os << "ASSERT( ";
    q.PL_Print(os, this);
    os << ");" << endl;
  }
}
开发者ID:stp,项目名称:stp,代码行数:11,代码来源:AssortedPrinters.cpp

示例9: GetAsserts

 void STPMgr::printAssertsToStream(ostream &os, int simplify_print) {
   ASTVec v = GetAsserts();
   for(ASTVec::iterator i=v.begin(),iend=v.end();i!=iend;i++) {
     //Begin_RemoveWrites = true; ASTNode q = (simplify_print == 1) ?
     //SimplifyFormula_TopLevel(*i,false) : *i; q = (simplify_print
     //== 1) ? SimplifyFormula_TopLevel(q,false) : q;
     ASTNode q = *i;
     //Begin_RemoveWrites = false;
     os << "ASSERT( ";
     q.PL_Print(os);
     os << ");" << endl;
   }
 }
开发者ID:0bliv10n,项目名称:s2e,代码行数:13,代码来源:AssortedPrinters.cpp

示例10: CreateArrayTerm

ASTNode NodeFactory::CreateArrayTerm(Kind kind, unsigned int index, unsigned int width,
                                     const ASTNode& child0, const ASTNode& child1, const ASTNode& child2,
                                     const ASTVec &children)
{
    ASTVec child;
    child.reserve(children.size() + 3);
    child.push_back(child0);
    child.push_back(child1);
    child.push_back(child2);
    child.insert(child.end(), children.begin(), children.end());
    return CreateArrayTerm(kind, index, width, child);
}
开发者ID:khooyp,项目名称:stp,代码行数:12,代码来源:NodeFactory.cpp

示例11: FlattenKind

 void FlattenKind(const Kind k, const ASTVec &children, ASTVec & flat_children)
 {
   ASTVec::const_iterator ch_end = children.end();
   for (ASTVec::const_iterator it = children.begin(); it != ch_end; it++)
     {
       Kind ck = it->GetKind();
       if (k == ck)
         {
           FlattenKind(k,it->GetChildren(), flat_children);
         }
       else
         {
           flat_children.push_back(*it);
         }
     }
 }
开发者ID:chubbymaggie,项目名称:Tac-Symbolic-Executor,代码行数:16,代码来源:ASTmisc.cpp

示例12: print_STPInput_Back

  void print_STPInput_Back(const ASTNode& query) {

	  // Determine the symbols in the query and asserts.
	  ASTNodeSet visited;
	  ASTNodeSet symbols;
	  buildListOfSymbols(query,  visited, symbols);
      ASTVec v = (BEEV::GlobalSTP->bm)->GetAsserts();
      for(ASTVec::iterator i=v.begin(),iend=v.end();i!=iend;i++)
    	buildListOfSymbols(*i,  visited, symbols);

	(BEEV::GlobalSTP->bm)->printVarDeclsToStream(cout, symbols);
    (BEEV::GlobalSTP->bm)->printAssertsToStream(cout,0);
    cout << "QUERY(";
    query.PL_Print(cout);
    cout << ");\n";
  } //end of print_STPInput_Back()
开发者ID:0bliv10n,项目名称:s2e,代码行数:16,代码来源:AssortedPrinters.cpp

示例13: searchXOR

bool PropagateEqualities::searchXOR(const ASTNode& lhs, const ASTNode& rhs)
{
  Kind k = lhs.GetKind();

  if (lhs == rhs)
    return true;

  if (k == SYMBOL)
    return simp->UpdateSubstitutionMap(
        lhs, rhs); // checks whether it's been solved for or loops.

  if (k == NOT)
    return searchXOR(lhs[0], nf->CreateNode(NOT, rhs));

  bool result = false;
  if (k == XOR)
    for (size_t i = 0; i < lhs.Degree(); i++)
    {
      ASTVec others;
      for (size_t j = 0; j < lhs.Degree(); j++)
        if (j != i)
          others.push_back(lhs[j]);

      others.push_back(rhs);
      assert(others.size() > 1);
      ASTNode new_rhs = nf->CreateNode(XOR, others);

      result = searchXOR(lhs[i], new_rhs);
      if (result)
        return result;
    }

  if (k == EQ && lhs[0].GetValueWidth() == 1)
  {
    bool result =
        searchTerm(lhs[0], nf->CreateTerm(ITE, 1, rhs, lhs[1],
                                          nf->CreateTerm(BVNEG, 1, lhs[1])));

    if (!result)
      result =
          searchTerm(lhs[1], nf->CreateTerm(ITE, 1, rhs, lhs[0],
                                            nf->CreateTerm(BVNEG, 1, lhs[0])));
  }

  return result;
}
开发者ID:cambridgehackers,项目名称:stp,代码行数:46,代码来源:PropagateEqualities.cpp

示例14: Dot_Print1

  void Dot_Print1(ostream &os, const ASTNode n, hash_set<int> *alreadyOutput)
  {

    // check if this node has already been printed. If so return.
    if (alreadyOutput->find(n.GetNodeNum()) != alreadyOutput->end())
      return;

    alreadyOutput->insert(n.GetNodeNum());

    os << "n" << n.GetNodeNum() << "[label =\"";
    switch (n.GetKind())
      {
      case SYMBOL:
        n.nodeprint(os);
        break;

      case BITVECTOR:
      case BVCONST:
        outputBitVec(n, os);
        break;

      default:
        os << _kind_names[n.GetKind()];
      }

    os << "\"];" << endl;

    // print the edges to each child.
    ASTVec ch = n.GetChildren();
    ASTVec::iterator itend = ch.end();
    int i = 0;
    for (ASTVec::iterator it = ch.begin(); it < itend; it++)
      {
        os << "n" << n.GetNodeNum() 
           << " -> " << "n" 
           << it->GetNodeNum() 
           << "[label=" << i++ 
           << "];" << endl;
      }

    // print each of the children.
    for (ASTVec::iterator it = ch.begin(); it < itend; it++)
      {
        Dot_Print1(os, *it, alreadyOutput);
      }
  }
开发者ID:AmesianX,项目名称:stp,代码行数:46,代码来源:dotPrinter.cpp

示例15: FlattenKindNoDuplicates

/* Maintains a set of nodes that have already been seen. So that deeply shared
 * AND,OR operations are not
 * flattened multiple times.
 */
void FlattenKindNoDuplicates(const Kind k, const ASTVec& children,
                             ASTVec& flat_children,
                             ASTNodeSet& alreadyFlattened)
{
  const ASTVec::const_iterator ch_end = children.end();
  for (ASTVec::const_iterator it = children.begin(); it != ch_end; it++)
  {
    const Kind ck = it->GetKind();
    if (k == ck)
    {
      if (alreadyFlattened.find(*it) == alreadyFlattened.end())
      {
        alreadyFlattened.insert(*it);
        FlattenKindNoDuplicates(k, it->GetChildren(), flat_children,
                                alreadyFlattened);
      }
    }
    else
    {
      flat_children.push_back(*it);
    }
  }
}
开发者ID:cambridgehackers,项目名称:stp,代码行数:27,代码来源:ASTmisc.cpp


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