Changes in / [d029162e:4acc87f]
- Location:
- src
- Files:
-
- 2 deleted
- 6 edited
-
CodeGen/CodeGenerator.cc (modified) (35 diffs)
-
InitTweak/FixGlobalInit.cc (deleted)
-
InitTweak/FixGlobalInit.h (deleted)
-
InitTweak/module.mk (modified) (1 diff)
-
Makefile.in (modified) (6 diffs)
-
SynTree/Declaration.h (modified) (4 diffs)
-
SynTree/FunctionDecl.cc (modified) (7 diffs)
-
main.cc (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
rd029162e r4acc87f 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // CodeGenerator.cc -- 7 // CodeGenerator.cc -- 8 8 // 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 11:39:01201611 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 17:32:16 2016 13 13 // Update Count : 243 14 14 // … … 84 84 output << genType( functionDecl->get_functionType(), mangleName( functionDecl ) ); 85 85 86 // generalize this87 switch ( functionDecl->get_attribute() ) {88 case FunctionDecl::Constructor:89 output << " __attribute__ ((constructor))";90 break;91 case FunctionDecl::Destructor:92 output << " __attribute__ ((destructor))";93 break;94 default:95 break;96 }97 98 86 // how to get this to the Functype? 99 87 std::list< Declaration * > olds = functionDecl->get_oldDecls(); … … 111 99 handleStorageClass( objectDecl ); 112 100 output << genType( objectDecl->get_type(), mangleName( objectDecl ) ); 113 101 114 102 if ( objectDecl->get_init() ) { 115 103 output << " = "; … … 125 113 if ( aggDecl->get_name() != "" ) 126 114 output << aggDecl->get_name(); 127 115 128 116 std::list< Declaration * > &memb = aggDecl->get_members(); 129 117 … … 131 119 output << " {" << endl; 132 120 133 cur_indent += CodeGenerator::tabsize; 121 cur_indent += CodeGenerator::tabsize; 134 122 for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end(); i++) { 135 output << indent; 123 output << indent; 136 124 (*i)->accept( *this ); 137 125 output << ";" << endl; 138 126 } 139 127 140 cur_indent -= CodeGenerator::tabsize; 128 cur_indent -= CodeGenerator::tabsize; 141 129 142 130 output << indent << "}"; … … 153 141 handleAggregate( aggregateDecl ); 154 142 } 155 143 156 144 void CodeGenerator::visit( EnumDecl *aggDecl ) { 157 145 output << "enum "; … … 159 147 if ( aggDecl->get_name() != "" ) 160 148 output << aggDecl->get_name(); 161 149 162 150 std::list< Declaration* > &memb = aggDecl->get_members(); 163 151 … … 165 153 output << " {" << endl; 166 154 167 cur_indent += CodeGenerator::tabsize; 155 cur_indent += CodeGenerator::tabsize; 168 156 for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end(); i++) { 169 157 ObjectDecl *obj = dynamic_cast< ObjectDecl* >( *i ); 170 158 assert( obj ); 171 output << indent << mangleName( obj ); 159 output << indent << mangleName( obj ); 172 160 if ( obj->get_init() ) { 173 161 output << " = "; … … 177 165 } // for 178 166 179 cur_indent -= CodeGenerator::tabsize; 167 cur_indent -= CodeGenerator::tabsize; 180 168 181 169 output << indent << "}"; 182 170 } // if 183 171 } 184 172 185 173 void CodeGenerator::visit( TraitDecl *aggregateDecl ) {} 186 174 187 175 void CodeGenerator::visit( TypedefDecl *typeDecl ) { 188 176 output << "typedef "; 189 177 output << genType( typeDecl->get_base(), typeDecl->get_name() ); 190 178 } 191 179 192 180 void CodeGenerator::visit( TypeDecl *typeDecl ) { 193 181 // really, we should mutate this into something that isn't a TypeDecl but that requires large-scale changes, … … 229 217 } 230 218 231 void CodeGenerator::visit( Constant *constant ) { 219 void CodeGenerator::visit( Constant *constant ) { 232 220 output << constant->get_value() ; 233 221 } … … 246 234 assert( arg != applicationExpr->get_args().end() ); 247 235 if ( AddressExpr *addrExpr = dynamic_cast< AddressExpr * >( *arg ) ) { 248 236 249 237 *arg = addrExpr->get_arg(); 250 238 } else { … … 255 243 break; 256 244 } 257 245 258 246 default: 259 247 // do nothing 260 248 ; 261 249 } 262 250 263 251 switch ( opInfo.type ) { 264 252 case OT_INDEX: … … 269 257 output << "]"; 270 258 break; 271 259 272 260 case OT_CALL: 273 261 // there are no intrinsic definitions of the function call operator 274 262 assert( false ); 275 263 break; 276 264 277 265 case OT_PREFIX: 278 266 case OT_PREFIXASSIGN: … … 283 271 output << ")"; 284 272 break; 285 273 286 274 case OT_POSTFIX: 287 275 case OT_POSTFIXASSIGN: … … 300 288 output << ")"; 301 289 break; 302 290 303 291 case OT_CONSTANT: 304 292 case OT_LABELADDRESS: … … 319 307 } // if 320 308 } 321 309 322 310 void CodeGenerator::visit( UntypedExpr *untypedExpr ) { 323 311 if ( NameExpr *nameExpr = dynamic_cast< NameExpr* >( untypedExpr->get_function() ) ) { … … 333 321 output << "]"; 334 322 break; 335 323 336 324 case OT_CALL: 337 325 assert( false ); 338 326 break; 339 327 340 328 case OT_PREFIX: 341 329 case OT_PREFIXASSIGN: … … 347 335 output << ")"; 348 336 break; 349 337 350 338 case OT_POSTFIX: 351 339 case OT_POSTFIXASSIGN: … … 354 342 output << opInfo.symbol; 355 343 break; 356 344 357 345 case OT_INFIX: 358 346 case OT_INFIXASSIGN: … … 364 352 output << ")"; 365 353 break; 366 354 367 355 case OT_CONSTANT: 368 356 // there are no intrinsic definitions of 0 or 1 as functions … … 382 370 } // if 383 371 } 384 372 385 373 void CodeGenerator::visit( NameExpr *nameExpr ) { 386 374 OperatorInfo opInfo; … … 392 380 } // if 393 381 } 394 382 395 383 void CodeGenerator::visit( AddressExpr *addressExpr ) { 396 384 output << "(&"; … … 421 409 output << ")"; 422 410 } 423 411 424 412 void CodeGenerator::visit( UntypedMemberExpr *memberExpr ) { 425 413 assert( false ); 426 414 } 427 415 428 416 void CodeGenerator::visit( MemberExpr *memberExpr ) { 429 417 memberExpr->get_aggregate()->accept( *this ); 430 418 output << "." << mangleName( memberExpr->get_member() ); 431 419 } 432 420 433 421 void CodeGenerator::visit( VariableExpr *variableExpr ) { 434 422 OperatorInfo opInfo; … … 439 427 } // if 440 428 } 441 429 442 430 void CodeGenerator::visit( ConstantExpr *constantExpr ) { 443 431 assert( constantExpr->get_constant() ); 444 432 constantExpr->get_constant()->accept( *this ); 445 433 } 446 434 447 435 void CodeGenerator::visit( SizeofExpr *sizeofExpr ) { 448 436 output << "sizeof("; … … 481 469 assert( false && "OffsetPackExpr should not reach code generation" ); 482 470 } 483 471 484 472 void CodeGenerator::visit( LogicalExpr *logicalExpr ) { 485 473 output << "("; … … 493 481 output << ")"; 494 482 } 495 483 496 484 void CodeGenerator::visit( ConditionalExpr *conditionalExpr ) { 497 485 output << "("; … … 503 491 output << ")"; 504 492 } 505 493 506 494 void CodeGenerator::visit( CommaExpr *commaExpr ) { 507 495 output << "("; … … 511 499 output << ")"; 512 500 } 513 501 514 502 void CodeGenerator::visit( TupleExpr *tupleExpr ) {} 515 503 516 504 void CodeGenerator::visit( TypeExpr *typeExpr ) {} 517 505 … … 544 532 } 545 533 } 546 cur_indent -= CodeGenerator::tabsize; 534 cur_indent -= CodeGenerator::tabsize; 547 535 548 536 output << indent << "}"; … … 550 538 551 539 void CodeGenerator::visit( ExprStmt *exprStmt ) { 552 // I don't see why this check is necessary. 553 // If this starts to cause problems then put it back in, 540 // I don't see why this check is necessary. 541 // If this starts to cause problems then put it back in, 554 542 // with an explanation 555 543 assert( exprStmt ); … … 601 589 switchStmt->get_condition()->accept( *this ); 602 590 output << " ) "; 603 591 604 592 output << "{" << std::endl; 605 593 cur_indent += CodeGenerator::tabsize; … … 621 609 } // if 622 610 output << ":\n"; 623 611 624 612 std::list<Statement *> sts = caseStmt->get_statements(); 625 613 … … 638 626 if ( ! branchStmt->get_target().empty() ) 639 627 output << "goto " << branchStmt->get_target(); 640 else { 628 else { 641 629 if ( branchStmt->get_computedTarget() != 0 ) { 642 630 output << "goto *"; … … 689 677 690 678 void CodeGenerator::visit( ForStmt *forStmt ) { 691 // initialization is always hoisted, so don't 692 // bother doing anything with that 679 // initialization is always hoisted, so don't 680 // bother doing anything with that 693 681 output << "for (;"; 694 682 … … 714 702 void CodeGenerator::visit( DeclStmt *declStmt ) { 715 703 declStmt->get_decl()->accept( *this ); 716 704 717 705 if ( doSemicolon( declStmt->get_decl() ) ) { 718 706 output << ";"; -
src/InitTweak/module.mk
rd029162e r4acc87f 11 11 ## Created On : Mon Jun 1 17:49:17 2015 12 12 ## Last Modified By : Rob Schluntz 13 ## Last Modified On : Wed May 04 16:03:49201613 ## Last Modified On : Mon Jan 11 14:40:16 2016 14 14 ## Update Count : 2 15 15 ############################################################################### 16 16 17 SRC += InitTweak/RemoveInit.cc \ 18 InitTweak/FixGlobalInit.cc 17 SRC += InitTweak/RemoveInit.cc 19 18 -
src/Makefile.in
rd029162e r4acc87f 124 124 GenPoly/driver_cfa_cpp-DeclMutator.$(OBJEXT) \ 125 125 InitTweak/driver_cfa_cpp-RemoveInit.$(OBJEXT) \ 126 InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT) \127 126 Parser/driver_cfa_cpp-parser.$(OBJEXT) \ 128 127 Parser/driver_cfa_cpp-lex.$(OBJEXT) \ … … 347 346 GenPoly/CopyParams.cc GenPoly/FindFunction.cc \ 348 347 GenPoly/DeclMutator.cc InitTweak/RemoveInit.cc \ 349 InitTweak/FixGlobalInit.cc Parser/parser.yy Parser/lex.ll \ 350 Parser/TypedefTable.cc Parser/ParseNode.cc \ 351 Parser/DeclarationNode.cc Parser/ExpressionNode.cc \ 352 Parser/StatementNode.cc Parser/InitializerNode.cc \ 353 Parser/TypeData.cc Parser/LinkageSpec.cc \ 354 Parser/parseutility.cc Parser/Parser.cc \ 348 Parser/parser.yy Parser/lex.ll Parser/TypedefTable.cc \ 349 Parser/ParseNode.cc Parser/DeclarationNode.cc \ 350 Parser/ExpressionNode.cc Parser/StatementNode.cc \ 351 Parser/InitializerNode.cc Parser/TypeData.cc \ 352 Parser/LinkageSpec.cc Parser/parseutility.cc Parser/Parser.cc \ 355 353 ResolvExpr/AlternativeFinder.cc ResolvExpr/Alternative.cc \ 356 354 ResolvExpr/Unify.cc ResolvExpr/PtrsAssignable.cc \ … … 564 562 @: > InitTweak/$(DEPDIR)/$(am__dirstamp) 565 563 InitTweak/driver_cfa_cpp-RemoveInit.$(OBJEXT): \ 566 InitTweak/$(am__dirstamp) InitTweak/$(DEPDIR)/$(am__dirstamp)567 InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT): \568 564 InitTweak/$(am__dirstamp) InitTweak/$(DEPDIR)/$(am__dirstamp) 569 565 Parser/parser.h: Parser/parser.cc … … 796 792 -rm -f GenPoly/driver_cfa_cpp-ScrubTyVars.$(OBJEXT) 797 793 -rm -f GenPoly/driver_cfa_cpp-Specialize.$(OBJEXT) 798 -rm -f InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT)799 794 -rm -f InitTweak/driver_cfa_cpp-RemoveInit.$(OBJEXT) 800 795 -rm -f Parser/driver_cfa_cpp-DeclarationNode.$(OBJEXT) … … 902 897 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-ScrubTyVars.Po@am__quote@ 903 898 @AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-Specialize.Po@am__quote@ 904 @AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Po@am__quote@905 899 @AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/driver_cfa_cpp-RemoveInit.Po@am__quote@ 906 900 @AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-DeclarationNode.Po@am__quote@ … … 1386 1380 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-RemoveInit.obj `if test -f 'InitTweak/RemoveInit.cc'; then $(CYGPATH_W) 'InitTweak/RemoveInit.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/RemoveInit.cc'; fi` 1387 1381 1388 InitTweak/driver_cfa_cpp-FixGlobalInit.o: InitTweak/FixGlobalInit.cc1389 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-FixGlobalInit.o -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Tpo -c -o InitTweak/driver_cfa_cpp-FixGlobalInit.o `test -f 'InitTweak/FixGlobalInit.cc' || echo '$(srcdir)/'`InitTweak/FixGlobalInit.cc1390 @am__fastdepCXX_TRUE@ $(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Po1391 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='InitTweak/FixGlobalInit.cc' object='InitTweak/driver_cfa_cpp-FixGlobalInit.o' libtool=no @AMDEPBACKSLASH@1392 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@1393 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-FixGlobalInit.o `test -f 'InitTweak/FixGlobalInit.cc' || echo '$(srcdir)/'`InitTweak/FixGlobalInit.cc1394 1395 InitTweak/driver_cfa_cpp-FixGlobalInit.obj: InitTweak/FixGlobalInit.cc1396 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/driver_cfa_cpp-FixGlobalInit.obj -MD -MP -MF InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Tpo -c -o InitTweak/driver_cfa_cpp-FixGlobalInit.obj `if test -f 'InitTweak/FixGlobalInit.cc'; then $(CYGPATH_W) 'InitTweak/FixGlobalInit.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/FixGlobalInit.cc'; fi`1397 @am__fastdepCXX_TRUE@ $(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Po1398 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='InitTweak/FixGlobalInit.cc' object='InitTweak/driver_cfa_cpp-FixGlobalInit.obj' libtool=no @AMDEPBACKSLASH@1399 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@1400 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o InitTweak/driver_cfa_cpp-FixGlobalInit.obj `if test -f 'InitTweak/FixGlobalInit.cc'; then $(CYGPATH_W) 'InitTweak/FixGlobalInit.cc'; else $(CYGPATH_W) '$(srcdir)/InitTweak/FixGlobalInit.cc'; fi`1401 1402 1382 Parser/driver_cfa_cpp-parser.o: Parser/parser.cc 1403 1383 @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Parser/driver_cfa_cpp-parser.o -MD -MP -MF Parser/$(DEPDIR)/driver_cfa_cpp-parser.Tpo -c -o Parser/driver_cfa_cpp-parser.o `test -f 'Parser/parser.cc' || echo '$(srcdir)/'`Parser/parser.cc -
src/SynTree/Declaration.h
rd029162e r4acc87f 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Declaration.h -- 7 // Declaration.h -- 8 8 // 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 11:16:45201611 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 17:28:11 2016 13 13 // Update Count : 33 14 14 // … … 106 106 typedef DeclarationWithType Parent; 107 107 public: 108 // temporary - merge this into general GCC attributes 109 enum Attribute { 110 NoAttribute, Constructor, Destructor, 111 }; 112 113 FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, Attribute attribute = NoAttribute ); 108 FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn ); 114 109 FunctionDecl( const FunctionDecl &other ); 115 110 virtual ~FunctionDecl(); … … 124 119 std::list< std::string >& get_oldIdents() { return oldIdents; } 125 120 std::list< Declaration* >& get_oldDecls() { return oldDecls; } 126 Attribute get_attribute() const { return attribute; }127 void set_attribute( Attribute newValue ) { attribute = newValue; }128 121 129 122 virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); } … … 137 130 std::list< std::string > oldIdents; 138 131 std::list< Declaration* > oldDecls; 139 Attribute attribute;140 132 }; 141 133 -
src/SynTree/FunctionDecl.cc
rd029162e r4acc87f 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FunctionDecl.cc -- 7 // FunctionDecl.cc -- 8 8 // 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 11:35:09 201611 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jul 13 18:11:44 2015 13 13 // Update Count : 19 14 14 // … … 21 21 #include "Common/utility.h" 22 22 23 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn , Attribute attribute)24 : Parent( name, sc, linkage ), type( type ), statements( statements ) , attribute( attribute ){23 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn ) 24 : Parent( name, sc, linkage ), type( type ), statements( statements ) { 25 25 set_isInline( isInline ); 26 26 set_isNoreturn( isNoreturn ); … … 32 32 33 33 FunctionDecl::FunctionDecl( const FunctionDecl &other ) 34 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) , attribute( other.attribute ){34 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) { 35 35 } 36 36 … … 52 52 using std::endl; 53 53 using std::string; 54 54 55 55 if ( get_name() != "" ) { 56 56 os << get_name() << ": "; … … 65 65 os << "_Noreturn "; 66 66 } // if 67 switch ( attribute ) {68 case Constructor:69 os << "Global Constructor ";70 break;71 case Destructor:72 os << "Global Destructor ";73 break;74 default:75 break;76 }77 67 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 78 68 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; … … 104 94 using std::endl; 105 95 using std::string; 106 96 107 97 if ( get_name() != "" ) { 108 98 os << get_name() << ": "; … … 114 104 os << "_Noreturn "; 115 105 } // if 116 switch ( attribute ) {117 case Constructor:118 os << " Global Constructor ";119 break;120 case Destructor:121 os << " Global Destructor ";122 break;123 default:124 break;125 }126 106 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 127 107 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; -
src/main.cc
rd029162e r4acc87f 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // main.cc -- 7 // main.cc -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Fri May 15 23:12:02 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri May 06 14:04:49 201611 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 4 23:32:59 2016 13 13 // Update Count : 203 14 14 // … … 41 41 #include "InitTweak/Mutate.h" 42 42 #include "InitTweak/RemoveInit.h" 43 #include "InitTweak/FixGlobalInit.h"44 43 //#include "Explain/GenProlog.h" 45 44 //#include "Try/Visit.h" … … 99 98 int long_index; 100 99 std::list< Declaration * > translationUnit; 101 const char *filename = NULL; 100 const char *filename = NULL;; 102 101 103 102 opterr = 0; // prevent getopt from printing error messages 104 103 105 104 int c; 106 105 while ( (c = getopt_long( argc, argv, "abefglnpqrstvyzD:F:", long_opts, &long_index )) != -1 ) { … … 181 180 input = fopen( argv[ optind ], "r" ); 182 181 if ( ! input ) { 183 std::cout << "Error: can't open " << argv[ optind] << std::endl;182 std::cout << "Error: can't open " << argv[optind] << std::endl; 184 183 exit( 1 ); 185 184 } // if 186 // if running cfa-cpp directly, might forget to pass -F option (and really shouldn't have to)187 if ( filename == NULL ) filename = argv[ optind ];188 185 optind += 1; 189 186 } else { … … 194 191 output = new ofstream( argv[ optind ] ); 195 192 } // if 196 193 197 194 Parser::get_parser().set_debug( grammarp ); 198 195 … … 215 212 exit( 1 ); 216 213 } // if 217 214 218 215 parse( prelude, LinkageSpec::Intrinsic ); 219 216 } // if 220 217 } // if 221 218 222 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp ); 223 219 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp ); 220 224 221 if ( parsep ) { 225 222 Parser::get_parser().get_parseTree()->printList( std::cout ); … … 256 253 OPTPRINT( "mutate" ) 257 254 ControlStruct::mutate( translationUnit ); 258 OPTPRINT( "fixNames" ) 255 OPTPRINT( "fixNames" ) 259 256 CodeGen::fixNames( translationUnit ); 260 OPTPRINT( "fixGlobalInit" );261 InitTweak::fixGlobalInit( translationUnit, filename );262 257 OPTPRINT( "tweak" ) 263 258 InitTweak::tweak( translationUnit ); … … 287 282 OPTPRINT( "box" ) 288 283 GenPoly::box( translationUnit ); 289 284 290 285 // print tree right before code generation 291 286 if ( codegenp ) { … … 343 338 std::list< Declaration * > decls; 344 339 if ( noprotop ) { 345 filter( translationUnit.begin(), translationUnit.end(), 340 filter( translationUnit.begin(), translationUnit.end(), 346 341 std::back_inserter( decls ), notPrelude ); 347 342 } else {
Note:
See TracChangeset
for help on using the changeset viewer.