Changeset e04ef3a for src/CodeGen
- Timestamp:
- Jun 14, 2016, 12:53:03 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- c8c03683
- Parents:
- 55ba7339
- Location:
- src/CodeGen
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r55ba7339 re04ef3a 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri May 06 16:01:00 201613 // Update Count : 25 511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 9 13:21:00 2016 13 // Update Count : 256 14 14 // 15 15 … … 250 250 //*** Expressions 251 251 void CodeGenerator::visit( ApplicationExpr *applicationExpr ) { 252 extension( applicationExpr ); 252 253 if ( VariableExpr *varExpr = dynamic_cast< VariableExpr* >( applicationExpr->get_function() ) ) { 253 254 OperatorInfo opInfo; … … 361 362 362 363 void CodeGenerator::visit( UntypedExpr *untypedExpr ) { 364 extension( untypedExpr ); 363 365 if ( NameExpr *nameExpr = dynamic_cast< NameExpr* >( untypedExpr->get_function() ) ) { 364 366 OperatorInfo opInfo; … … 445 447 446 448 void CodeGenerator::visit( NameExpr *nameExpr ) { 449 extension( nameExpr ); 447 450 OperatorInfo opInfo; 448 451 if ( operatorLookup( nameExpr->get_name(), opInfo ) ) { … … 455 458 456 459 void CodeGenerator::visit( AddressExpr *addressExpr ) { 460 extension( addressExpr ); 457 461 output << "(&"; 458 462 // this hack makes sure that we don't convert "constant_zero" to "0" if we're taking its address … … 466 470 467 471 void CodeGenerator::visit( CastExpr *castExpr ) { 472 extension( castExpr ); 468 473 output << "("; 469 474 if ( castExpr->get_results().empty() ) { … … 488 493 489 494 void CodeGenerator::visit( MemberExpr *memberExpr ) { 495 extension( memberExpr ); 490 496 memberExpr->get_aggregate()->accept( *this ); 491 497 output << "." << mangleName( memberExpr->get_member() ); … … 493 499 494 500 void CodeGenerator::visit( VariableExpr *variableExpr ) { 501 extension( variableExpr ); 495 502 OperatorInfo opInfo; 496 503 if ( variableExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic && operatorLookup( variableExpr->get_var()->get_name(), opInfo ) && opInfo.type == OT_CONSTANT ) { … … 503 510 void CodeGenerator::visit( ConstantExpr *constantExpr ) { 504 511 assert( constantExpr->get_constant() ); 512 extension( constantExpr ); 505 513 constantExpr->get_constant()->accept( *this ); 506 514 } 507 515 508 516 void CodeGenerator::visit( SizeofExpr *sizeofExpr ) { 517 extension( sizeofExpr ); 509 518 output << "sizeof("; 510 519 if ( sizeofExpr->get_isType() ) { … … 517 526 518 527 void CodeGenerator::visit( AlignofExpr *alignofExpr ) { 528 extension( alignofExpr ); 519 529 // use GCC extension to avoid bumping std to C11 520 530 output << "__alignof__("; … … 532 542 533 543 void CodeGenerator::visit( OffsetofExpr *offsetofExpr ) { 544 extension( offsetofExpr ); 534 545 // use GCC builtin 535 546 output << "__builtin_offsetof("; … … 544 555 545 556 void CodeGenerator::visit( LogicalExpr *logicalExpr ) { 557 extension( logicalExpr ); 546 558 output << "("; 547 559 logicalExpr->get_arg1()->accept( *this ); … … 556 568 557 569 void CodeGenerator::visit( ConditionalExpr *conditionalExpr ) { 570 extension( conditionalExpr ); 558 571 output << "("; 559 572 conditionalExpr->get_arg1()->accept( *this ); … … 566 579 567 580 void CodeGenerator::visit( CommaExpr *commaExpr ) { 581 extension( commaExpr ); 568 582 output << "("; 569 583 commaExpr->get_arg1()->accept( *this ); … … 578 592 579 593 void CodeGenerator::visit( AsmExpr *asmExpr ) { 594 extension( asmExpr ); 580 595 if ( asmExpr->get_inout() ) { 581 596 output << "[ "; -
src/CodeGen/CodeGenerator.h
r55ba7339 re04ef3a 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 17:32:24201613 // Update Count : 2 812 // Last Modified On : Thu Jun 9 13:15:58 2016 13 // Update Count : 29 14 14 // 15 15 … … 94 94 std::ostream& operator()(std::ostream & os); 95 95 }; 96 97 void extension( Expression *expr ) { 98 if ( expr->get_extension() ) { 99 output << "__extension__ "; 100 } // if 101 } // extension 96 102 private: 97 103
Note:
See TracChangeset
for help on using the changeset viewer.