Changes in / [fc39193:396ee0a]


Ignore:
Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/CodeTools/DeclStats.cc

    rfc39193 r396ee0a  
    6262                        std::map<unsigned, unsigned> p_basic;  ///< Count of decls with each percentage of basic type elements
    6363                        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
    6465
    6566                        ArgPackStats& operator+= (const ArgPackStats& o) {
     
    6970                                sum(p_basic, o.p_basic);
    7071                                sum(p_poly, o.p_poly);
     72                                sum(n_types, o.n_types);
    7173                               
    7274                                return *this;
     
    121123                /// Update arg pack stats based on a declaration list
    122124                void analyze( Stats& stats, ArgPackStats& pstats, std::list<DeclarationWithType*>& decls ) {
     125                        std::unordered_set<std::string> types;
    123126                        unsigned n = 0;
    124127                        unsigned n_basic = 0;
    125128                        unsigned n_poly = 0;
    126129                        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 ) ) {
    129139                                        ++n_basic;
    130                                         std::stringstream ss;
    131                                         bt->print( ss );
    132140                                        ++stats.basic_type_names[ ss.str() ];
    133                                 } else if ( GenPoly::hasPolyBase( decl->get_type() ) ) {
     141                                } else if ( GenPoly::hasPolyBase( dt ) ) {
    134142                                        ++n_poly;
    135143                                } else {
    136                                         std::stringstream ss;
    137                                         decl->get_type()->print( ss );
    138144                                        ++stats.compound_type_names[ ss.str() ];
    139145                                }
     
    146152                                ++pstats.p_poly[ n_poly*100/n ];
    147153                        }
     154                        ++pstats.n_types.at( types.size() );
    148155                }
    149156               
     
    267274                        printAllMap("%_basic_" + name, [&extract](const Stats& stats) { return extract(stats).p_basic; });
    268275                        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; });
    269277                }
    270278               
  • src/prelude/prelude.cf

    rfc39193 r396ee0a  
    5858long double _Complex    ?--( long double _Complex * ),          ?--( volatile long double _Complex * );
    5959
    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 * );
     60forall( dtype T | sized(T) ) T *                         ?++(                T ** );
     61forall( dtype T | sized(T) ) const T *           ?++( const          T ** );
     62forall( dtype T | sized(T) ) volatile T *                ?++(       volatile T ** );
     63forall( dtype T | sized(T) ) const volatile T *  ?++( const volatile T ** );
     64forall( dtype T | sized(T) ) T *                         ?--(                T ** );
     65forall( dtype T | sized(T) ) const T *           ?--( const          T ** );
     66forall( dtype T | sized(T) ) volatile T *                ?--(       volatile T ** );
     67forall( dtype T | sized(T) ) const volatile T *  ?--( const volatile T ** );
     68
     69forall( dtype T | sized(T) ) lvalue T            ?[?](                T *,          ptrdiff_t );
     70forall( dtype T | sized(T) ) const lvalue T      ?[?]( const          T *,          ptrdiff_t );
     71forall( dtype T | sized(T) ) volatile lvalue T   ?[?](       volatile T *,          ptrdiff_t );
     72forall( dtype T | sized(T) ) const volatile lvalue T ?[?]( const volatile T *,      ptrdiff_t );
     73forall( dtype T | sized(T) ) lvalue T            ?[?](          ptrdiff_t,                T * );
     74forall( dtype T | sized(T) ) const lvalue T      ?[?](          ptrdiff_t, const          T * );
     75forall( dtype T | sized(T) ) volatile lvalue T   ?[?](          ptrdiff_t,       volatile T * );
     76forall( dtype T | sized(T) ) const volatile lvalue T ?[?](              ptrdiff_t, const volatile T * );
    7777
    7878// ------------------------------------------------------------
     
    9696long double _Complex    ++?( long double _Complex * ),          --?( long double _Complex * );
    9797
    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 ** );
     98forall( dtype T | sized(T) ) T *                         ++?(                T ** );
     99forall( dtype T | sized(T) ) const T *           ++?( const          T ** );
     100forall( dtype T | sized(T) ) volatile T *                ++?(       volatile T ** );
     101forall( dtype T | sized(T) ) const volatile T *  ++?( const volatile T ** );
     102forall( dtype T | sized(T) ) T *                         --?(                T ** );
     103forall( dtype T | sized(T) ) const T *           --?( const          T ** );
     104forall( dtype T | sized(T) ) volatile T *                --?(       volatile T ** );
     105forall( dtype T | sized(T) ) const volatile T *  --?( const volatile T ** );
    106106
    107107forall( dtype T | sized(T) ) lvalue T            *?(                 T * );
     
    178178long double _Complex    ?+?( long double _Complex, long double _Complex ),      ?-?( long double _Complex, long double _Complex );
    179179
    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 * );
     180forall( dtype T | sized(T) ) T *                        ?+?(                T *,          ptrdiff_t );
     181forall( dtype T | sized(T) ) T *                        ?+?(          ptrdiff_t,                T * );
     182forall( dtype T | sized(T) ) const T *          ?+?( const          T *,          ptrdiff_t );
     183forall( dtype T | sized(T) ) const T *          ?+?(          ptrdiff_t, const          T * );
     184forall( dtype T | sized(T) ) volatile T *               ?+?(       volatile T *,          ptrdiff_t );
     185forall( dtype T | sized(T) ) volatile T *               ?+?(          ptrdiff_t,       volatile T * );
     186forall( dtype T | sized(T) ) const volatile T * ?+?( const volatile T *,          ptrdiff_t );
     187forall( dtype T | sized(T) ) const volatile T * ?+?(          ptrdiff_t, const volatile T * );
     188forall( dtype T | sized(T) ) T *                        ?-?(                T *,          ptrdiff_t );
     189forall( dtype T | sized(T) ) const T *          ?-?( const          T *,          ptrdiff_t );
     190forall( dtype T | sized(T) ) volatile T *               ?-?(       volatile T *,          ptrdiff_t );
     191forall( dtype T | sized(T) ) const volatile T * ?-?( const volatile T *,          ptrdiff_t );
     192forall( dtype T | sized(T) ) ptrdiff_t          ?-?( const volatile T *, const volatile T * );
    193193
    194194// ------------------------------------------------------------
     
    428428forall( ftype FT ) FT *                 ?=?( FT * volatile *, forall( ftype FT2 ) FT2 * );
    429429
    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 );
     430forall( dtype T | sized(T) ) T *                        ?+=?(                T *          *, ptrdiff_t );
     431forall( dtype T | sized(T) ) T *                        ?+=?(                T * volatile *, ptrdiff_t );
     432forall( dtype T | sized(T) ) const T *          ?+=?( const          T *          *, ptrdiff_t );
     433forall( dtype T | sized(T) ) const T *          ?+=?( const          T * volatile *, ptrdiff_t );
     434forall( dtype T | sized(T) ) volatile T *               ?+=?(       volatile T *          *, ptrdiff_t );
     435forall( dtype T | sized(T) ) volatile T *               ?+=?(       volatile T * volatile *, ptrdiff_t );
     436forall( dtype T | sized(T) ) const volatile T * ?+=?( const volatile T *          *, ptrdiff_t );
     437forall( dtype T | sized(T) ) const volatile T * ?+=?( const volatile T * volatile *, ptrdiff_t );
     438forall( dtype T | sized(T) ) T *                        ?-=?(                T *          *, ptrdiff_t );
     439forall( dtype T | sized(T) ) T *                        ?-=?(                T * volatile *, ptrdiff_t );
     440forall( dtype T | sized(T) ) const T *          ?-=?( const          T *          *, ptrdiff_t );
     441forall( dtype T | sized(T) ) const T *          ?-=?( const          T * volatile *, ptrdiff_t );
     442forall( dtype T | sized(T) ) volatile T *               ?-=?(       volatile T *          *, ptrdiff_t );
     443forall( dtype T | sized(T) ) volatile T *               ?-=?(       volatile T * volatile *, ptrdiff_t );
     444forall( dtype T | sized(T) ) const volatile T * ?-=?( const volatile T *          *, ptrdiff_t );
     445forall( dtype T | sized(T) ) const volatile T * ?-=?( const volatile T * volatile *, ptrdiff_t );
    446446
    447447_Bool                   ?=?( _Bool *, _Bool ),                                  ?=?( volatile _Bool *, _Bool );
Note: See TracChangeset for help on using the changeset viewer.