}
}
+bool containsStoreAll( Node n, std::vector< Node >& cache ){
+ if( std::find( cache.begin(), cache.end(), n )==cache.end() ){
+ cache.push_back( n );
+ if( n.getKind()==STORE_ALL ){
+ return true;
+ }else{
+ for( unsigned i=0; i<n.getNumChildren(); i++ ){
+ if( containsStoreAll( n[i], cache ) ){
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
void RepSet::add( TypeNode tn, Node n ){
//for now, do not add array constants FIXME
- if( !tn.isArray() || !n.isConst() ){
- Trace("rsi-debug") << "Add rep #" << d_type_reps[tn].size() << " for " << tn << " : " << n << std::endl;
- Assert( n.getType().isSubtypeOf( tn ) );
- d_tmap[ n ] = (int)d_type_reps[tn].size();
- d_type_reps[tn].push_back( n );
+ if( tn.isArray() ){
+ std::vector< Node > cache;
+ if( containsStoreAll( n, cache ) ){
+ return;
+ }
}
+ Trace("rsi-debug") << "Add rep #" << d_type_reps[tn].size() << " for " << tn << " : " << n << std::endl;
+ Assert( n.getType().isSubtypeOf( tn ) );
+ d_tmap[ n ] = (int)d_type_reps[tn].size();
+ d_type_reps[tn].push_back( n );
}
int RepSet::getIndexFor( Node n ) const {
rt1 = rt2;
rt2 = swap;
}
- d_type_union_find.d_eqc[rt1] = rt2;
std::map< int, TypeNode >::iterator it1 = d_type_types.find( rt1 );
if( it1!=d_type_types.end() ){
if( d_type_types.find( rt2 )==d_type_types.end() ){
d_type_types.erase( rt1 );
}else{
//may happen for mixed int/real
+ return;
}
}
+ d_type_union_find.d_eqc[rt1] = rt2;
}
}
}