cloud9_root/src/third_party/stp/src/simplifier/constantBitP/ConstantBitPropagation.cpp
// Propagates. No writing in of values. Doesn't assume the top is true.
Propagates. No writing in of values. Doesn't assume the top is true.
Propagates . No writing in of values . Doesn ' t assume the top is true .
ConstantBitPropagation::ConstantBitPropagation(BEEV::Simplifier* _sm, NodeFactory* _nf,const ASTNode & top)
    {
      assert (BOOLEAN_TYPE == top.GetType());
      assert (top.GetSTPMgr()->UserFlags.bitConstantProp_flag);
      status = NO_CHANGE;
      simplifier = _sm;
      nf = _nf;
      fixedMap = new NodeToFixedBitsMap(1000); 
      workList = new WorkList(top);
      dependents = new Dependencies(top); 
      msm = new MultiplicationStatsMap();
      propagate();
      if (debug_cBitProp_messages)
        {
          cerr << "status:" << status <<endl;
          cerr << "ended propagation" << endl;
          printNodeWithFixings();
        }
#if 0
      NodeToFixedBitsMap::NodeToFixedBitsMapType::iterator it =
          fixedMap->map->begin();
      NodeToFixedBitsMap::NodeToFixedBitsMapType::iterator it_end =
          fixedMap->map->end();
      while (it != it_end)
        {
          if (  (it->second)->countFixed() == 0 )
            {
              delete it->second;
              const ASTNode n = it->first;
              it++;
              fixedMap->map->erase(n);
            }
          else
            it++;
        }
#endif
      topFixed = false;
    }
ConstantBitPropagation :: ConstantBitPropagation ( BEEV :: Simplifier * _sm , NodeFactory * _nf , const ASTNode & top ) { assert ( BOOLEAN_TYPE == top . GetType ( ) ) ; assert ( top . GetSTPMgr ( ) -> UserFlags . bitConstantProp_flag ) ; status = NO_CHANGE ; simplifier = _sm ; nf = _nf ; fixedMap = new NodeToFixedBitsMap ( 1000 ) ; workList = new WorkList ( top ) ; dependents = new Dependencies ( top ) ; msm = new MultiplicationStatsMap ( ) ; propagate ( ) ; if ( debug_cBitProp_messages ) { cerr << " " << status << endl ; cerr << " " << endl ; printNodeWithFixings ( ) ; } #if 0 NodeToFixedBitsMap :: NodeToFixedBitsMapType :: iterator it = fixedMap -> map -> begin ( ) ; NodeToFixedBitsMap :: NodeToFixedBitsMapType :: iterator it_end = fixedMap -> map -> end ( ) ; while ( it != it_end ) { if ( ( it -> second ) -> countFixed ( ) == 0 ) { delete it -> second ; const ASTNode n = it -> first ; it ++ ; fixedMap -> map -> erase ( n ) ; } else it ++ ; } #endif topFixed = false ; }
Propagates.
Propagates .
// better to use the function that returns the number of nodes.. whatever that is. // List of the parents of a node. // not fixing the topnode. // is there are good reason to clear out some of them?? // remove constants, and things with nothing fixed. // No constants, nothing completely unfixed. // making this a reference causes reading from freed memory.