Changes in / [fc39193:396ee0a]
- Location:
- src
- Files:
-
- 2 edited
-
CodeTools/DeclStats.cc (modified) (5 diffs)
-
prelude/prelude.cf (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeTools/DeclStats.cc
rfc39193 r396ee0a 62 62 std::map<unsigned, unsigned> p_basic; ///< Count of decls with each percentage of basic type elements 63 63 std::map<unsigned, unsigned> p_poly; ///< Count of decls with each percentage of polymorphic elements 64 VectorMap<unsigned> n_types; ///< Count of decls with each number of distinct types in the pack 64 65 65 66 ArgPackStats& operator+= (const ArgPackStats& o) { … … 69 70 sum(p_basic, o.p_basic); 70 71 sum(p_poly, o.p_poly); 72 sum(n_types, o.n_types); 71 73 72 74 return *this; … … 121 123 /// Update arg pack stats based on a declaration list 122 124 void analyze( Stats& stats, ArgPackStats& pstats, std::list<DeclarationWithType*>& decls ) { 125 std::unordered_set<std::string> types; 123 126 unsigned n = 0; 124 127 unsigned n_basic = 0; 125 128 unsigned n_poly = 0; 126 129 for ( auto decl : decls ) { 127 n += decl->get_type()->size(); 128 if ( BasicType* bt = dynamic_cast<BasicType*>( decl->get_type() ) ) { 130 Type* dt = decl->get_type(); 131 132 n += dt->size(); 133 134 std::stringstream ss; 135 dt->print( ss ); 136 types.insert( ss.str() ); 137 138 if ( dynamic_cast<BasicType*>( dt ) ) { 129 139 ++n_basic; 130 std::stringstream ss;131 bt->print( ss );132 140 ++stats.basic_type_names[ ss.str() ]; 133 } else if ( GenPoly::hasPolyBase( d ecl->get_type()) ) {141 } else if ( GenPoly::hasPolyBase( dt ) ) { 134 142 ++n_poly; 135 143 } else { 136 std::stringstream ss;137 decl->get_type()->print( ss );138 144 ++stats.compound_type_names[ ss.str() ]; 139 145 } … … 146 152 ++pstats.p_poly[ n_poly*100/n ]; 147 153 } 154 ++pstats.n_types.at( types.size() ); 148 155 } 149 156 … … 267 274 printAllMap("%_basic_" + name, [&extract](const Stats& stats) { return extract(stats).p_basic; }); 268 275 printAllMap("%_poly_" + name, [&extract](const Stats& stats) { return extract(stats).p_poly; }); 276 printAllMap("n_distinct_types_" + name, [&extract](const Stats& stats) { return extract(stats).n_types; }); 269 277 } 270 278 -
src/prelude/prelude.cf
rfc39193 r396ee0a 58 58 long double _Complex ?--( long double _Complex * ), ?--( volatile long double _Complex * ); 59 59 60 forall( otype T) T * ?++( T ** );61 forall( otype T) const T * ?++( const T ** );62 forall( otype T) volatile T * ?++( volatile T ** );63 forall( otype T) const volatile T * ?++( const volatile T ** );64 forall( otype T) T * ?--( T ** );65 forall( otype T) const T * ?--( const T ** );66 forall( otype T) volatile T * ?--( volatile T ** );67 forall( otype T) const volatile T * ?--( const volatile T ** );68 69 forall( otype T) lvalue T ?[?]( T *, ptrdiff_t );70 forall( otype T) const lvalue T ?[?]( const T *, ptrdiff_t );71 forall( otype T) volatile lvalue T ?[?]( volatile T *, ptrdiff_t );72 forall( otype T) const volatile lvalue T ?[?]( const volatile T *, ptrdiff_t );73 forall( otype T) lvalue T ?[?]( ptrdiff_t, T * );74 forall( otype T) const lvalue T ?[?]( ptrdiff_t, const T * );75 forall( otype T) volatile lvalue T ?[?]( ptrdiff_t, volatile T * );76 forall( otype T) const volatile lvalue T ?[?]( ptrdiff_t, const volatile T * );60 forall( dtype T | sized(T) ) T * ?++( T ** ); 61 forall( dtype T | sized(T) ) const T * ?++( const T ** ); 62 forall( dtype T | sized(T) ) volatile T * ?++( volatile T ** ); 63 forall( dtype T | sized(T) ) const volatile T * ?++( const volatile T ** ); 64 forall( dtype T | sized(T) ) T * ?--( T ** ); 65 forall( dtype T | sized(T) ) const T * ?--( const T ** ); 66 forall( dtype T | sized(T) ) volatile T * ?--( volatile T ** ); 67 forall( dtype T | sized(T) ) const volatile T * ?--( const volatile T ** ); 68 69 forall( dtype T | sized(T) ) lvalue T ?[?]( T *, ptrdiff_t ); 70 forall( dtype T | sized(T) ) const lvalue T ?[?]( const T *, ptrdiff_t ); 71 forall( dtype T | sized(T) ) volatile lvalue T ?[?]( volatile T *, ptrdiff_t ); 72 forall( dtype T | sized(T) ) const volatile lvalue T ?[?]( const volatile T *, ptrdiff_t ); 73 forall( dtype T | sized(T) ) lvalue T ?[?]( ptrdiff_t, T * ); 74 forall( dtype T | sized(T) ) const lvalue T ?[?]( ptrdiff_t, const T * ); 75 forall( dtype T | sized(T) ) volatile lvalue T ?[?]( ptrdiff_t, volatile T * ); 76 forall( dtype T | sized(T) ) const volatile lvalue T ?[?]( ptrdiff_t, const volatile T * ); 77 77 78 78 // ------------------------------------------------------------ … … 96 96 long double _Complex ++?( long double _Complex * ), --?( long double _Complex * ); 97 97 98 forall( otype T) T * ++?( T ** );99 forall( otype T) const T * ++?( const T ** );100 forall( otype T) volatile T * ++?( volatile T ** );101 forall( otype T) const volatile T * ++?( const volatile T ** );102 forall( otype T) T * --?( T ** );103 forall( otype T) const T * --?( const T ** );104 forall( otype T) volatile T * --?( volatile T ** );105 forall( otype T) const volatile T * --?( const volatile T ** );98 forall( dtype T | sized(T) ) T * ++?( T ** ); 99 forall( dtype T | sized(T) ) const T * ++?( const T ** ); 100 forall( dtype T | sized(T) ) volatile T * ++?( volatile T ** ); 101 forall( dtype T | sized(T) ) const volatile T * ++?( const volatile T ** ); 102 forall( dtype T | sized(T) ) T * --?( T ** ); 103 forall( dtype T | sized(T) ) const T * --?( const T ** ); 104 forall( dtype T | sized(T) ) volatile T * --?( volatile T ** ); 105 forall( dtype T | sized(T) ) const volatile T * --?( const volatile T ** ); 106 106 107 107 forall( dtype T | sized(T) ) lvalue T *?( T * ); … … 178 178 long double _Complex ?+?( long double _Complex, long double _Complex ), ?-?( long double _Complex, long double _Complex ); 179 179 180 forall( otype T) T * ?+?( T *, ptrdiff_t );181 forall( otype T) T * ?+?( ptrdiff_t, T * );182 forall( otype T) const T * ?+?( const T *, ptrdiff_t );183 forall( otype T) const T * ?+?( ptrdiff_t, const T * );184 forall( otype T) volatile T * ?+?( volatile T *, ptrdiff_t );185 forall( otype T) volatile T * ?+?( ptrdiff_t, volatile T * );186 forall( otype T) const volatile T * ?+?( const volatile T *, ptrdiff_t );187 forall( otype T) const volatile T * ?+?( ptrdiff_t, const volatile T * );188 forall( otype T) T * ?-?( T *, ptrdiff_t );189 forall( otype T) const T * ?-?( const T *, ptrdiff_t );190 forall( otype T) volatile T * ?-?( volatile T *, ptrdiff_t );191 forall( otype T) const volatile T * ?-?( const volatile T *, ptrdiff_t );192 forall( otype T) ptrdiff_t ?-?( const volatile T *, const volatile T * );180 forall( dtype T | sized(T) ) T * ?+?( T *, ptrdiff_t ); 181 forall( dtype T | sized(T) ) T * ?+?( ptrdiff_t, T * ); 182 forall( dtype T | sized(T) ) const T * ?+?( const T *, ptrdiff_t ); 183 forall( dtype T | sized(T) ) const T * ?+?( ptrdiff_t, const T * ); 184 forall( dtype T | sized(T) ) volatile T * ?+?( volatile T *, ptrdiff_t ); 185 forall( dtype T | sized(T) ) volatile T * ?+?( ptrdiff_t, volatile T * ); 186 forall( dtype T | sized(T) ) const volatile T * ?+?( const volatile T *, ptrdiff_t ); 187 forall( dtype T | sized(T) ) const volatile T * ?+?( ptrdiff_t, const volatile T * ); 188 forall( dtype T | sized(T) ) T * ?-?( T *, ptrdiff_t ); 189 forall( dtype T | sized(T) ) const T * ?-?( const T *, ptrdiff_t ); 190 forall( dtype T | sized(T) ) volatile T * ?-?( volatile T *, ptrdiff_t ); 191 forall( dtype T | sized(T) ) const volatile T * ?-?( const volatile T *, ptrdiff_t ); 192 forall( dtype T | sized(T) ) ptrdiff_t ?-?( const volatile T *, const volatile T * ); 193 193 194 194 // ------------------------------------------------------------ … … 428 428 forall( ftype FT ) FT * ?=?( FT * volatile *, forall( ftype FT2 ) FT2 * ); 429 429 430 forall( otype T) T * ?+=?( T * *, ptrdiff_t );431 forall( otype T) T * ?+=?( T * volatile *, ptrdiff_t );432 forall( otype T) const T * ?+=?( const T * *, ptrdiff_t );433 forall( otype T) const T * ?+=?( const T * volatile *, ptrdiff_t );434 forall( otype T) volatile T * ?+=?( volatile T * *, ptrdiff_t );435 forall( otype T) volatile T * ?+=?( volatile T * volatile *, ptrdiff_t );436 forall( otype T) const volatile T * ?+=?( const volatile T * *, ptrdiff_t );437 forall( otype T) const volatile T * ?+=?( const volatile T * volatile *, ptrdiff_t );438 forall( otype T) T * ?-=?( T * *, ptrdiff_t );439 forall( otype T) T * ?-=?( T * volatile *, ptrdiff_t );440 forall( otype T) const T * ?-=?( const T * *, ptrdiff_t );441 forall( otype T) const T * ?-=?( const T * volatile *, ptrdiff_t );442 forall( otype T) volatile T * ?-=?( volatile T * *, ptrdiff_t );443 forall( otype T) volatile T * ?-=?( volatile T * volatile *, ptrdiff_t );444 forall( otype T) const volatile T * ?-=?( const volatile T * *, ptrdiff_t );445 forall( otype T) const volatile T * ?-=?( const volatile T * volatile *, ptrdiff_t );430 forall( dtype T | sized(T) ) T * ?+=?( T * *, ptrdiff_t ); 431 forall( dtype T | sized(T) ) T * ?+=?( T * volatile *, ptrdiff_t ); 432 forall( dtype T | sized(T) ) const T * ?+=?( const T * *, ptrdiff_t ); 433 forall( dtype T | sized(T) ) const T * ?+=?( const T * volatile *, ptrdiff_t ); 434 forall( dtype T | sized(T) ) volatile T * ?+=?( volatile T * *, ptrdiff_t ); 435 forall( dtype T | sized(T) ) volatile T * ?+=?( volatile T * volatile *, ptrdiff_t ); 436 forall( dtype T | sized(T) ) const volatile T * ?+=?( const volatile T * *, ptrdiff_t ); 437 forall( dtype T | sized(T) ) const volatile T * ?+=?( const volatile T * volatile *, ptrdiff_t ); 438 forall( dtype T | sized(T) ) T * ?-=?( T * *, ptrdiff_t ); 439 forall( dtype T | sized(T) ) T * ?-=?( T * volatile *, ptrdiff_t ); 440 forall( dtype T | sized(T) ) const T * ?-=?( const T * *, ptrdiff_t ); 441 forall( dtype T | sized(T) ) const T * ?-=?( const T * volatile *, ptrdiff_t ); 442 forall( dtype T | sized(T) ) volatile T * ?-=?( volatile T * *, ptrdiff_t ); 443 forall( dtype T | sized(T) ) volatile T * ?-=?( volatile T * volatile *, ptrdiff_t ); 444 forall( dtype T | sized(T) ) const volatile T * ?-=?( const volatile T * *, ptrdiff_t ); 445 forall( dtype T | sized(T) ) const volatile T * ?-=?( const volatile T * volatile *, ptrdiff_t ); 446 446 447 447 _Bool ?=?( _Bool *, _Bool ), ?=?( volatile _Bool *, _Bool );
Note:
See TracChangeset
for help on using the changeset viewer.