Changeset 6edd210


Ignore:
Timestamp:
May 3, 2018, 4:54:06 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, with_gc
Children:
01690b7, f3152ab
Parents:
c9d5c4f
Message:

Change OPTPRINT macro to PASS and incorporate HeapStats::newPass

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    rc9d5c4f r6edd210  
    6363using namespace std;
    6464
    65 #define OPTPRINT(x) if ( errorp ) cerr << x << endl;
    66 
     65#define PASS(name, pass)                   \
     66        if ( errorp ) { cerr << #name << endl; } \
     67        HeapStats::newPass(#name);               \
     68        pass;
    6769
    6870LinkageSpec::Spec linkage = LinkageSpec::Cforall;
     
    245247
    246248                // add the assignment statement after the initialization of a type parameter
    247                 OPTPRINT( "validate" )
    248                 SymTab::validate( translationUnit, symtabp );
     249                PASS( "validate", SymTab::validate( translationUnit, symtabp ) );
    249250                if ( symtabp ) {
    250251                        deleteAll( translationUnit );
     
    263264                } // if
    264265
    265                 OPTPRINT( "mutate" )
    266                 ControlStruct::mutate( translationUnit );
    267                 OPTPRINT( "fixNames" )
    268                 CodeGen::fixNames( translationUnit );
    269                 OPTPRINT( "genInit" )
    270                 InitTweak::genInit( translationUnit );
    271                 OPTPRINT( "expandMemberTuples" );
    272                 Tuples::expandMemberTuples( translationUnit );
     266                PASS( "mutate", ControlStruct::mutate( translationUnit ) );
     267                PASS( "fixNames", CodeGen::fixNames( translationUnit ) );
     268                PASS( "genInit", InitTweak::genInit( translationUnit ) );
     269                PASS( "expandMemberTuples" , Tuples::expandMemberTuples( translationUnit ) );
    273270                if ( libcfap ) {
    274271                        // generate the bodies of cfa library functions
     
    289286                CodeTools::fillLocations( translationUnit );
    290287
    291                 OPTPRINT( "resolve" )
    292                 ResolvExpr::resolve( translationUnit );
     288                PASS( "resolve", ResolvExpr::resolve( translationUnit ) );
    293289                if ( exprp ) {
    294290                        dump( translationUnit );
     
    297293
    298294                // fix ObjectDecl - replaces ConstructorInit nodes
    299                 OPTPRINT( "fixInit" )
    300                 InitTweak::fix( translationUnit, filename, libcfap || treep );
     295                PASS( "fixInit", InitTweak::fix( translationUnit, filename, libcfap || treep ) );
    301296                if ( ctorinitp ) {
    302297                        dump ( translationUnit );
     
    304299                } // if
    305300
    306                 OPTPRINT( "expandUniqueExpr" ); // xxx - is this the right place for this? want to expand ASAP so that subsequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
     301                PASS( "expandUniqueExpr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused
    307302                Tuples::expandUniqueExpr( translationUnit );
    308303
    309                 OPTPRINT( "translateEHM" );
    310                 ControlStruct::translateEHM( translationUnit );
    311 
    312                 OPTPRINT( "generateWaitfor" );
    313                 Concurrency::generateWaitFor( translationUnit );
    314 
    315                 OPTPRINT( "convertSpecializations" ) // needs to happen before tuple types are expanded
    316                 GenPoly::convertSpecializations( translationUnit );
    317 
    318                 OPTPRINT( "expandTuples" ); // xxx - is this the right place for this?
    319                 Tuples::expandTuples( translationUnit );
     304                PASS( "translateEHM" , ControlStruct::translateEHM( translationUnit ) );
     305
     306                PASS( "generateWaitfor" , Concurrency::generateWaitFor( translationUnit ) );
     307
     308                PASS( "convertSpecializations",  GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded
     309
     310                PASS( "expandTuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?
     311
    320312                if ( tuplep ) {
    321313                        dump( translationUnit );
     
    323315                }
    324316
    325                 OPTPRINT( "virtual expandCasts" ) // Must come after translateEHM
    326                 Virtual::expandCasts( translationUnit );
    327 
    328                 OPTPRINT("instantiateGenerics")
    329                 GenPoly::instantiateGeneric( translationUnit );
     317                PASS( "virtual expandCasts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM
     318
     319                PASS( "instantiateGenerics", GenPoly::instantiateGeneric( translationUnit ) );
    330320                if ( genericsp ) {
    331321                        dump( translationUnit );
    332322                        return 0;
    333323                }
    334                 OPTPRINT( "convertLvalue" )
    335                 GenPoly::convertLvalue( translationUnit );
     324                PASS( "convertLvalue", GenPoly::convertLvalue( translationUnit ) );
    336325
    337326
     
    340329                        return 0;
    341330                } // if
    342                 OPTPRINT( "box" )
    343                 GenPoly::box( translationUnit );
     331                PASS( "box", GenPoly::box( translationUnit ) );
    344332
    345333                if ( bcodegenp ) {
     
    353341
    354342                CodeTools::fillLocations( translationUnit );
    355                 OPTPRINT( "codegen" )
    356                 CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks );
     343                PASS( "codegen", CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks ) );
    357344
    358345                CodeGen::FixMain::fix( *output, treep ? "../prelude/bootloader.c" : CFA_LIBDIR "/bootloader.c" );
    359                 OPTPRINT( "end" )
    360 
    361 
    362346                if ( output != &cout ) {
    363347                        delete output;
Note: See TracChangeset for help on using the changeset viewer.