Changeset 63afee0


Ignore:
Timestamp:
Nov 20, 2015, 10:32:05 AM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
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, string, with_gc
Children:
66a2a61
Parents:
f066321 (diff), 258eb5c9 (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.
Message:

Merge branch 'master' of /u/cforall/software/cfa/cfa-cc

Location:
src
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/module.mk

    rf066321 r63afee0  
    2222       GenPoly/Specialize.cc \
    2323       GenPoly/CopyParams.cc \
    24        GenPoly/FindFunction.cc
     24       GenPoly/FindFunction.cc \
     25       GenPoly/InstantiateGeneric.cc
  • src/Makefile.in

    rf066321 r63afee0  
    121121        GenPoly/cfa_cpp-CopyParams.$(OBJEXT) \
    122122        GenPoly/cfa_cpp-FindFunction.$(OBJEXT) \
     123        GenPoly/cfa_cpp-InstantiateGeneric.$(OBJEXT) \
    123124        InitTweak/cfa_cpp-InitModel.$(OBJEXT) \
    124125        InitTweak/cfa_cpp-InitExpander.$(OBJEXT) \
     
    347348        GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc GenPoly/Specialize.cc \
    348349        GenPoly/CopyParams.cc GenPoly/FindFunction.cc \
    349         InitTweak/InitModel.cc InitTweak/InitExpander.cc \
    350         InitTweak/Mutate.cc InitTweak/Association.cc \
    351         InitTweak/RemoveInit.cc Parser/parser.yy Parser/lex.ll \
    352         Parser/TypedefTable.cc Parser/ParseNode.cc \
    353         Parser/DeclarationNode.cc Parser/ExpressionNode.cc \
    354         Parser/StatementNode.cc Parser/InitializerNode.cc \
    355         Parser/TypeData.cc Parser/LinkageSpec.cc \
    356         Parser/parseutility.cc Parser/Parser.cc \
     350        GenPoly/InstantiateGeneric.cc InitTweak/InitModel.cc \
     351        InitTweak/InitExpander.cc InitTweak/Mutate.cc \
     352        InitTweak/Association.cc InitTweak/RemoveInit.cc \
     353        Parser/parser.yy Parser/lex.ll Parser/TypedefTable.cc \
     354        Parser/ParseNode.cc Parser/DeclarationNode.cc \
     355        Parser/ExpressionNode.cc Parser/StatementNode.cc \
     356        Parser/InitializerNode.cc Parser/TypeData.cc \
     357        Parser/LinkageSpec.cc Parser/parseutility.cc Parser/Parser.cc \
    357358        ResolvExpr/AlternativeFinder.cc ResolvExpr/Alternative.cc \
    358359        ResolvExpr/Unify.cc ResolvExpr/PtrsAssignable.cc \
     
    553554        GenPoly/$(DEPDIR)/$(am__dirstamp)
    554555GenPoly/cfa_cpp-FindFunction.$(OBJEXT): GenPoly/$(am__dirstamp) \
     556        GenPoly/$(DEPDIR)/$(am__dirstamp)
     557GenPoly/cfa_cpp-InstantiateGeneric.$(OBJEXT): GenPoly/$(am__dirstamp) \
    555558        GenPoly/$(DEPDIR)/$(am__dirstamp)
    556559InitTweak/$(am__dirstamp):
     
    784787        -rm -f GenPoly/cfa_cpp-FindFunction.$(OBJEXT)
    785788        -rm -f GenPoly/cfa_cpp-GenPoly.$(OBJEXT)
     789        -rm -f GenPoly/cfa_cpp-InstantiateGeneric.$(OBJEXT)
    786790        -rm -f GenPoly/cfa_cpp-Lvalue.$(OBJEXT)
    787791        -rm -f GenPoly/cfa_cpp-PolyMutator.$(OBJEXT)
     
    893897@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/cfa_cpp-FindFunction.Po@am__quote@
    894898@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/cfa_cpp-GenPoly.Po@am__quote@
     899@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Po@am__quote@
    895900@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/cfa_cpp-Lvalue.Po@am__quote@
    896901@AMDEP_TRUE@@am__include@ @am__quote@GenPoly/$(DEPDIR)/cfa_cpp-PolyMutator.Po@am__quote@
     
    13571362@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/cfa_cpp-FindFunction.obj `if test -f 'GenPoly/FindFunction.cc'; then $(CYGPATH_W) 'GenPoly/FindFunction.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/FindFunction.cc'; fi`
    13581363
     1364GenPoly/cfa_cpp-InstantiateGeneric.o: GenPoly/InstantiateGeneric.cc
     1365@am__fastdepCXX_TRUE@   $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/cfa_cpp-InstantiateGeneric.o -MD -MP -MF GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Tpo -c -o GenPoly/cfa_cpp-InstantiateGeneric.o `test -f 'GenPoly/InstantiateGeneric.cc' || echo '$(srcdir)/'`GenPoly/InstantiateGeneric.cc
     1366@am__fastdepCXX_TRUE@   $(am__mv) GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Tpo GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Po
     1367@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='GenPoly/InstantiateGeneric.cc' object='GenPoly/cfa_cpp-InstantiateGeneric.o' libtool=no @AMDEPBACKSLASH@
     1368@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1369@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/cfa_cpp-InstantiateGeneric.o `test -f 'GenPoly/InstantiateGeneric.cc' || echo '$(srcdir)/'`GenPoly/InstantiateGeneric.cc
     1370
     1371GenPoly/cfa_cpp-InstantiateGeneric.obj: GenPoly/InstantiateGeneric.cc
     1372@am__fastdepCXX_TRUE@   $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/cfa_cpp-InstantiateGeneric.obj -MD -MP -MF GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Tpo -c -o GenPoly/cfa_cpp-InstantiateGeneric.obj `if test -f 'GenPoly/InstantiateGeneric.cc'; then $(CYGPATH_W) 'GenPoly/InstantiateGeneric.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/InstantiateGeneric.cc'; fi`
     1373@am__fastdepCXX_TRUE@   $(am__mv) GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Tpo GenPoly/$(DEPDIR)/cfa_cpp-InstantiateGeneric.Po
     1374@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='GenPoly/InstantiateGeneric.cc' object='GenPoly/cfa_cpp-InstantiateGeneric.obj' libtool=no @AMDEPBACKSLASH@
     1375@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1376@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o GenPoly/cfa_cpp-InstantiateGeneric.obj `if test -f 'GenPoly/InstantiateGeneric.cc'; then $(CYGPATH_W) 'GenPoly/InstantiateGeneric.cc'; else $(CYGPATH_W) '$(srcdir)/GenPoly/InstantiateGeneric.cc'; fi`
     1377
    13591378InitTweak/cfa_cpp-InitModel.o: InitTweak/InitModel.cc
    13601379@am__fastdepCXX_TRUE@   $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT InitTweak/cfa_cpp-InitModel.o -MD -MP -MF InitTweak/$(DEPDIR)/cfa_cpp-InitModel.Tpo -c -o InitTweak/cfa_cpp-InitModel.o `test -f 'InitTweak/InitModel.cc' || echo '$(srcdir)/'`InitTweak/InitModel.cc
  • src/Parser/TypeData.cc

    rf066321 r63afee0  
    799799          case DeclarationNode::Struct:
    800800                at = new StructDecl( aggregate->name );
     801                buildForall( aggregate->params, at->get_parameters() );
    801802                break;
    802803          case DeclarationNode::Union:
    803804                at = new UnionDecl( aggregate->name );
     805                buildForall( aggregate->params, at->get_parameters() );
    804806                break;
    805807          case DeclarationNode::Context:
    806808                at = new ContextDecl( aggregate->name );
     809                buildList( aggregate->params, at->get_parameters() );
    807810                break;
    808811          default:
    809812                assert( false );
    810813        } // switch
    811         buildList( aggregate->params, at->get_parameters() );
     814//      buildList( aggregate->params, at->get_parameters() );
    812815        buildList( aggregate->fields, at->get_members() );
    813816
  • src/SymTab/Validate.cc

    rf066321 r63afee0  
    628628        Declaration *makeStructAssignment( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting ) {
    629629                FunctionType *assignType = new FunctionType( Type::Qualifiers(), false );
     630
     631                // Make function polymorphic in same parameters as generic struct, if applicable
     632                std::list< TypeDecl* >& genericParams = aggregateDecl->get_parameters();
     633                for ( std::list< TypeDecl* >::const_iterator param = genericParams.begin(); param != genericParams.end(); ++param ) {
     634                        assignType->get_forall().push_back( (*param)->clone() );
     635                }
    630636 
    631637                ObjectDecl *returnVal = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, refType->clone(), 0 );
  • src/SynTree/ReferenceToType.cc

    rf066321 r63afee0  
    5959std::string StructInstType::typeString() const { return "struct"; }
    6060
     61std::list<TypeDecl*>& StructInstType::get_baseParameters() { return baseStruct->get_parameters(); }
     62
    6163void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
    6264        assert( baseStruct );
     
    6567
    6668std::string UnionInstType::typeString() const { return "union"; }
     69
     70std::list<TypeDecl*>& UnionInstType::get_baseParameters() { return baseUnion->get_parameters(); }
    6771
    6872void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const {
  • src/SynTree/Type.h

    rf066321 r63afee0  
    237237        StructDecl *get_baseStruct() const { return baseStruct; }
    238238        void set_baseStruct( StructDecl *newValue ) { baseStruct = newValue; }
    239        
    240         // a utility function
     239
     240        /// Accesses generic parameters of base struct
     241        std::list<TypeDecl*>& get_baseParameters();
     242       
     243        /// Looks up the members of this struct named "name" and places them into "foundDecls".
     244        /// Clones declarations into "foundDecls", caller responsible for freeing
    241245        void lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const;
    242246
     
    260264        UnionDecl *get_baseUnion() const { return baseUnion; }
    261265        void set_baseUnion( UnionDecl *newValue ) { baseUnion = newValue; }
    262        
    263         // a utility function
     266
     267        /// Accesses generic parameters of base union
     268        std::list<TypeDecl*>& get_baseParameters();
     269       
     270        /// looks up the members of this union named "name" and places them into "foundDecls"
     271        /// Clones declarations into "foundDecls", caller responsible for freeing
    264272        void lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const;
    265273
  • src/SynTree/TypeSubstitution.cc

    rf066321 r63afee0  
    126126Type *TypeSubstitution::handleType( TypeClass *type ) {
    127127        BoundVarsType oldBoundVars( boundVars );
     128        // bind type variables from forall-qualifiers
    128129        if ( freeOnly ) {
    129130                for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
     
    136137}
    137138
     139template< typename TypeClass >
     140Type *TypeSubstitution::handleAggregateType( TypeClass *type ) {
     141        BoundVarsType oldBoundVars( boundVars );
     142        // bind type variables from forall-qualifiers
     143        if ( freeOnly ) {
     144                for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
     145                        boundVars.insert( (*tyvar )->get_name() );
     146                } // for
     147        } // if
     148        // bind type variables from generic type instantiations
     149        for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_baseParameters().begin(); tyvar != type->get_baseParameters().end(); ++tyvar ) {
     150                boundVars.insert( (*tyvar)->get_name() );
     151        } // for
     152        Type *ret = Mutator::mutate( type );
     153        boundVars = oldBoundVars;
     154        return ret;
     155}
     156
    138157Type * TypeSubstitution::mutate( VoidType *basicType ) {
    139158        return handleType( basicType );
     
    157176
    158177Type * TypeSubstitution::mutate( StructInstType *aggregateUseType ) {
    159         return handleType( aggregateUseType );
     178        return handleAggregateType( aggregateUseType );
    160179}
    161180
    162181Type * TypeSubstitution::mutate( UnionInstType *aggregateUseType ) {
    163         return handleType( aggregateUseType );
     182        return handleAggregateType( aggregateUseType );
    164183}
    165184
  • src/SynTree/TypeSubstitution.h

    rf066321 r63afee0  
    5858        virtual Type* mutate(TypeInstType *aggregateUseType);
    5959        virtual Expression* mutate(NameExpr *nameExpr);
    60        
     60
     61        /// Records type variable bindings from forall-statements
    6162        template< typename TypeClass > Type *handleType( TypeClass *type );
     63        /// Records type variable bindings from forall-statements and instantiations of generic types
     64        template< typename TypeClass > Type *handleAggregateType( TypeClass *type );
    6265       
    6366        virtual Type* mutate(VoidType *basicType);
  • src/main.cc

    rf066321 r63afee0  
    2424#include "SynTree/Declaration.h"
    2525#include "SynTree/Visitor.h"
     26#include "GenPoly/InstantiateGeneric.h"
    2627#include "GenPoly/Lvalue.h"
    2728#include "GenPoly/Specialize.h"
     
    268269                }
    269270
     271                OPTPRINT( "instantiateGeneric" )
     272                GenPoly::instantiateGeneric( translationUnit );
    270273                OPTPRINT( "copyParams" );
    271274                GenPoly::copyParams( translationUnit );
Note: See TracChangeset for help on using the changeset viewer.