Changes in src/main.cc [01d433e:1622af5]
- File:
-
- 1 edited
-
src/main.cc (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/main.cc
r01d433e r1622af5 9 9 // Author : Peter Buhr and Rob Schluntz 10 10 // Created On : Fri May 15 23:12:02 2015 11 // Last Modified By : Henry Xue12 // Last Modified On : Tue Jul 20 04:27:35202113 // Update Count : 65 811 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Nov 9 11:10:00 2021 13 // Update Count : 657 14 14 // 15 15 … … 43 43 #include "Common/CodeLocationTools.hpp" // for forceFillCodeLocations 44 44 #include "Common/CompilerError.h" // for CompilerError 45 #include "Common/DeclStats.hpp" // for printDeclStats 46 #include "Common/ResolvProtoDump.hpp" // for dumpAsResolverProto 45 47 #include "Common/Stats.h" 46 48 #include "Common/PassVisitor.h" … … 51 53 #include "ControlStruct/ExceptDecl.h" // for translateExcept 52 54 #include "ControlStruct/ExceptTranslate.h" // for translateEHM 55 #include "ControlStruct/FixLabels.hpp" // for fixLabels 53 56 #include "ControlStruct/Mutate.h" // for mutate 54 57 #include "GenPoly/Box.h" // for box … … 62 65 #include "Parser/TypedefTable.h" // for TypedefTable 63 66 #include "ResolvExpr/AlternativePrinter.h" // for AlternativePrinter 67 #include "ResolvExpr/CandidatePrinter.hpp" // for printCandidates 64 68 #include "ResolvExpr/Resolver.h" // for resolve 65 69 #include "SymTab/Validate.h" // for validate … … 315 319 // add the assignment statement after the initialization of a type parameter 316 320 PASS( "Validate", SymTab::validate( translationUnit, symtabp ) ); 317 if ( symtabp ) {318 deleteAll( translationUnit );319 return EXIT_SUCCESS;320 } // if321 322 if ( expraltp ) {323 PassVisitor<ResolvExpr::AlternativePrinter> printer( cout );324 acceptAll( translationUnit, printer );325 return EXIT_SUCCESS;326 } // if327 328 if ( validp ) {329 dump( translationUnit );330 return EXIT_SUCCESS;331 } // if332 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 PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) );338 if ( libcfap ) {339 // generate the bodies of cfa library functions340 LibCfa::makeLibCfa( translationUnit );341 } // if342 343 if ( declstatsp ) {344 CodeTools::printDeclStats( translationUnit );345 deleteAll( translationUnit );346 return EXIT_SUCCESS;347 } // if348 349 if ( bresolvep ) {350 dump( translationUnit );351 return EXIT_SUCCESS;352 } // if353 321 354 322 CodeTools::fillLocations( translationUnit ); 355 356 if ( resolvprotop ) {357 CodeTools::dumpAsResolvProto( translationUnit );358 return EXIT_SUCCESS;359 } // if360 323 361 324 if( useNewAST ) { … … 365 328 } 366 329 auto transUnit = convert( move( translationUnit ) ); 330 331 forceFillCodeLocations( transUnit ); 332 333 if ( symtabp ) { 334 return EXIT_SUCCESS; 335 } // if 336 337 if ( expraltp ) { 338 ResolvExpr::printCandidates( transUnit ); 339 return EXIT_SUCCESS; 340 } // if 341 342 if ( validp ) { 343 dump( move( transUnit ) ); 344 return EXIT_SUCCESS; 345 } // if 346 347 PASS( "Translate Throws", ControlStruct::translateThrows( transUnit ) ); 348 PASS( "Fix Labels", ControlStruct::fixLabels( transUnit ) ); 349 PASS( "Fix Names", CodeGen::fixNames( transUnit ) ); 350 PASS( "Gen Init", InitTweak::genInit( transUnit ) ); 351 PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( transUnit ) ); 352 353 if ( libcfap ) { 354 // Generate the bodies of cfa library functions. 355 LibCfa::makeLibCfa( transUnit ); 356 } // if 357 358 if ( declstatsp ) { 359 printDeclStats( transUnit ); 360 return EXIT_SUCCESS; 361 } // if 362 363 if ( bresolvep ) { 364 dump( move( transUnit ) ); 365 return EXIT_SUCCESS; 366 } // if 367 368 if ( resolvprotop ) { 369 dumpAsResolverProto( transUnit ); 370 return EXIT_SUCCESS; 371 } // if 372 367 373 PASS( "Resolve", ResolvExpr::resolve( transUnit ) ); 368 374 if ( exprp ) { … … 375 381 PASS( "Fix Init", InitTweak::fix(transUnit, buildingLibrary())); 376 382 377 // fix ObjectDecl - replaces ConstructorInit nodes378 if ( ctorinitp ) {379 dump( move( transUnit ) );380 return EXIT_SUCCESS;381 } // if382 383 // Currently not working due to unresolved issues with UniqueExpr384 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 reused385 383 translationUnit = convert( move( transUnit ) ); 386 384 } else { 385 if ( symtabp ) { 386 deleteAll( translationUnit ); 387 return EXIT_SUCCESS; 388 } // if 389 390 if ( expraltp ) { 391 PassVisitor<ResolvExpr::AlternativePrinter> printer( cout ); 392 acceptAll( translationUnit, printer ); 393 return EXIT_SUCCESS; 394 } // if 395 396 if ( validp ) { 397 dump( translationUnit ); 398 return EXIT_SUCCESS; 399 } // if 400 401 PASS( "Translate Throws", ControlStruct::translateThrows( translationUnit ) ); 402 PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) ); 403 PASS( "Fix Names", CodeGen::fixNames( translationUnit ) ); 404 PASS( "Gen Init", InitTweak::genInit( translationUnit ) ); 405 PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) ); 406 407 if ( libcfap ) { 408 // Generate the bodies of cfa library functions. 409 LibCfa::makeLibCfa( translationUnit ); 410 } // if 411 412 if ( declstatsp ) { 413 CodeTools::printDeclStats( translationUnit ); 414 deleteAll( translationUnit ); 415 return EXIT_SUCCESS; 416 } // if 417 418 if ( bresolvep ) { 419 dump( translationUnit ); 420 return EXIT_SUCCESS; 421 } // if 422 423 CodeTools::fillLocations( translationUnit ); 424 425 if ( resolvprotop ) { 426 CodeTools::dumpAsResolvProto( translationUnit ); 427 return EXIT_SUCCESS; 428 } // if 429 387 430 PASS( "Resolve", ResolvExpr::resolve( translationUnit ) ); 388 431 if ( exprp ) { … … 392 435 393 436 PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) ); 394 395 // fix ObjectDecl - replaces ConstructorInit nodes396 if ( ctorinitp ) {397 dump ( translationUnit );398 return EXIT_SUCCESS;399 } // if400 401 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 reused402 437 } 438 439 // fix ObjectDecl - replaces ConstructorInit nodes 440 if ( ctorinitp ) { 441 dump ( translationUnit ); 442 return EXIT_SUCCESS; 443 } // if 444 445 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 403 446 404 447 PASS( "Translate Tries" , ControlStruct::translateTries( translationUnit ) ); … … 447 490 PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! genproto, prettycodegenp, true, linemarks ) ); 448 491 449 CodeGen::FixMain::fix( *output, (PreludeDirector + "/bootloader.c").c_str() ); 492 CodeGen::FixMain::fix( translationUnit, *output, 493 (PreludeDirector + "/bootloader.c").c_str() ); 450 494 if ( output != &cout ) { 451 495 delete output;
Note:
See TracChangeset
for help on using the changeset viewer.