Changeset 711eee5


Ignore:
Timestamp:
May 4, 2016, 4:57:43 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, 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, resolv-new, with_gc
Children:
4e24610
Parents:
1b7ea43
Message:

generate global init function for each translation unit

Location:
src
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/module.mk

    r1b7ea43 r711eee5  
    1111## Created On       : Mon Jun  1 17:49:17 2015
    1212## Last Modified By : Rob Schluntz
    13 ## Last Modified On : Mon Jan 11 14:40:16 2016
     13## Last Modified On : Wed May 04 16:03:49 2016
    1414## Update Count     : 2
    1515###############################################################################
    1616
    17 SRC += InitTweak/RemoveInit.cc
     17SRC += InitTweak/RemoveInit.cc \
     18        InitTweak/FixGlobalInit.cc
    1819
  • src/Makefile.in

    r1b7ea43 r711eee5  
    124124        GenPoly/driver_cfa_cpp-DeclMutator.$(OBJEXT) \
    125125        InitTweak/driver_cfa_cpp-RemoveInit.$(OBJEXT) \
     126        InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT) \
    126127        Parser/driver_cfa_cpp-parser.$(OBJEXT) \
    127128        Parser/driver_cfa_cpp-lex.$(OBJEXT) \
     
    346347        GenPoly/CopyParams.cc GenPoly/FindFunction.cc \
    347348        GenPoly/DeclMutator.cc InitTweak/RemoveInit.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 \
     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 \
    353355        ResolvExpr/AlternativeFinder.cc ResolvExpr/Alternative.cc \
    354356        ResolvExpr/Unify.cc ResolvExpr/PtrsAssignable.cc \
     
    562564        @: > InitTweak/$(DEPDIR)/$(am__dirstamp)
    563565InitTweak/driver_cfa_cpp-RemoveInit.$(OBJEXT):  \
     566        InitTweak/$(am__dirstamp) InitTweak/$(DEPDIR)/$(am__dirstamp)
     567InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT):  \
    564568        InitTweak/$(am__dirstamp) InitTweak/$(DEPDIR)/$(am__dirstamp)
    565569Parser/parser.h: Parser/parser.cc
     
    792796        -rm -f GenPoly/driver_cfa_cpp-ScrubTyVars.$(OBJEXT)
    793797        -rm -f GenPoly/driver_cfa_cpp-Specialize.$(OBJEXT)
     798        -rm -f InitTweak/driver_cfa_cpp-FixGlobalInit.$(OBJEXT)
    794799        -rm -f InitTweak/driver_cfa_cpp-RemoveInit.$(OBJEXT)
    795800        -rm -f Parser/driver_cfa_cpp-DeclarationNode.$(OBJEXT)
     
    897902@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/driver_cfa_cpp-ScrubTyVars.Po@am__quote@
    898903@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@
    899905@AMDEP_TRUE@@am__include@ @am__quote@InitTweak/$(DEPDIR)/driver_cfa_cpp-RemoveInit.Po@am__quote@
    900906@AMDEP_TRUE@@am__include@ @am__quote@Parser/$(DEPDIR)/driver_cfa_cpp-DeclarationNode.Po@am__quote@
     
    13801386@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`
    13811387
     1388InitTweak/driver_cfa_cpp-FixGlobalInit.o: InitTweak/FixGlobalInit.cc
     1389@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.cc
     1390@am__fastdepCXX_TRUE@   $(am__mv) InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Tpo InitTweak/$(DEPDIR)/driver_cfa_cpp-FixGlobalInit.Po
     1391@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.cc
     1394
     1395InitTweak/driver_cfa_cpp-FixGlobalInit.obj: InitTweak/FixGlobalInit.cc
     1396@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.Po
     1398@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
    13821402Parser/driver_cfa_cpp-parser.o: Parser/parser.cc
    13831403@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/main.cc

    r1b7ea43 r711eee5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // main.cc -- 
     7// main.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Fri May 15 23:12:02 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jan 27 22:20:20 2016
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Wed May 04 16:54:52 2016
    1313// Update Count     : 199
    1414//
     
    4141#include "InitTweak/Mutate.h"
    4242#include "InitTweak/RemoveInit.h"
     43#include "InitTweak/FixGlobalInit.h"
    4344//#include "Explain/GenProlog.h"
    4445//#include "Try/Visit.h"
     
    100101
    101102        opterr = 0;                                                                                     // prevent getopt from printing error messages
    102        
     103
    103104        int c;
    104105        while ( (c = getopt_long( argc, argv, "abefglnpqrstvyzD:", long_opts, &long_index )) != -1 ) {
     
    172173
    173174        try {
     175                std::string fileName;
     176
    174177                // choose to read the program from a file or stdin
    175178                if ( optind < argc ) {
    176179                        input = fopen( argv[ optind ], "r" );
    177180                        if ( ! input ) {
    178                                 std::cout << "Error: can't open " << argv[optind] << std::endl;
     181                                std::cout << "Error: can't open " << argv[ optind ] << std::endl;
    179182                                exit( 1 );
    180183                        } // if
    181184                        optind += 1;
     185
     186                        // assert( optind < argc );
     187                        fileName = argv[ optind-1 ]; // placeholder
     188                        // optind += 1;
    182189                } else {
    183190                        input = stdin;
     
    187194                        output = new ofstream( argv[ optind ] );
    188195                } // if
    189        
     196
    190197                Parser::get_parser().set_debug( grammarp );
    191198
     
    208215                                        exit( 1 );
    209216                                } // if
    210                    
     217
    211218                                parse( prelude, LinkageSpec::Intrinsic );
    212219                        } // if
    213220                } // if
    214221
    215                 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp );     
    216  
     222                parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp );
     223
    217224                if ( parsep ) {
    218225                        Parser::get_parser().get_parseTree()->printList( std::cout );
     
    249256                OPTPRINT( "mutate" )
    250257                ControlStruct::mutate( translationUnit );
    251                 OPTPRINT( "fixNames" ) 
     258                OPTPRINT( "fixNames" )
    252259                CodeGen::fixNames( translationUnit );
     260                OPTPRINT( "fixGlobalInit" );
     261                InitTweak::fixGlobalInit( translationUnit, fileName );
    253262                OPTPRINT( "tweak" )
    254263                InitTweak::tweak( translationUnit );
     
    278287                OPTPRINT( "box" )
    279288                GenPoly::box( translationUnit );
    280                
     289
    281290                // print tree right before code generation
    282291                if ( codegenp ) {
     
    334343        std::list< Declaration * > decls;
    335344        if ( noprotop ) {
    336                 filter( translationUnit.begin(), translationUnit.end(), 
     345                filter( translationUnit.begin(), translationUnit.end(),
    337346                                std::back_inserter( decls ), notPrelude );
    338347        } else {
Note: See TracChangeset for help on using the changeset viewer.