Ignore:
Timestamp:
Feb 24, 2017, 1:28:00 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
23c4aa8
Parents:
c00ddfe (diff), 783dfd6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeTools/DeclStats.cc

    rc00ddfe r255b294  
    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               
Note: See TracChangeset for help on using the changeset viewer.