Changeset 7770cc8 for src/main.cc


Ignore:
Timestamp:
Nov 24, 2021, 9:47:56 PM (4 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
5235d49
Parents:
94647b0b (diff), 3cc1111 (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:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    r94647b0b r7770cc8  
    99// Author           : Peter Buhr and Rob Schluntz
    1010// Created On       : Fri May 15 23:12:02 2015
    11 // Last Modified By : Henry Xue
    12 // Last Modified On : Mon Aug 23 15:42:08 2021
    13 // Update Count     : 650
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Nov 12 11:06:00 2021
     13// Update Count     : 658
    1414//
    1515
     
    4343#include "Common/CodeLocationTools.hpp"     // for forceFillCodeLocations
    4444#include "Common/CompilerError.h"           // for CompilerError
     45#include "Common/DeclStats.hpp"             // for printDeclStats
     46#include "Common/ResolvProtoDump.hpp"       // for dumpAsResolverProto
    4547#include "Common/Stats.h"
    4648#include "Common/PassVisitor.h"
     
    5153#include "ControlStruct/ExceptDecl.h"       // for translateExcept
    5254#include "ControlStruct/ExceptTranslate.h"  // for translateEHM
     55#include "ControlStruct/FixLabels.hpp"      // for fixLabels
    5356#include "ControlStruct/Mutate.h"           // for mutate
    5457#include "GenPoly/Box.h"                    // for box
     
    6265#include "Parser/TypedefTable.h"            // for TypedefTable
    6366#include "ResolvExpr/AlternativePrinter.h"  // for AlternativePrinter
     67#include "ResolvExpr/CandidatePrinter.hpp"  // for printCandidates
    6468#include "ResolvExpr/Resolver.h"            // for resolve
    6569#include "SymTab/Validate.h"                // for validate
     
    6872#include "SynTree/Visitor.h"                // for acceptAll
    6973#include "Tuples/Tuples.h"                  // for expandMemberTuples, expan...
     74#include "Validate/FindSpecialDecls.h"      // for findGlobalDecls
     75#include "Validate/InitializerLength.hpp"   // for setLengthFromInitializer
     76#include "Validate/LabelAddressFixer.hpp"   // for fixLabelAddresses
    7077#include "Virtual/ExpandCasts.h"            // for expandCasts
    7178
     
    314321
    315322                // add the assignment statement after the initialization of a type parameter
    316                 PASS( "Validate", SymTab::validate( translationUnit, symtabp ) );
    317                 if ( symtabp ) {
    318                         deleteAll( translationUnit );
    319                         return EXIT_SUCCESS;
    320                 } // if
    321 
    322                 if ( expraltp ) {
    323                         PassVisitor<ResolvExpr::AlternativePrinter> printer( cout );
    324                         acceptAll( translationUnit, printer );
    325                         return EXIT_SUCCESS;
    326                 } // if
    327 
    328                 if ( validp ) {
    329                         dump( translationUnit );
    330                         return EXIT_SUCCESS;
    331                 } // if
    332 
    333                 PASS( "Translate Throws", ControlStruct::translateThrows( translationUnit ) );
    334                 PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) );
    335                 PASS( "Fix Names", CodeGen::fixNames( translationUnit ) );
    336                 PASS( "Gen Init", InitTweak::genInit( translationUnit ) );
    337 
    338                 if ( libcfap ) {
    339                         // generate the bodies of cfa library functions
    340                         LibCfa::makeLibCfa( translationUnit );
    341                 } // if
    342 
    343                 if ( declstatsp ) {
    344                         CodeTools::printDeclStats( translationUnit );
    345                         deleteAll( translationUnit );
    346                         return EXIT_SUCCESS;
    347                 } // if
    348 
    349                 if ( bresolvep ) {
    350                         dump( translationUnit );
    351                         return EXIT_SUCCESS;
    352                 } // if
     323                PASS( "Validate-A", SymTab::validate_A( translationUnit ) );
     324                PASS( "Validate-B", SymTab::validate_B( translationUnit ) );
     325                PASS( "Validate-C", SymTab::validate_C( translationUnit ) );
     326                PASS( "Validate-D", SymTab::validate_D( translationUnit ) );
     327                PASS( "Validate-E", SymTab::validate_E( translationUnit ) );
    353328
    354329                CodeTools::fillLocations( translationUnit );
    355 
    356                 if ( resolvprotop ) {
    357                         CodeTools::dumpAsResolvProto( translationUnit );
    358                         return EXIT_SUCCESS;
    359                 } // if
    360330
    361331                if( useNewAST ) {
     
    366336                        auto transUnit = convert( move( translationUnit ) );
    367337
     338                        forceFillCodeLocations( transUnit );
     339
     340                        PASS( "Set Length From Initializer", Validate::setLengthFromInitializer( transUnit ) );
     341                        PASS( "Find Global Decls", Validate::findGlobalDecls( transUnit ) );
     342                        PASS( "Fix Label Address", Validate::fixLabelAddresses( transUnit ) );
     343
     344                        if ( symtabp ) {
     345                                return EXIT_SUCCESS;
     346                        } // if
     347
     348                        if ( expraltp ) {
     349                                ResolvExpr::printCandidates( transUnit );
     350                                return EXIT_SUCCESS;
     351                        } // if
     352
     353                        if ( validp ) {
     354                                dump( move( transUnit ) );
     355                                return EXIT_SUCCESS;
     356                        } // if
     357
     358                        PASS( "Translate Throws", ControlStruct::translateThrows( transUnit ) );
     359                        PASS( "Fix Labels", ControlStruct::fixLabels( transUnit ) );
     360                        PASS( "Fix Names", CodeGen::fixNames( transUnit ) );
     361                        PASS( "Gen Init", InitTweak::genInit( transUnit ) );
    368362                        PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( transUnit ) );
    369                        
     363
     364                        if ( libcfap ) {
     365                                // Generate the bodies of cfa library functions.
     366                                LibCfa::makeLibCfa( transUnit );
     367                        } // if
     368
     369                        if ( declstatsp ) {
     370                                printDeclStats( transUnit );
     371                                return EXIT_SUCCESS;
     372                        } // if
     373
     374                        if ( bresolvep ) {
     375                                dump( move( transUnit ) );
     376                                return EXIT_SUCCESS;
     377                        } // if
     378
     379                        if ( resolvprotop ) {
     380                                dumpAsResolverProto( transUnit );
     381                                return EXIT_SUCCESS;
     382                        } // if
     383
    370384                        PASS( "Resolve", ResolvExpr::resolve( transUnit ) );
    371385                        if ( exprp ) {
     
    377391
    378392                        PASS( "Fix Init", InitTweak::fix(transUnit, buildingLibrary()));
     393
     394                        // fix ObjectDecl - replaces ConstructorInit nodes
     395                        if ( ctorinitp ) {
     396                                dump( move( transUnit ) );
     397                                return EXIT_SUCCESS;
     398                        } // if
     399
     400                        // Currently not working due to unresolved issues with UniqueExpr
     401                        PASS( "Expand Unique Expr", Tuples::expandUniqueExpr( transUnit ) ); // 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
    379402                        translationUnit = convert( move( transUnit ) );
    380403                } else {
     404                        PASS( "Validate-F", SymTab::validate_F( translationUnit ) );
     405
     406                        if ( symtabp ) {
     407                                deleteAll( translationUnit );
     408                                return EXIT_SUCCESS;
     409                        } // if
     410
     411                        if ( expraltp ) {
     412                                PassVisitor<ResolvExpr::AlternativePrinter> printer( cout );
     413                                acceptAll( translationUnit, printer );
     414                                return EXIT_SUCCESS;
     415                        } // if
     416
     417                        if ( validp ) {
     418                                dump( translationUnit );
     419                                return EXIT_SUCCESS;
     420                        } // if
     421
     422                        PASS( "Translate Throws", ControlStruct::translateThrows( translationUnit ) );
     423                        PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) );
     424                        PASS( "Fix Names", CodeGen::fixNames( translationUnit ) );
     425                        PASS( "Gen Init", InitTweak::genInit( translationUnit ) );
    381426                        PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) );
     427
     428                        if ( libcfap ) {
     429                                // Generate the bodies of cfa library functions.
     430                                LibCfa::makeLibCfa( translationUnit );
     431                        } // if
     432
     433                        if ( declstatsp ) {
     434                                CodeTools::printDeclStats( translationUnit );
     435                                deleteAll( translationUnit );
     436                                return EXIT_SUCCESS;
     437                        } // if
     438
     439                        if ( bresolvep ) {
     440                                dump( translationUnit );
     441                                return EXIT_SUCCESS;
     442                        } // if
     443
     444                        CodeTools::fillLocations( translationUnit );
     445
     446                        if ( resolvprotop ) {
     447                                CodeTools::dumpAsResolvProto( translationUnit );
     448                                return EXIT_SUCCESS;
     449                        } // if
    382450
    383451                        PASS( "Resolve", ResolvExpr::resolve( translationUnit ) );
     
    388456
    389457                        PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) );
     458
     459                        // fix ObjectDecl - replaces ConstructorInit nodes
     460                        if ( ctorinitp ) {
     461                                dump ( translationUnit );
     462                                return EXIT_SUCCESS;
     463                        } // if
     464
     465                        PASS( "Expand Unique Expr", 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
    390466                }
    391 
    392                 // fix ObjectDecl - replaces ConstructorInit nodes
    393                 if ( ctorinitp ) {
    394                         dump ( translationUnit );
    395                         return EXIT_SUCCESS;
    396                 } // if
    397 
    398                 PASS( "Expand Unique Expr", 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
    399467
    400468                PASS( "Translate Tries" , ControlStruct::translateTries( translationUnit ) );
     
    443511                PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! genproto, prettycodegenp, true, linemarks ) );
    444512
    445                 CodeGen::FixMain::fix( *output, (PreludeDirector + "/bootloader.c").c_str() );
     513                CodeGen::FixMain::fix( translationUnit, *output,
     514                                (PreludeDirector + "/bootloader.c").c_str() );
    446515                if ( output != &cout ) {
    447516                        delete output;
Note: See TracChangeset for help on using the changeset viewer.