cloud9_root/src/third_party/stp/src/STPManager/STP.cpp
// These transformations should never increase the size of the DAG.
These transformations should never increase the size of the DAG.
These transformations should never increase the size of the DAG .
ASTNode
  STP::sizeReducing(ASTNode simplified_solved_InputToSAT, BVSolver* bvSolver)
  {
    simplified_solved_InputToSAT = simp->CreateSubstitutionMap(simplified_solved_InputToSAT, arrayTransformer);
    if (simp->hasUnappliedSubstitutions())
      {
        simplified_solved_InputToSAT = simp->applySubstitutionMap(simplified_solved_InputToSAT);
        simp->haveAppliedSubstitutionMap();
        bm->ASTNodeStats("After Propagating Equalities: ", simplified_solved_InputToSAT);
      }
    if (bm->UserFlags.isSet("enable-unconstrained", "1"))
      {
        RemoveUnconstrained r1(*bm);
        simplified_solved_InputToSAT = r1.topLevel(simplified_solved_InputToSAT, simp);
        bm->ASTNodeStats("After Removing Unconstrained: ", simplified_solved_InputToSAT);
      }
    if (bm->UserFlags.isSet("use-intervals", "1"))
      {
        EstablishIntervals intervals(*bm);
        simplified_solved_InputToSAT = intervals.topLevel_unsignedIntervals(simplified_solved_InputToSAT);
        bm->ASTNodeStats("After Establishing Intervals: ", simplified_solved_InputToSAT);
      }
    if (bm->UserFlags.bitConstantProp_flag)
      {
        bm->GetRunTimes()->start(RunTimes::ConstantBitPropagation);
        SimplifyingNodeFactory nf(*(bm->hashingNodeFactory), *bm);
        simplifier::constantBitP::ConstantBitPropagation cb(simp, &nf, simplified_solved_InputToSAT);
        simplified_solved_InputToSAT = cb.topLevelBothWays(simplified_solved_InputToSAT, true,false);
        bm->GetRunTimes()->stop(RunTimes::ConstantBitPropagation);
        if (cb.isUnsatisfiable())
          simplified_solved_InputToSAT = bm->ASTFalse;
        if (simp->hasUnappliedSubstitutions())
          {
            simplified_solved_InputToSAT = simp->applySubstitutionMap(simplified_solved_InputToSAT);
            simp->haveAppliedSubstitutionMap();
          }
        bm->ASTNodeStats("After Constant Bit Propagation: ", simplified_solved_InputToSAT);
      }
    if (bm->UserFlags.isSet("pure-literals", "1"))
      {
        FindPureLiterals fpl;
        bool changed = fpl.topLevel(simplified_solved_InputToSAT, simp, bm);
        if (changed)
          {
            simplified_solved_InputToSAT = simp->applySubstitutionMap(simplified_solved_InputToSAT);
            simp->haveAppliedSubstitutionMap();
            bm->ASTNodeStats("After Pure Literals: ", simplified_solved_InputToSAT);
          }
      }
    if (bm->UserFlags.isSet("always-true", "0"))
      {
        SimplifyingNodeFactory nf(*(bm->hashingNodeFactory), *bm);
        AlwaysTrue always (simp,bm,&nf);
        simplified_solved_InputToSAT = always.topLevel(simplified_solved_InputToSAT);
        bm->ASTNodeStats("After removing always true: ", simplified_solved_InputToSAT);
      }
    if (bm->UserFlags.wordlevel_solve_flag && bm->UserFlags.optimize_flag)
      {
        simplified_solved_InputToSAT = bvSolver->TopLevelBVSolve(simplified_solved_InputToSAT, false);
        bm->ASTNodeStats("after solving: ", simplified_solved_InputToSAT);
      }
    return simplified_solved_InputToSAT;
  }
ASTNode STP :: sizeReducing ( ASTNode simplified_solved_InputToSAT , BVSolver * bvSolver ) { simplified_solved_InputToSAT = simp -> CreateSubstitutionMap ( simplified_solved_InputToSAT , arrayTransformer ) ; if ( simp -> hasUnappliedSubstitutions ( ) ) { simplified_solved_InputToSAT = simp -> applySubstitutionMap ( simplified_solved_InputToSAT ) ; simp -> haveAppliedSubstitutionMap ( ) ; bm -> ASTNodeStats ( " " , simplified_solved_InputToSAT ) ; } if ( bm -> UserFlags . isSet ( " " , " " ) ) { RemoveUnconstrained r1 ( * bm ) ; simplified_solved_InputToSAT = r1 . topLevel ( simplified_solved_InputToSAT , simp ) ; bm -> ASTNodeStats ( " " , simplified_solved_InputToSAT ) ; } if ( bm -> UserFlags . isSet ( " " , " " ) ) { EstablishIntervals intervals ( * bm ) ; simplified_solved_InputToSAT = intervals . topLevel_unsignedIntervals ( simplified_solved_InputToSAT ) ; bm -> ASTNodeStats ( " " , simplified_solved_InputToSAT ) ; } if ( bm -> UserFlags . bitConstantProp_flag ) { bm -> GetRunTimes ( ) -> start ( RunTimes :: ConstantBitPropagation ) ; SimplifyingNodeFactory nf ( * ( bm -> hashingNodeFactory ) , * bm ) ; simplifier :: constantBitP :: ConstantBitPropagation cb ( simp , & nf , simplified_solved_InputToSAT ) ; simplified_solved_InputToSAT = cb . topLevelBothWays ( simplified_solved_InputToSAT , true , false ) ; bm -> GetRunTimes ( ) -> stop ( RunTimes :: ConstantBitPropagation ) ; if ( cb . isUnsatisfiable ( ) ) simplified_solved_InputToSAT = bm -> ASTFalse ; if ( simp -> hasUnappliedSubstitutions ( ) ) { simplified_solved_InputToSAT = simp -> applySubstitutionMap ( simplified_solved_InputToSAT ) ; simp -> haveAppliedSubstitutionMap ( ) ; } bm -> ASTNodeStats ( " " , simplified_solved_InputToSAT ) ; } if ( bm -> UserFlags . isSet ( " " , " " ) ) { FindPureLiterals fpl ; bool changed = fpl . topLevel ( simplified_solved_InputToSAT , simp , bm ) ; if ( changed ) { simplified_solved_InputToSAT = simp -> applySubstitutionMap ( simplified_solved_InputToSAT ) ; simp -> haveAppliedSubstitutionMap ( ) ; bm -> ASTNodeStats ( " " , simplified_solved_InputToSAT ) ; } } if ( bm -> UserFlags . isSet ( " " , " " ) ) { SimplifyingNodeFactory nf ( * ( bm -> hashingNodeFactory ) , * bm ) ; AlwaysTrue always ( simp , bm , & nf ) ; simplified_solved_InputToSAT = always . topLevel ( simplified_solved_InputToSAT ) ; bm -> ASTNodeStats ( " " , simplified_solved_InputToSAT ) ; } if ( bm -> UserFlags . wordlevel_solve_flag && bm -> UserFlags . optimize_flag ) { simplified_solved_InputToSAT = bvSolver -> TopLevelBVSolve ( simplified_solved_InputToSAT , false ) ; bm -> ASTNodeStats ( " " , simplified_solved_InputToSAT ) ; } return simplified_solved_InputToSAT ; }
These transformations should never increase the size of the DAG.
These transformations should never increase the size of the DAG .
// Remove unconstrained. // Find pure literals.