Changes in / [79ee5b3:2c63fa2]


Ignore:
Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/AST/DeclReplacer.cpp

    r79ee5b3 r2c63fa2  
    99// Author           : Aaron B. Moss
    1010// Created On       : Wed May 8 13:00:00 2019
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Sep 15 11:55:00 2022
    13 // Update Count     : 2
     11// Last Modified By : Aaron B. Moss
     12// Last Modified On : Wed May 8 13:00:00 2019
     13// Update Count     : 1
    1414//
    1515
    1616#include "DeclReplacer.hpp"
     17#include "Expr.hpp"
     18#include "Type.hpp"
    1719
    18 #include "Expr.hpp"
    1920#include "Pass.hpp"
    20 #include "Type.hpp"
    2121
    2222namespace ast {
    2323
    2424namespace DeclReplacer {
     25        namespace {
     26                struct DeclReplacer {
     27                private:
     28                        const DeclMap & declMap;
     29                        const TypeMap & typeMap;
     30                        bool debug;
    2531
    26 namespace {
    27         struct DeclReplacer {
    28         private:
    29                 const DeclMap & declMap;
    30                 const TypeMap & typeMap;
    31                 bool debug;
     32                public:
     33                        DeclReplacer(const DeclMap & declMap, const TypeMap & typeMap, bool debug)
     34                                : declMap( declMap ), typeMap( typeMap ), debug( debug )
     35                        {}
    3236
    33         public:
    34                 DeclReplacer( const DeclMap & declMap, const TypeMap & typeMap, bool debug )
    35                         : declMap( declMap ), typeMap( typeMap ), debug( debug )
    36                 {}
     37                        const ast::VariableExpr * previsit( const ast::VariableExpr * );
     38                        const ast::TypeInstType * previsit( const ast::TypeInstType * );
     39                };
    3740
    38                 const ast::VariableExpr * previsit( const ast::VariableExpr * );
    39                 const ast::TypeInstType * previsit( const ast::TypeInstType * );
    40         };
     41                struct VarExprReplacer {
     42                private:
     43                        const ExprMap & exprMap;
     44                       
     45                public:
     46                        VarExprReplacer(const ExprMap & exprMap): exprMap (exprMap) {}
    4147
    42         struct VarExprReplacer {
    43         private:
    44                 const ExprMap & exprMap;
     48                        const Expr * postvisit (const VariableExpr *);
     49                };
     50        }
    4551
    46         public:
    47                 VarExprReplacer( const ExprMap & exprMap ) : exprMap( exprMap ) {}
     52        const ast::Node * replace( const ast::Node * node, const DeclMap & declMap, const TypeMap & typeMap, bool debug ) {
     53                if(!node) return nullptr;
     54                Pass<DeclReplacer> replacer = { declMap, typeMap, debug };
     55                return node->accept( replacer );
     56        }
    4857
    49                 const Expr * postvisit( const VariableExpr * );
    50         };
    51 } // namespace
     58        const ast::Node * replace( const ast::Node * node, const DeclMap & declMap, bool debug ) {
     59                TypeMap typeMap;
     60                return replace( node, declMap, typeMap, debug );
     61        }
    5262
    53 const ast::Node * replace( const ast::Node * node, const DeclMap & declMap, const TypeMap & typeMap, bool debug ) {
    54         if(!node) return nullptr;
    55         Pass<DeclReplacer> replacer = { declMap, typeMap, debug };
    56         return node->accept( replacer );
     63        const ast::Node * replace( const ast::Node * node, const TypeMap & typeMap, bool debug ) {
     64                DeclMap declMap;
     65                return replace( node, declMap, typeMap, debug );
     66        }
     67
     68        const ast::Node * replace( const ast::Node * node, const ExprMap & exprMap) {
     69                Pass<VarExprReplacer> replacer = {exprMap};
     70                return node->accept( replacer );
     71        }
     72
     73        namespace {
     74                // replace variable with new node from decl map
     75                const ast::VariableExpr * DeclReplacer::previsit( const VariableExpr * varExpr ) {
     76                        // xxx - assertions and parameters aren't accounted for in this... (i.e. they aren't inserted into the map when it's made, only DeclStmts are)
     77                        if ( !declMap.count( varExpr->var ) ) return varExpr;
     78
     79                        auto replacement = declMap.at( varExpr->var );
     80                        if ( debug ) {
     81                                std::cerr << "replacing variable reference: "
     82                                        << (void*)varExpr->var.get() << " " << varExpr->var
     83                                        << " with " << (void*)replacement << " " << replacement
     84                                        << std::endl;
     85                        }
     86                        auto nexpr = mutate(varExpr);
     87                        nexpr->var = replacement;
     88                        return nexpr;
     89                }
     90
     91                const TypeInstType * DeclReplacer::previsit( const TypeInstType * inst ) {
     92                        if ( !typeMap.count( inst->base ) ) return inst;
     93
     94                        auto replacement = typeMap.at( inst->base );
     95                        if ( debug ) {
     96                                std::cerr << "replacing type reference: "
     97                                        << (void*)inst->base.get() << " " << inst->base
     98                                        << " with " << (void*)replacement << " " << replacement
     99                                        << std::endl;
     100                        }
     101                        auto ninst = mutate(inst);
     102                        ninst->base = replacement;
     103                        return ninst;
     104                }
     105
     106                const Expr * VarExprReplacer::postvisit( const VariableExpr * expr ) {
     107                        if (!exprMap.count(expr->var)) return expr;
     108
     109                        return exprMap.at(expr->var);
     110                }
     111
     112        }
    57113}
    58114
    59 const ast::Node * replace( const ast::Node * node, const DeclMap & declMap, bool debug ) {
    60         TypeMap typeMap;
    61         return replace( node, declMap, typeMap, debug );
    62115}
    63 
    64 const ast::Node * replace( const ast::Node * node, const TypeMap & typeMap, bool debug ) {
    65         DeclMap declMap;
    66         return replace( node, declMap, typeMap, debug );
    67 }
    68 
    69 const ast::Node * replace( const ast::Node * node, const ExprMap & exprMap ) {
    70         Pass<VarExprReplacer> replacer = {exprMap};
    71         return node->accept( replacer );
    72 }
    73 
    74 namespace {
    75         // replace variable with new node from decl map
    76         const ast::VariableExpr * DeclReplacer::previsit( const VariableExpr * varExpr ) {
    77                 // xxx - assertions and parameters aren't accounted for in this... (i.e. they aren't inserted into the map when it's made, only DeclStmts are)
    78                 if ( !declMap.count( varExpr->var ) ) return varExpr;
    79 
    80                 auto replacement = declMap.at( varExpr->var );
    81                 if ( debug ) {
    82                         std::cerr << "replacing variable reference: "
    83                                 << (void*)varExpr->var.get() << " " << varExpr->var
    84                                 << " with " << (void*)replacement << " " << replacement
    85                                 << std::endl;
    86                 }
    87                 auto nexpr = mutate(varExpr);
    88                 nexpr->var = replacement;
    89                 return nexpr;
    90         }
    91 
    92         const TypeInstType * DeclReplacer::previsit( const TypeInstType * inst ) {
    93                 if ( !typeMap.count( inst->base ) ) return inst;
    94 
    95                 auto replacement = typeMap.at( inst->base );
    96                 if ( debug ) {
    97                         std::cerr << "replacing type reference: "
    98                                 << (void*)inst->base.get() << " " << inst->base
    99                                 << " with " << (void*)replacement << " " << replacement
    100                                 << std::endl;
    101                 }
    102                 auto ninst = mutate(inst);
    103                 ninst->base = replacement;
    104                 return ninst;
    105         }
    106 
    107         const Expr * VarExprReplacer::postvisit( const VariableExpr * expr ) {
    108                 if ( !exprMap.count( expr->var ) ) return expr;
    109                 return exprMap.at( expr->var );
    110         }
    111 } // namespace
    112 
    113 } // namespace DeclReplacer
    114 
    115 } // namespace ast
    116116
    117117// Local Variables: //
  • src/main.cc

    r79ee5b3 r2c63fa2  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu Sep 15 13:58:00 2022
    13 // Update Count     : 678
     12// Last Modified On : Thu 11 12:18:00 2022
     13// Update Count     : 677
    1414//
    1515
     
    3838#include "CodeGen/Generate.h"               // for generate
    3939#include "CodeGen/LinkOnce.h"               // for translateLinkOnce
     40#include "CodeTools/DeclStats.h"            // for printDeclStats
     41#include "CodeTools/ResolvProtoDump.h"      // for dumpAsResolvProto
    4042#include "CodeTools/TrackLoc.h"             // for fillLocations
    4143#include "Common/CodeLocationTools.hpp"     // for forceFillCodeLocations
     
    4345#include "Common/DeclStats.hpp"             // for printDeclStats
    4446#include "Common/ResolvProtoDump.hpp"       // for dumpAsResolverProto
    45 #include "Common/Stats.h"                   // for Stats
     47#include "Common/Stats.h"
     48#include "Common/PassVisitor.h"
     49#include "Common/SemanticError.h"           // for SemanticError
    4650#include "Common/UnimplementedError.h"      // for UnimplementedError
    4751#include "Common/utility.h"                 // for deleteAll, filter, printAll
     
    4953#include "Concurrency/Waitfor.h"            // for generateWaitfor
    5054#include "ControlStruct/ExceptDecl.h"       // for translateExcept
    51 #include "ControlStruct/ExceptTranslate.h"  // for translateThrows, translat...
     55#include "ControlStruct/ExceptTranslate.h"  // for translateEHM
    5256#include "ControlStruct/FixLabels.hpp"      // for fixLabels
    5357#include "ControlStruct/HoistControlDecls.hpp" //  hoistControlDecls
     58#include "ControlStruct/Mutate.h"           // for mutate
    5459#include "GenPoly/Box.h"                    // for box
    5560#include "GenPoly/InstantiateGeneric.h"     // for instantiateGeneric
     
    6166#include "Parser/ParseNode.h"               // for DeclarationNode, buildList
    6267#include "Parser/TypedefTable.h"            // for TypedefTable
     68#include "ResolvExpr/AlternativePrinter.h"  // for AlternativePrinter
    6369#include "ResolvExpr/CandidatePrinter.hpp"  // for printCandidates
    6470#include "ResolvExpr/Resolver.h"            // for resolve
     71#include "SymTab/Validate.h"                // for validate
     72#include "SymTab/ValidateType.h"            // for linkReferenceToTypes
    6573#include "SynTree/LinkageSpec.h"            // for Spec, Cforall, Intrinsic
    6674#include "SynTree/Declaration.h"            // for Declaration
     75#include "SynTree/Visitor.h"                // for acceptAll
    6776#include "Tuples/Tuples.h"                  // for expandMemberTuples, expan...
    6877#include "Validate/Autogen.hpp"             // for autogenerateRoutines
     
    321330                Stats::Time::StopBlock();
    322331
    323                 if (Stats::Counters::enabled) {
    324                         ast::pass_visitor_stats.avg = Stats::Counters::build<Stats::Counters::AverageCounter<double>>("Average Depth - New");
    325                         ast::pass_visitor_stats.max = Stats::Counters::build<Stats::Counters::MaxCounter<double>>("Max depth - New");
     332                if( useNewAST ) {
     333                        if (Stats::Counters::enabled) {
     334                                ast::pass_visitor_stats.avg = Stats::Counters::build<Stats::Counters::AverageCounter<double>>("Average Depth - New");
     335                                ast::pass_visitor_stats.max = Stats::Counters::build<Stats::Counters::MaxCounter<double>>("Max depth - New");
     336                        }
     337                        auto transUnit = convert( move( translationUnit ) );
     338
     339                        forceFillCodeLocations( transUnit );
     340
     341                        PASS( "Translate Exception Declarations", ControlStruct::translateExcept( transUnit ) );
     342                        if ( exdeclp ) {
     343                                dump( move( transUnit ) );
     344                                return EXIT_SUCCESS;
     345                        }
     346
     347                        PASS( "Verify Ctor, Dtor & Assign", Validate::verifyCtorDtorAssign( transUnit ) );
     348                        PASS( "Hoist Type Decls", Validate::hoistTypeDecls( transUnit ) );
     349                        // Hoist Type Decls pulls some declarations out of contexts where
     350                        // locations are not tracked. Perhaps they should be, but for now
     351                        // the full fill solves it.
     352                        forceFillCodeLocations( transUnit );
     353
     354                        PASS( "Replace Typedefs", Validate::replaceTypedef( transUnit ) );
     355                        PASS( "Fix Return Types", Validate::fixReturnTypes( transUnit ) );
     356                        PASS( "Enum and Pointer Decay", Validate::decayEnumsAndPointers( transUnit ) );
     357
     358                        PASS( "Link Reference To Types", Validate::linkReferenceToTypes( transUnit ) );
     359
     360                        PASS( "Fix Qualified Types", Validate::fixQualifiedTypes( transUnit ) );
     361                        PASS( "Hoist Struct", Validate::hoistStruct( transUnit ) );
     362                        PASS( "Eliminate Typedef", Validate::eliminateTypedef( transUnit ) );
     363                        PASS( "Validate Generic Parameters", Validate::fillGenericParameters( transUnit ) );
     364                        PASS( "Translate Dimensions", Validate::translateDimensionParameters( transUnit ) );
     365                        PASS( "Check Function Returns", Validate::checkReturnStatements( transUnit ) );
     366                        PASS( "Fix Return Statements", InitTweak::fixReturnStatements( transUnit ) );
     367                        PASS( "Implement Concurrent Keywords", Concurrency::implementKeywords( transUnit ) );
     368                        PASS( "Forall Pointer Decay", Validate::decayForallPointers( transUnit ) );
     369                        PASS( "Hoist Control Declarations", ControlStruct::hoistControlDecls( transUnit ) );
     370
     371                        PASS( "Generate Autogen Routines", Validate::autogenerateRoutines( transUnit ) );
     372
     373                        PASS( "Implement Mutex", Concurrency::implementMutex( transUnit ) );
     374                        PASS( "Implement Thread Start", Concurrency::implementThreadStarter( transUnit ) );
     375                        PASS( "Compound Literal", Validate::handleCompoundLiterals( transUnit ) );
     376                        PASS( "Set Length From Initializer", Validate::setLengthFromInitializer( transUnit ) );
     377                        PASS( "Find Global Decls", Validate::findGlobalDecls( transUnit ) );
     378                        PASS( "Fix Label Address", Validate::fixLabelAddresses( transUnit ) );
     379
     380                        if ( symtabp ) {
     381                                return EXIT_SUCCESS;
     382                        } // if
     383
     384                        if ( expraltp ) {
     385                                ResolvExpr::printCandidates( transUnit );
     386                                return EXIT_SUCCESS;
     387                        } // if
     388
     389                        if ( validp ) {
     390                                dump( move( transUnit ) );
     391                                return EXIT_SUCCESS;
     392                        } // if
     393
     394                        PASS( "Translate Throws", ControlStruct::translateThrows( transUnit ) );
     395                        PASS( "Fix Labels", ControlStruct::fixLabels( transUnit ) );
     396                        PASS( "Fix Names", CodeGen::fixNames( transUnit ) );
     397                        PASS( "Gen Init", InitTweak::genInit( transUnit ) );
     398                        PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( transUnit ) );
     399
     400                        if ( libcfap ) {
     401                                // Generate the bodies of cfa library functions.
     402                                LibCfa::makeLibCfa( transUnit );
     403                        } // if
     404
     405                        if ( declstatsp ) {
     406                                printDeclStats( transUnit );
     407                                return EXIT_SUCCESS;
     408                        } // if
     409
     410                        if ( bresolvep ) {
     411                                dump( move( transUnit ) );
     412                                return EXIT_SUCCESS;
     413                        } // if
     414
     415                        if ( resolvprotop ) {
     416                                dumpAsResolverProto( transUnit );
     417                                return EXIT_SUCCESS;
     418                        } // if
     419
     420                        PASS( "Resolve", ResolvExpr::resolve( transUnit ) );
     421                        if ( exprp ) {
     422                                dump( move( transUnit ) );
     423                                return EXIT_SUCCESS;
     424                        } // if
     425
     426                        forceFillCodeLocations( transUnit );
     427
     428                        PASS( "Fix Init", InitTweak::fix(transUnit, buildingLibrary()));
     429
     430                        // fix ObjectDecl - replaces ConstructorInit nodes
     431                        if ( ctorinitp ) {
     432                                dump( move( transUnit ) );
     433                                return EXIT_SUCCESS;
     434                        } // if
     435
     436                        // Currently not working due to unresolved issues with UniqueExpr
     437                        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
     438
     439                        PASS( "Translate Tries", ControlStruct::translateTries( transUnit ) );
     440                        PASS( "Gen Waitfor", Concurrency::generateWaitFor( transUnit ) );
     441
     442                        // Needs to happen before tuple types are expanded.
     443                        PASS( "Convert Specializations",  GenPoly::convertSpecializations( transUnit ) );
     444
     445                        PASS( "Expand Tuples", Tuples::expandTuples( transUnit ) );
     446
     447                        if ( tuplep ) {
     448                                dump( move( transUnit ) );
     449                                return EXIT_SUCCESS;
     450                        } // if
     451
     452                        // Must come after Translate Tries.
     453                        PASS( "Virtual Expand Casts", Virtual::expandCasts( transUnit ) );
     454
     455                        PASS( "Instantiate Generics", GenPoly::instantiateGeneric( transUnit ) );
     456
     457                        translationUnit = convert( move( transUnit ) );
     458                } else {
     459                        PASS( "Translate Exception Declarations", ControlStruct::translateExcept( translationUnit ) );
     460                        if ( exdeclp ) {
     461                                dump( translationUnit );
     462                                return EXIT_SUCCESS;
     463                        } // if
     464
     465                        // add the assignment statement after the initialization of a type parameter
     466                        PASS( "Validate", SymTab::validate( translationUnit ) );
     467
     468                        if ( symtabp ) {
     469                                deleteAll( translationUnit );
     470                                return EXIT_SUCCESS;
     471                        } // if
     472
     473                        if ( expraltp ) {
     474                                PassVisitor<ResolvExpr::AlternativePrinter> printer( cout );
     475                                acceptAll( translationUnit, printer );
     476                                return EXIT_SUCCESS;
     477                        } // if
     478
     479                        if ( validp ) {
     480                                dump( translationUnit );
     481                                return EXIT_SUCCESS;
     482                        } // if
     483
     484                        PASS( "Translate Throws", ControlStruct::translateThrows( translationUnit ) );
     485                        PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) );
     486                        PASS( "Fix Names", CodeGen::fixNames( translationUnit ) );
     487                        PASS( "Gen Init", InitTweak::genInit( translationUnit ) );
     488                        PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) );
     489
     490                        if ( libcfap ) {
     491                                // Generate the bodies of cfa library functions.
     492                                LibCfa::makeLibCfa( translationUnit );
     493                        } // if
     494
     495                        if ( declstatsp ) {
     496                                CodeTools::printDeclStats( translationUnit );
     497                                deleteAll( translationUnit );
     498                                return EXIT_SUCCESS;
     499                        } // if
     500
     501                        if ( bresolvep ) {
     502                                dump( translationUnit );
     503                                return EXIT_SUCCESS;
     504                        } // if
     505
     506                        CodeTools::fillLocations( translationUnit );
     507
     508                        if ( resolvprotop ) {
     509                                CodeTools::dumpAsResolvProto( translationUnit );
     510                                return EXIT_SUCCESS;
     511                        } // if
     512
     513                        PASS( "Resolve", ResolvExpr::resolve( translationUnit ) );
     514                        if ( exprp ) {
     515                                dump( translationUnit );
     516                                return EXIT_SUCCESS;
     517                        }
     518
     519                        PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) );
     520
     521                        // fix ObjectDecl - replaces ConstructorInit nodes
     522                        if ( ctorinitp ) {
     523                                dump ( translationUnit );
     524                                return EXIT_SUCCESS;
     525                        } // if
     526
     527                        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
     528                        PASS( "Translate Tries", ControlStruct::translateTries( translationUnit ) );
     529                        PASS( "Gen Waitfor", Concurrency::generateWaitFor( translationUnit ) );
     530                        PASS( "Convert Specializations",  GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded
     531                        PASS( "Expand Tuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?
     532
     533                        if ( tuplep ) {
     534                                dump( translationUnit );
     535                                return EXIT_SUCCESS;
     536                        } // if
     537
     538                        PASS( "Virtual Expand Casts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM
     539
     540                        PASS( "Instantiate Generics", GenPoly::instantiateGeneric( translationUnit ) );
    326541                }
    327                 auto transUnit = convert( move( translationUnit ) );
    328 
    329                 forceFillCodeLocations( transUnit );
    330 
    331                 PASS( "Translate Exception Declarations", ControlStruct::translateExcept( transUnit ) );
    332                 if ( exdeclp ) {
    333                         dump( move( transUnit ) );
    334                         return EXIT_SUCCESS;
    335                 }
    336 
    337                 PASS( "Verify Ctor, Dtor & Assign", Validate::verifyCtorDtorAssign( transUnit ) );
    338                 PASS( "Hoist Type Decls", Validate::hoistTypeDecls( transUnit ) );
    339                 // Hoist Type Decls pulls some declarations out of contexts where
    340                 // locations are not tracked. Perhaps they should be, but for now
    341                 // the full fill solves it.
    342                 forceFillCodeLocations( transUnit );
    343 
    344                 PASS( "Replace Typedefs", Validate::replaceTypedef( transUnit ) );
    345                 PASS( "Fix Return Types", Validate::fixReturnTypes( transUnit ) );
    346                 PASS( "Enum and Pointer Decay", Validate::decayEnumsAndPointers( transUnit ) );
    347 
    348                 PASS( "Link Reference To Types", Validate::linkReferenceToTypes( transUnit ) );
    349 
    350                 PASS( "Fix Qualified Types", Validate::fixQualifiedTypes( transUnit ) );
    351                 PASS( "Hoist Struct", Validate::hoistStruct( transUnit ) );
    352                 PASS( "Eliminate Typedef", Validate::eliminateTypedef( transUnit ) );
    353                 PASS( "Validate Generic Parameters", Validate::fillGenericParameters( transUnit ) );
    354                 PASS( "Translate Dimensions", Validate::translateDimensionParameters( transUnit ) );
    355                 PASS( "Check Function Returns", Validate::checkReturnStatements( transUnit ) );
    356                 PASS( "Fix Return Statements", InitTweak::fixReturnStatements( transUnit ) );
    357                 PASS( "Implement Concurrent Keywords", Concurrency::implementKeywords( transUnit ) );
    358                 PASS( "Forall Pointer Decay", Validate::decayForallPointers( transUnit ) );
    359                 PASS( "Hoist Control Declarations", ControlStruct::hoistControlDecls( transUnit ) );
    360 
    361                 PASS( "Generate Autogen Routines", Validate::autogenerateRoutines( transUnit ) );
    362 
    363                 PASS( "Implement Mutex", Concurrency::implementMutex( transUnit ) );
    364                 PASS( "Implement Thread Start", Concurrency::implementThreadStarter( transUnit ) );
    365                 PASS( "Compound Literal", Validate::handleCompoundLiterals( transUnit ) );
    366                 PASS( "Set Length From Initializer", Validate::setLengthFromInitializer( transUnit ) );
    367                 PASS( "Find Global Decls", Validate::findGlobalDecls( transUnit ) );
    368                 PASS( "Fix Label Address", Validate::fixLabelAddresses( transUnit ) );
    369 
    370                 if ( symtabp ) {
    371                         return EXIT_SUCCESS;
    372                 } // if
    373 
    374                 if ( expraltp ) {
    375                         ResolvExpr::printCandidates( transUnit );
    376                         return EXIT_SUCCESS;
    377                 } // if
    378 
    379                 if ( validp ) {
    380                         dump( move( transUnit ) );
    381                         return EXIT_SUCCESS;
    382                 } // if
    383 
    384                 PASS( "Translate Throws", ControlStruct::translateThrows( transUnit ) );
    385                 PASS( "Fix Labels", ControlStruct::fixLabels( transUnit ) );
    386                 PASS( "Fix Names", CodeGen::fixNames( transUnit ) );
    387                 PASS( "Gen Init", InitTweak::genInit( transUnit ) );
    388                 PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( transUnit ) );
    389 
    390                 if ( libcfap ) {
    391                         // Generate the bodies of cfa library functions.
    392                         LibCfa::makeLibCfa( transUnit );
    393                 } // if
    394 
    395                 if ( declstatsp ) {
    396                         printDeclStats( transUnit );
    397                         return EXIT_SUCCESS;
    398                 } // if
    399 
    400                 if ( bresolvep ) {
    401                         dump( move( transUnit ) );
    402                         return EXIT_SUCCESS;
    403                 } // if
    404 
    405                 if ( resolvprotop ) {
    406                         dumpAsResolverProto( transUnit );
    407                         return EXIT_SUCCESS;
    408                 } // if
    409 
    410                 PASS( "Resolve", ResolvExpr::resolve( transUnit ) );
    411                 if ( exprp ) {
    412                         dump( move( transUnit ) );
    413                         return EXIT_SUCCESS;
    414                 } // if
    415 
    416                 forceFillCodeLocations( transUnit );
    417 
    418                 PASS( "Fix Init", InitTweak::fix(transUnit, buildingLibrary()));
    419 
    420                 // fix ObjectDecl - replaces ConstructorInit nodes
    421                 if ( ctorinitp ) {
    422                         dump( move( transUnit ) );
    423                         return EXIT_SUCCESS;
    424                 } // if
    425 
    426                 // Currently not working due to unresolved issues with UniqueExpr
    427                 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
    428 
    429                 PASS( "Translate Tries", ControlStruct::translateTries( transUnit ) );
    430                 PASS( "Gen Waitfor", Concurrency::generateWaitFor( transUnit ) );
    431 
    432                 // Needs to happen before tuple types are expanded.
    433                 PASS( "Convert Specializations",  GenPoly::convertSpecializations( transUnit ) );
    434 
    435                 PASS( "Expand Tuples", Tuples::expandTuples( transUnit ) );
    436 
    437                 if ( tuplep ) {
    438                         dump( move( transUnit ) );
    439                         return EXIT_SUCCESS;
    440                 } // if
    441 
    442                 // Must come after Translate Tries.
    443                 PASS( "Virtual Expand Casts", Virtual::expandCasts( transUnit ) );
    444 
    445                 PASS( "Instantiate Generics", GenPoly::instantiateGeneric( transUnit ) );
    446 
    447                 translationUnit = convert( move( transUnit ) );
    448542
    449543                if ( genericsp ) {
Note: See TracChangeset for help on using the changeset viewer.