Changeset 000b914 for src/GenPoly


Ignore:
Timestamp:
Dec 7, 2015, 11:31:53 AM (8 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:
baf7fee
Parents:
e58be8e (diff), 47534159 (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 plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

Location:
src/GenPoly
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    re58be8e r000b914  
    5050                FunctionType *makeAdapterType( FunctionType *adaptee, const TyVarMap &tyVars );
    5151
     52                /// Replaces polymorphic return types with out-parameters, replaces calls to polymorphic functions with adapter calls as needed, and adds appropriate type variables to the function call
    5253                class Pass1 : public PolyMutator {
    5354                  public:
     
    8889                };
    8990
     91                /// Moves polymorphic returns in function types to pointer-type parameters, adds type size and assertion parameters to parameter lists as well
    9092                class Pass2 : public PolyMutator {
    9193                  public:
     
    105107                };
    106108
     109                /// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, and sizeof expressions of polymorphic types with the proper variable
    107110                class Pass3 : public PolyMutator {
    108111                  public:
     
    10091012                        std::list< DeclarationWithType *> inferredParams;
    10101013                        ObjectDecl *newObj = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0 );
    1011 ///   ObjectDecl *newFunPtr = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 );
     1014//   ObjectDecl *newFunPtr = new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) ), 0 );
    10121015                        for ( std::list< TypeDecl *>::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {
    10131016                                ObjectDecl *thisParm;
     
    10211024                                // move all assertions into parameter list
    10221025                                for ( std::list< DeclarationWithType *>::iterator assert = (*tyParm)->get_assertions().begin(); assert != (*tyParm)->get_assertions().end(); ++assert ) {
    1023 ///      *assert = (*assert)->acceptMutator( *this );
     1026//      *assert = (*assert)->acceptMutator( *this );
    10241027                                        inferredParams.push_back( *assert );
    10251028                                }
     
    10631066
    10641067                TypeDecl * Pass3::mutate( TypeDecl *typeDecl ) {
    1065 ///   Initializer *init = 0;
    1066 ///   std::list< Expression *> designators;
    1067 ///   scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
    1068 ///   if ( typeDecl->get_base() ) {
    1069 ///     init = new SimpleInit( new SizeofExpr( handleDecl( typeDecl, typeDecl->get_base() ) ), designators );
    1070 ///   }
    1071 ///   return new ObjectDecl( typeDecl->get_name(), Declaration::Extern, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::UnsignedInt ), init );
     1068//   Initializer *init = 0;
     1069//   std::list< Expression *> designators;
     1070//   scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
     1071//   if ( typeDecl->get_base() ) {
     1072//     init = new SimpleInit( new SizeofExpr( handleDecl( typeDecl, typeDecl->get_base() ) ), designators );
     1073//   }
     1074//   return new ObjectDecl( typeDecl->get_name(), Declaration::Extern, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::UnsignedInt ), init );
    10721075
    10731076                        scopeTyVars[ typeDecl->get_name() ] = typeDecl->get_kind();
  • src/GenPoly/FindFunction.h

    re58be8e r000b914  
    2323        typedef bool (*FindFunctionPredicate)( FunctionType*, const TyVarMap& );
    2424
     25        /// recursively walk `type`, placing all functions that match `predicate` under `tyVars` into `functions`
    2526        void findFunction( Type *type, std::list< FunctionType* > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate );
     27        /// like `findFunction`, but also replaces the function type with void ()(void)
    2628        void findAndReplaceFunction( Type *&type, std::list< FunctionType* > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate );
    2729} // namespace GenPoly
  • src/GenPoly/GenPoly.cc

    re58be8e r000b914  
    2121
    2222namespace GenPoly {
    23         // A function needs an adapter if it returns a polymorphic value or if any of its
    24         // parameters have polymorphic type
     23        /// A function needs an adapter if it returns a polymorphic value or if any of its
     24        /// parameters have polymorphic type
    2525        bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVars ) {
    2626                if ( ! adaptee->get_returnVals().empty() && isPolyVal( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
  • src/GenPoly/Lvalue.cc

    re58be8e r000b914  
    3535                const std::list<Label> noLabels;
    3636
     37                /// Replace uses of lvalue returns with appropriate pointers
    3738                class Pass1 : public Mutator {
    3839                  public:
     
    4647                };
    4748
     49                /// Replace declarations of lvalue returns with appropriate pointers
    4850                class Pass2 : public Visitor {
    4951                  public:
  • src/GenPoly/ScrubTyVars.h

    re58be8e r000b914  
    2626          public:
    2727                ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {}
    28  
     28
     29                /// Like scrub( SynTreeClass* ), but only applies to type variables in `tyVars`
    2930                template< typename SynTreeClass >
    3031                static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars );
     32                /// Replaces dtypes and ftypes with the appropriate void type, and sizeof expressions of polymorphic types with the proper variable
    3133                template< typename SynTreeClass >
    3234                static SynTreeClass *scrub( SynTreeClass *target );
Note: See TracChangeset for help on using the changeset viewer.