Changeset 7770cc8 for src/main.cc
- Timestamp:
- Nov 24, 2021, 9:47:56 PM (4 years ago)
- 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. - File:
-
- 1 edited
-
src/main.cc (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/main.cc
r94647b0b r7770cc8 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 : Mon Aug 23 15:42:08202113 // Update Count : 65 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Nov 12 11:06:00 2021 13 // Update Count : 658 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 … … 68 72 #include "SynTree/Visitor.h" // for acceptAll 69 73 #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 70 77 #include "Virtual/ExpandCasts.h" // for expandCasts 71 78 … … 314 321 315 322 // 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 ) ); 353 328 354 329 CodeTools::fillLocations( translationUnit ); 355 356 if ( resolvprotop ) {357 CodeTools::dumpAsResolvProto( translationUnit );358 return EXIT_SUCCESS;359 } // if360 330 361 331 if( useNewAST ) { … … 366 336 auto transUnit = convert( move( translationUnit ) ); 367 337 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 ) ); 368 362 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 370 384 PASS( "Resolve", ResolvExpr::resolve( transUnit ) ); 371 385 if ( exprp ) { … … 377 391 378 392 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 379 402 translationUnit = convert( move( transUnit ) ); 380 403 } 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 ) ); 381 426 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 382 450 383 451 PASS( "Resolve", ResolvExpr::resolve( translationUnit ) ); … … 388 456 389 457 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 390 466 } 391 392 // fix ObjectDecl - replaces ConstructorInit nodes393 if ( ctorinitp ) {394 dump ( translationUnit );395 return EXIT_SUCCESS;396 } // if397 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 reused399 467 400 468 PASS( "Translate Tries" , ControlStruct::translateTries( translationUnit ) ); … … 443 511 PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! genproto, prettycodegenp, true, linemarks ) ); 444 512 445 CodeGen::FixMain::fix( *output, (PreludeDirector + "/bootloader.c").c_str() ); 513 CodeGen::FixMain::fix( translationUnit, *output, 514 (PreludeDirector + "/bootloader.c").c_str() ); 446 515 if ( output != &cout ) { 447 516 delete output;
Note:
See TracChangeset
for help on using the changeset viewer.