Changeset 978e5eb for src


Ignore:
Timestamp:
Jan 18, 2021, 2:11:11 PM (4 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
3d3d75e
Parents:
4fc3343
Message:

Calculation of specialization benefit (spec "cost") looks inside the body of xInstTypes, counting one benefit for each inner type constructor met. Fixes 225?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/SpecCost.cc

    r4fc3343 r978e5eb  
    4343                // mark specialization of base type
    4444                void postvisit(ReferenceType*) { if ( count >= 0 ) ++count; }
     45
     46                void postvisit(StructInstType*) { if ( count >= 0 ) ++count; }
     47                void postvisit(UnionInstType*) { if ( count >= 0 ) ++count; }
    4548
    4649        private:
     
    8285                void previsit(StructInstType* sty) {
    8386                        count = minover( sty->parameters );
    84                         visit_children = false;
    8587                }
    8688
     
    8890                void previsit(UnionInstType* uty) {
    8991                        count = minover( uty->parameters );
    90                         visit_children = false;
    9192                }
    9293
     
    174175                void postvisit( const ast::ArrayType * ) { if ( count >= 0 ) ++count; }
    175176                void postvisit( const ast::ReferenceType * ) { if ( count >= 0 ) ++count; }
     177
     178                void postvisit( const ast::StructInstType * ) { if ( count >= 0 ) ++count; }
     179                void postvisit( const ast::UnionInstType * ) { if ( count >= 0 ) ++count; }
    176180
    177181                // Use the minimal specialization value over returns and params.
     
    189193                void previsit( const ast::StructInstType * sty ) {
    190194                        count = minimumPresent( sty->params, expr_result );
    191                         visit_children = false;
    192195                }
    193196
     
    195198                void previsit( const ast::UnionInstType * uty ) {
    196199                        count = minimumPresent( uty->params, expr_result );
    197                         visit_children = false;
    198200                }
    199201
Note: See TracChangeset for help on using the changeset viewer.