cloud9_root/src/third_party/stp/src/simplifier/simplifier.cpp
// nb. this is sometimes used to build array terms.
//accepts cond == t1, then part is t2, and else part is t3
nb. this is sometimes used to build array terms.
accepts cond == t1, then part is t2, and else part is t3
nb . this is sometimes used to build array terms . accepts cond == t1 then part is t2 and else part is t3
ASTNode
  Simplifier::CreateSimplifiedTermITE(const ASTNode& in0, const ASTNode& in1, const ASTNode& in2)
  {
    const ASTNode& t0 = in0;
    const ASTNode& t1 = in1;
    const ASTNode& t2 = in2;
    CountersAndStats("CreateSimplifiedITE", _bm);
    if (!_bm->UserFlags.optimize_flag)
      {
        if (t1.GetValueWidth() != t2.GetValueWidth())
          {
            cerr << "t2 is : = " << t2;
            FatalError("CreateSimplifiedTermITE: "
                "the lengths of the two branches don't match", t1);
          }
        if (t1.GetIndexWidth() != t2.GetIndexWidth())
          {
            cerr << "t2 is : = " << t2;
            FatalError("CreateSimplifiedTermITE: "
                "the lengths of the two branches don't match", t1);
          }
        return nf->CreateArrayTerm(ITE, t1.GetIndexWidth(), t1.GetValueWidth(), t0, t1, t2);
      }
    if (t0 == ASTTrue)
      return t1;
    if (t0 == ASTFalse)
      return t2;
    if (t1 == t2)
      return t1;
    bool result;
    if (CheckAlwaysTrueFormSet(t0, result))
      {
        if (result)
          return t1;
        else
          return t2;
      }
    return nf->CreateArrayTerm(ITE, t1.GetIndexWidth(), t1.GetValueWidth(), t0, t1, t2);
  }
ASTNode Simplifier :: CreateSimplifiedTermITE ( const ASTNode & in0 , const ASTNode & in1 , const ASTNode & in2 ) { const ASTNode & t0 = in0 ; const ASTNode & t1 = in1 ; const ASTNode & t2 = in2 ; CountersAndStats ( " " , _bm ) ; if ( ! _bm -> UserFlags . optimize_flag ) { if ( t1 . GetValueWidth ( ) != t2 . GetValueWidth ( ) ) { cerr << " " << t2 ; FatalError ( " " " " , t1 ) ; } if ( t1 . GetIndexWidth ( ) != t2 . GetIndexWidth ( ) ) { cerr << " " << t2 ; FatalError ( " " " " , t1 ) ; } return nf -> CreateArrayTerm ( ITE , t1 . GetIndexWidth ( ) , t1 . GetValueWidth ( ) , t0 , t1 , t2 ) ; } if ( t0 == ASTTrue ) return t1 ; if ( t0 == ASTFalse ) return t2 ; if ( t1 == t2 ) return t1 ; bool result ; if ( CheckAlwaysTrueFormSet ( t0 , result ) ) { if ( result ) return t1 ; else return t2 ; } return nf -> CreateArrayTerm ( ITE , t1 . GetIndexWidth ( ) , t1 . GetValueWidth ( ) , t0 , t1 , t2 ) ; }
nb.
nb .