Changeset f22b170b


Ignore:
Timestamp:
Nov 16, 2023, 9:22:34 AM (6 months ago)
Author:
caparson <caparson@…>
Branches:
master
Children:
aad677d
Parents:
89a8bab (diff), b8b5535 (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:software/cfa/cfa-cc

Location:
src
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • src/Common/Iterate.hpp

    r89a8bab rf22b170b  
    5858        template<typename val_t>
    5959        struct value_t {
     60                size_t idx;
    6061                val_t & val;
    61                 size_t idx;
    6262        };
    6363
     
    6969                iterator_t( iter_t _it, size_t _idx ) : it(_it), idx(_idx) {}
    7070
    71                 value_t<val_t> operator*() const { return value_t<val_t>{ *it, idx }; }
     71                value_t<val_t> operator*() const { return value_t<val_t>{ idx, *it }; }
    7272
    7373                bool operator==(const iterator_t & o) const { return o.it == it; }
  • src/Concurrency/WaitforNew.cpp

    r89a8bab rf22b170b  
    450450        );
    451451
    452         // For some reason, enumerate doesn't work here because of references.
    453         for ( size_t i = 0 ; i < waitfor->clauses.size() ; ++i ) {
     452        for ( const auto & [i, clause] : enumerate( waitfor->clauses ) ) {
    454453                theSwitch->cases.push_back(
    455454                        new ast::CaseClause( location,
     
    457456                                {
    458457                                        new ast::CompoundStmt( location, {
    459                                                 waitfor->clauses[i]->stmt,
     458                                                clause->stmt,
    460459                                                new ast::BranchStmt( location,
    461460                                                        ast::BranchStmt::Break,
     
    538537        ast::Stmt       * setter      = makeSetter( location, flag );
    539538
    540         // For some reason, enumerate doesn't work here because of references.
    541         for ( size_t i = 0 ; i < stmt->clauses.size() ; ++i ) {
    542                 init_clause( comp, acceptables, i, stmt->clauses[i], setter );
     539        for ( const auto & [i, clause] : enumerate( stmt->clauses ) ) {
     540                init_clause( comp, acceptables, i, clause, setter );
    543541        }
    544542
  • src/GenPoly/Box.h

    r89a8bab rf22b170b  
    1616#pragma once
    1717
    18 #include <list>  // for list
    19 
    20 class Declaration;
    2118namespace ast {
    2219        class TranslationUnit;
     
    2421
    2522namespace GenPoly {
    26         /// boxes polymorphic function calls
    27         void box( std::list< Declaration* >& translationUnit );
     23
    2824void box( ast::TranslationUnit & translationUnit );
     25
    2926} // namespace GenPoly
    3027
  • src/GenPoly/ErasableScopedMap.h

    r89a8bab rf22b170b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ErasableScopedMap.h --
     7// ErasableScopedMap.h -- A map that supports scoping and erasing elements.
    88//
    99// Author           : Aaron B. Moss
  • src/GenPoly/FindFunction.cc

    r89a8bab rf22b170b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FindFunction.cc --
     7// FindFunction.cc -- Find function types in a larger type.
    88//
    99// Author           : Richard C. Bilson
     
    6969        GuardScope( typeVars );
    7070        handleForall( type->forall );
    71         //ast::accept_all( type->returns, *visitor );
    72         // This might have to become ast::mutate_each with return.
    7371        ast::accept_each( type->returns, *visitor );
    7472}
     
    7977                functions.push_back( type );
    8078                if ( replaceMode ) {
    81                         // replace type parameters in function type with void*
     79                        // Replace type parameters in function type with void *.
    8280                        ret = scrubTypeVars( ast::deepCopy( type ), typeVars );
    8381                } // if
  • src/GenPoly/FindFunction.h

    r89a8bab rf22b170b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FindFunction.h --
     7// FindFunction.h -- Find function types in a larger type.
    88//
    99// Author           : Richard C. Bilson
     
    1616#pragma once
    1717
    18 #include "GenPoly.h"  // for TyVarMap
     18#include "GenPoly.h"            // for TypeVarMap
    1919
    2020namespace GenPoly {
  • src/GenPoly/GenPoly.cc

    r89a8bab rf22b170b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // GenPoly.cc --
     7// GenPoly.cc -- General GenPoly utilities.
    88//
    99// Author           : Richard C. Bilson
     
    3333
    3434namespace GenPoly {
    35         namespace {
    36                 /// Checks a parameter list for polymorphic parameters; will substitute according to env if present
    37                 bool hasPolyParams( const std::vector<ast::ptr<ast::Expr>> & params, const ast::TypeSubstitution * env ) {
    38                         for ( auto &param : params ) {
    39                                 auto paramType = param.as<ast::TypeExpr>();
    40                                 assertf( paramType, "Aggregate parameters should be type expressions" );
    41                                 if ( isPolyType( paramType->type, env ) ) return true;
     35
     36namespace {
     37        /// Checks a parameter list for polymorphic parameters; will substitute according to env if present.
     38        bool hasPolyParams( const std::vector<ast::ptr<ast::Expr>> & params, const ast::TypeSubstitution * env ) {
     39                for ( auto & param : params ) {
     40                        auto paramType = param.as<ast::TypeExpr>();
     41                        assertf( paramType, "Aggregate parameters should be type expressions" );
     42                        if ( isPolyType( paramType->type, env ) ) return true;
     43                }
     44                return false;
     45        }
     46
     47        /// Checks a parameter list for polymorphic parameters from typeVars; will substitute according to env if present.
     48        bool hasPolyParams( const std::vector<ast::ptr<ast::Expr>> & params, const TypeVarMap & typeVars, const ast::TypeSubstitution * env ) {
     49                for ( auto & param : params ) {
     50                        auto paramType = param.as<ast::TypeExpr>();
     51                        assertf( paramType, "Aggregate parameters should be type expressions" );
     52                        if ( isPolyType( paramType->type, typeVars, env ) ) return true;
     53                }
     54                return false;
     55        }
     56
     57        /// Checks a parameter list for dynamic-layout parameters from tyVars; will substitute according to env if present.
     58        bool hasDynParams(
     59                        const std::vector<ast::ptr<ast::Expr>> & params,
     60                        const TypeVarMap & typeVars,
     61                        const ast::TypeSubstitution * subst ) {
     62                for ( ast::ptr<ast::Expr> const & paramExpr : params ) {
     63                        auto param = paramExpr.as<ast::TypeExpr>();
     64                        assertf( param, "Aggregate parameters should be type expressions." );
     65                        if ( isDynType( param->type.get(), typeVars, subst ) ) {
     66                                return true;
    4267                        }
    43                         return false;
    44                 }
    45 
    46                 /// Checks a parameter list for polymorphic parameters from tyVars; will substitute according to env if present
    47                 bool hasPolyParams( const std::vector<ast::ptr<ast::Expr>> & params, const TypeVarMap & typeVars, const ast::TypeSubstitution * env ) {
    48                         for ( auto & param : params ) {
    49                                 auto paramType = param.as<ast::TypeExpr>();
    50                                 assertf( paramType, "Aggregate parameters should be type expressions" );
    51                                 if ( isPolyType( paramType->type, typeVars, env ) ) return true;
    52                         }
    53                         return false;
    54                 }
    55 
    56                 /// Checks a parameter list for dynamic-layout parameters from tyVars; will substitute according to env if present
    57                 bool hasDynParams(
    58                                 const std::vector<ast::ptr<ast::Expr>> & params,
    59                                 const TypeVarMap & typeVars,
    60                                 const ast::TypeSubstitution * subst ) {
    61                         for ( ast::ptr<ast::Expr> const & paramExpr : params ) {
    62                                 auto param = paramExpr.as<ast::TypeExpr>();
    63                                 assertf( param, "Aggregate parameters should be type expressions." );
    64                                 if ( isDynType( param->type.get(), typeVars, subst ) ) {
    65                                         return true;
    66                                 }
    67                         }
    68                         return false;
    69                 }
    70         }
    71 
    72         const ast::Type * replaceTypeInst(const ast::Type * type, const ast::TypeSubstitution * env) {
    73                 if (!env) return type;
    74                 if ( auto typeInst = dynamic_cast<const ast::TypeInstType*>(type) ) {
    75                         auto newType = env->lookup(typeInst);
    76                         if (newType) return newType;
    77                 }
     68                }
     69                return false;
     70        }
     71} // namespace
     72
     73const ast::Type * replaceTypeInst( const ast::Type * type, const ast::TypeSubstitution * env ) {
     74        if ( !env ) return type;
     75        if ( auto typeInst = dynamic_cast<const ast::TypeInstType*>( type ) ) {
     76                if ( auto newType = env->lookup( typeInst ) ) return newType;
     77        }
     78        return type;
     79}
     80
     81const ast::Type * isPolyType( const ast::Type * type, const ast::TypeSubstitution * subst ) {
     82        type = replaceTypeInst( type, subst );
     83
     84        if ( dynamic_cast< const ast::TypeInstType * >( type ) ) {
     85                // This case is where the two variants of isPolyType differ.
    7886                return type;
    79         }
    80 
    81         const ast::Type * isPolyType(const ast::Type * type, const ast::TypeSubstitution * env) {
    82                 type = replaceTypeInst( type, env );
    83 
    84                 if ( dynamic_cast< const ast::TypeInstType * >( type ) ) {
    85                         return type;
    86                 } else if ( auto arrayType = dynamic_cast< const ast::ArrayType * >( type ) ) {
    87                         return isPolyType( arrayType->base, env );
    88                 } else if ( auto structType = dynamic_cast< const ast::StructInstType* >( type ) ) {
    89                         if ( hasPolyParams( structType->params, env ) ) return type;
    90                 } else if ( auto unionType = dynamic_cast< const ast::UnionInstType* >( type ) ) {
    91                         if ( hasPolyParams( unionType->params, env ) ) return type;
    92                 }
    93                 return 0;
    94         }
     87        } else if ( auto arrayType = dynamic_cast< const ast::ArrayType * >( type ) ) {
     88                return isPolyType( arrayType->base, subst );
     89        } else if ( auto structType = dynamic_cast< const ast::StructInstType* >( type ) ) {
     90                if ( hasPolyParams( structType->params, subst ) ) return type;
     91        } else if ( auto unionType = dynamic_cast< const ast::UnionInstType* >( type ) ) {
     92                if ( hasPolyParams( unionType->params, subst ) ) return type;
     93        }
     94        return nullptr;
     95}
    9596
    9697const ast::Type * isPolyType( const ast::Type * type,
     
    121122                }
    122123        } else if ( auto inst = dynamic_cast<ast::StructInstType const *>( type ) ) {
    123                 if ( hasDynParams( inst->params, typeVars, subst ) ) {
    124                         return inst;
    125                 }
     124                if ( hasDynParams( inst->params, typeVars, subst ) ) return inst;
    126125        } else if ( auto inst = dynamic_cast<ast::UnionInstType const *>( type ) ) {
    127                 if ( hasDynParams( inst->params, typeVars, subst ) ) {
    128                         return inst;
    129                 }
     126                if ( hasDynParams( inst->params, typeVars, subst ) ) return inst;
    130127        }
    131128        return nullptr;
     
    190187}
    191188
    192         const ast::FunctionType * getFunctionType( const ast::Type * ty ) {
    193                 if ( auto pty = dynamic_cast< const ast::PointerType * >( ty ) ) {
    194                         return pty->base.as< ast::FunctionType >();
    195                 } else {
    196                         return dynamic_cast< const ast::FunctionType * >( ty );
    197                 }
    198         }
    199 
    200         namespace {
    201                 /// Checks if is a pointer to D
    202                 template<typename D, typename B>
    203                 bool is( const B* p ) { return type_index{typeid(D)} == type_index{typeid(*p)}; }
    204 
    205                 /// Converts to a pointer to D without checking for safety
    206                 template<typename D, typename B>
    207                 inline D* as( B* p ) { return reinterpret_cast<D*>(p); }
    208 
    209                 template<typename D, typename B>
    210                 inline D const * as( B const * p ) {
    211                         return reinterpret_cast<D const *>( p );
    212                 }
    213 
    214                 /// Flattens a list of types.
    215                 // There is another flattenList in Unify.
    216                 void flattenList( vector<ast::ptr<ast::Type>> const & src,
    217                                 vector<ast::ptr<ast::Type>> & out ) {
    218                         for ( auto const & type : src ) {
    219                                 ResolvExpr::flatten( type, out );
    220                         }
    221                 }
    222 
    223                 bool paramListsPolyCompatible(
    224                                 std::vector<ast::ptr<ast::Expr>> const & lparams,
    225                                 std::vector<ast::ptr<ast::Expr>> const & rparams ) {
    226                         if ( lparams.size() != rparams.size() ) {
     189const ast::FunctionType * getFunctionType( const ast::Type * ty ) {
     190        if ( auto pty = dynamic_cast< const ast::PointerType * >( ty ) ) {
     191                return pty->base.as< ast::FunctionType >();
     192        } else {
     193                return dynamic_cast< const ast::FunctionType * >( ty );
     194        }
     195}
     196
     197namespace {
     198        /// Checks if is a pointer to D
     199        template<typename D, typename B>
     200        bool is( const B* p ) { return type_index{typeid(D)} == type_index{typeid(*p)}; }
     201
     202        /// Converts to a pointer to D without checking for safety
     203        template<typename D, typename B>
     204        inline D* as( B* p ) { return reinterpret_cast<D*>(p); }
     205
     206        template<typename D, typename B>
     207        inline D const * as( B const * p ) {
     208                return reinterpret_cast<D const *>( p );
     209        }
     210
     211        /// Flattens a list of types.
     212        void flattenList( vector<ast::ptr<ast::Type>> const & src,
     213                        vector<ast::ptr<ast::Type>> & out ) {
     214                for ( auto const & type : src ) {
     215                        ResolvExpr::flatten( type, out );
     216                }
     217        }
     218
     219        bool paramListsPolyCompatible(
     220                        std::vector<ast::ptr<ast::Expr>> const & lparams,
     221                        std::vector<ast::ptr<ast::Expr>> const & rparams ) {
     222                if ( lparams.size() != rparams.size() ) {
     223                        return false;
     224                }
     225
     226                for ( auto lparam = lparams.begin(), rparam = rparams.begin() ;
     227                                lparam != lparams.end() ; ++lparam, ++rparam ) {
     228                        ast::TypeExpr const * lexpr = lparam->as<ast::TypeExpr>();
     229                        assertf( lexpr, "Aggregate parameters should be type expressions" );
     230                        ast::TypeExpr const * rexpr = rparam->as<ast::TypeExpr>();
     231                        assertf( rexpr, "Aggregate parameters should be type expressions" );
     232
     233                        // xxx - might need to let VoidType be a wildcard here too; could have some voids
     234                        // stuffed in for dtype-statics.
     235                        // if ( is<VoidType>( lexpr->type() ) || is<VoidType>( bparam->get_type() ) ) continue;
     236                        if ( !typesPolyCompatible( lexpr->type, rexpr->type ) ) {
    227237                                return false;
    228238                        }
    229 
    230                         for ( auto lparam = lparams.begin(), rparam = rparams.begin() ;
    231                                         lparam != lparams.end() ; ++lparam, ++rparam ) {
    232                                 ast::TypeExpr const * lexpr = lparam->as<ast::TypeExpr>();
    233                                 assertf( lexpr, "Aggregate parameters should be type expressions" );
    234                                 ast::TypeExpr const * rexpr = rparam->as<ast::TypeExpr>();
    235                                 assertf( rexpr, "Aggregate parameters should be type expressions" );
    236 
    237                                 // xxx - might need to let VoidType be a wildcard here too; could have some voids
    238                                 // stuffed in for dtype-statics.
    239                                 // if ( is<VoidType>( lexpr->type() ) || is<VoidType>( bparam->get_type() ) ) continue;
    240                                 if ( !typesPolyCompatible( lexpr->type, rexpr->type ) ) {
    241                                         return false;
    242                                 }
    243                         }
    244 
    245                         return true;
    246                 }
    247         }
     239                }
     240
     241                return true;
     242        }
     243} // namespace
    248244
    249245bool typesPolyCompatible( ast::Type const * lhs, ast::Type const * rhs ) {
     
    378374                const ast::TypeSubstitution * subst ) {
    379375        const ast::FunctionType * function = getFunctionType( expr->func->result );
    380         assertf( function, "ApplicationExpr has non-function type: %s", toString( expr->func->result ).c_str() );
     376        assertf( function, "ApplicationExpr has non-function type: %s", toCString( expr->func->result ) );
    381377        TypeVarMap exprTyVars;
    382378        makeTypeVarMap( function, exprTyVars );
  • src/GenPoly/GenPoly.h

    r89a8bab rf22b170b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // GenPoly.h --
     7// GenPoly.h -- General GenPoly utilities.
    88//
    99// Author           : Richard C. Bilson
     
    3030namespace GenPoly {
    3131
    32         struct TypeVarMap : public ErasableScopedMap<ast::TypeEnvKey, ast::TypeData> {
    33                 TypeVarMap() : ErasableScopedMap( ast::TypeData() ) {}
    34         };
     32struct TypeVarMap : public ErasableScopedMap<ast::TypeEnvKey, ast::TypeData> {
     33        TypeVarMap() : ErasableScopedMap( ast::TypeData() ) {}
     34};
    3535
    36         /// Replaces a TypeInstType by its referrent in the environment, if applicable
    37         const ast::Type * replaceTypeInst( const ast::Type *, const ast::TypeSubstitution * );
     36/// Replaces a TypeInstType by its referrent in the environment, if applicable.
     37const ast::Type * replaceTypeInst( const ast::Type *, const ast::TypeSubstitution * );
    3838
    39         /// returns polymorphic type if is polymorphic type, NULL otherwise; will look up substitution in env if provided
    40         const ast::Type * isPolyType(const ast::Type * type, const ast::TypeSubstitution * env = nullptr);
     39/// Returns polymorphic type if is polymorphic type, NULL otherwise; will look up substitution in env if provided.
     40const ast::Type * isPolyType( const ast::Type * type, const ast::TypeSubstitution * subst = nullptr );
    4141
    42         /// returns polymorphic type if is polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided
    43         const ast::Type * isPolyType( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst = nullptr );
     42/// Returns polymorphic type if is polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided.
     43const ast::Type * isPolyType( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst = nullptr );
    4444
    45         /// returns dynamic-layout type if is dynamic-layout type in tyVars, NULL otherwise; will look up substitution in env if provided
    46         const ast::BaseInstType *isDynType( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst = 0 );
     45/// Returns dynamic-layout type if is dynamic-layout type in tyVars, NULL otherwise; will look up substitution in env if provided.
     46const ast::BaseInstType *isDynType( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst = 0 );
    4747
    48         /// true iff function has dynamic-layout return type under the given type variable map
    49         const ast::BaseInstType *isDynRet( const ast::FunctionType * type, const TypeVarMap & typeVars );
     48/// Returns true iff function has dynamic-layout return type under the given type variable map.
     49const ast::BaseInstType *isDynRet( const ast::FunctionType * type, const TypeVarMap & typeVars );
    5050
    51         /// true iff function has dynamic-layout return type under the type variable map generated from its forall-parameters
    52         const ast::BaseInstType *isDynRet( const ast::FunctionType * func );
     51/// Returns true iff function has dynamic-layout return type under the type variable map generated from its forall-parameters.
     52const ast::BaseInstType *isDynRet( const ast::FunctionType * func );
    5353
    54         /// A function needs an adapter if it returns a dynamic-layout value or if any of its parameters have dynamic-layout type
    55         bool needsAdapter( ast::FunctionType const * adaptee, const TypeVarMap & typeVars );
     54/// A function needs an adapter if it returns a dynamic-layout value or if any of its parameters have dynamic-layout type.
     55bool needsAdapter( ast::FunctionType const * adaptee, const TypeVarMap & typeVars );
    5656
    57         /// returns polymorphic type if is pointer to polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided
    58         const ast::Type * isPolyPtr( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * env = 0 );
     57/// Returns polymorphic type if is pointer to polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided.
     58const ast::Type * isPolyPtr( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * env = 0 );
    5959
    60         /// if the base type (after dereferencing N >= 0 pointers) is a polymorphic type in tyVars, returns the base type, NULL otherwise;
    61         /// N will be stored in levels, if provided, will look up substitution in env if provided
    62         const ast::Type * hasPolyBase( const ast::Type * type, const TypeVarMap & typeVars, int * levels = 0, const ast::TypeSubstitution * env = 0 );
     60/// If the base type (after dereferencing N >= 0 pointers) is a polymorphic type in tyVars, returns the base type, NULL otherwise;
     61/// N will be stored in levels, if provided, will look up substitution in env if provided.
     62const ast::Type * hasPolyBase( const ast::Type * type, const TypeVarMap & typeVars, int * levels = 0, const ast::TypeSubstitution * env = 0 );
    6363
    64         /// Returns a pointer to the base FunctionType if ty is the type of a function (or pointer to one), NULL otherwise
    65         const ast::FunctionType * getFunctionType( const ast::Type * ty );
     64/// Returns a pointer to the base FunctionType if ty is the type of a function (or pointer to one), NULL otherwise.
     65const ast::FunctionType * getFunctionType( const ast::Type * ty );
    6666
    67         /// true iff types are structurally identical, where TypeInstType's match any type.
    68         bool typesPolyCompatible( ast::Type const * lhs, ast::Type const * rhs );
     67/// Returns true iff types are structurally identical, where TypeInstType's match any type.
     68bool typesPolyCompatible( ast::Type const * lhs, ast::Type const * rhs );
    6969
    70         /// true if arg requires boxing given exprTyVars
    71         bool needsBoxing( const ast::Type * param, const ast::Type * arg, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst );
     70/// Returns true if arg requires boxing given typeVars.
     71bool needsBoxing( const ast::Type * param, const ast::Type * arg, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst );
    7272
    73         /// true if arg requires boxing in the call to appExpr
    74         bool needsBoxing( const ast::Type * param, const ast::Type * arg, const ast::ApplicationExpr * expr, const ast::TypeSubstitution * subst );
     73/// Returns true if arg requires boxing in the call to appExpr.
     74bool needsBoxing( const ast::Type * param, const ast::Type * arg, const ast::ApplicationExpr * expr, const ast::TypeSubstitution * subst );
    7575
    76         /// Adds the type variable `tyVar` to `tyVarMap`
    77         void addToTypeVarMap( const ast::TypeDecl * type, TypeVarMap & typeVars );
    78         void addToTypeVarMap( const ast::TypeInstType * type, TypeVarMap & typeVars );
     76/// Adds the type variable `type` to `typeVars`.
     77void addToTypeVarMap( const ast::TypeDecl * type, TypeVarMap & typeVars );
     78void addToTypeVarMap( const ast::TypeInstType * type, TypeVarMap & typeVars );
    7979
    80         /// Adds the declarations in the forall list of type (and its pointed-to type if it's a pointer type) to `tyVarMap`
    81         void makeTypeVarMap( const ast::Type * type, TypeVarMap & typeVars );
    82         void makeTypeVarMap( const ast::FunctionDecl * decl, TypeVarMap & typeVars );
     80/// Adds the declarations in the forall list of type (and its pointed-to type if it's a pointer type) to `typeVars`.
     81void makeTypeVarMap( const ast::Type * type, TypeVarMap & typeVars );
     82void makeTypeVarMap( const ast::FunctionDecl * decl, TypeVarMap & typeVars );
    8383
    84         /// Gets the name of the sizeof parameter for the type, given its mangled name
    85         inline std::string sizeofName( const std::string &name ) { return std::string( "_sizeof_" ) + name; }
     84/// Gets the name of the sizeof parameter for the type, given its mangled name.
     85inline std::string sizeofName( const std::string &name ) { return std::string( "_sizeof_" ) + name; }
    8686
    87         /// Gets the name of the alignof parameter for the type, given its mangled name
    88         inline std::string alignofName( const std::string &name ) { return std::string( "_alignof_" ) + name; }
     87/// Gets the name of the alignof parameter for the type, given its mangled name.
     88inline std::string alignofName( const std::string &name ) { return std::string( "_alignof_" ) + name; }
    8989
    90         /// Gets the name of the offsetof parameter for the type, given its mangled name
    91         inline std::string offsetofName( const std::string &name ) { return std::string( "_offsetof_" ) + name; }
     90/// Gets the name of the offsetof parameter for the type, given its mangled name.
     91inline std::string offsetofName( const std::string &name ) { return std::string( "_offsetof_" ) + name; }
    9292
    93         /// Gets the name of the layout function for a given aggregate type, given its declaration
    94         inline std::string layoutofName( ast::AggregateDecl const * decl ) {
    95                 return std::string( "_layoutof_" ) + decl->name;
    96         }
     93/// Gets the name of the layout function for a given aggregate type, given its declaration.
     94inline std::string layoutofName( ast::AggregateDecl const * decl ) {
     95        return std::string( "_layoutof_" ) + decl->name;
     96}
    9797
    9898} // namespace GenPoly
  • src/GenPoly/InstantiateGeneric.h

    r89a8bab rf22b170b  
    1616#pragma once
    1717
    18 #include <list>  // for list
    19 
    20 class Declaration;
    2118namespace ast {
    2219        class TranslationUnit;
     
    2522namespace GenPoly {
    2623
    27 void instantiateGeneric( std::list< Declaration* > &translationUnit );
    2824void instantiateGeneric( ast::TranslationUnit & translationUnit );
    2925/// Replaces all generic types that have static layout with concrete
  • src/GenPoly/Lvalue.h

    r89a8bab rf22b170b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Lvalue.h --
     7// Lvalue.h -- Clean up lvalues and remove references.
    88//
    99// Author           : Richard C. Bilson
     
    1616#pragma once
    1717
    18 #include <list>  // for list
    19 
    20 class Declaration;
    21 class Expression;
    2218namespace ast {
    2319        class Expr;
     
    2622
    2723namespace GenPoly {
    28         /// replaces return type of `lvalue T` with `T*`, along with appropriate address-of and dereference operators
    29         void convertLvalue( std::list< Declaration* >& translationUnit );
    30         void convertLvalue( ast::TranslationUnit & translationUnit );
    3124
    32         /// true after reference types have been eliminated from the source code. After this point, reference types should not be added to the AST.
    33         bool referencesPermissable();
     25/// Replaces return type of `T&` with `T*`, along with appropriate address-of and dereference operators.
     26void convertLvalue( ast::TranslationUnit & translationUnit );
    3427
    35         /// applies transformations that allow GCC to accept more complicated lvalue expressions, e.g. &(a, b)
    36         Expression * generalizedLvalue( Expression * expr );
    37         ast::Expr const * generalizedLvalue( ast::Expr const * expr );
     28/// Returns true until reference types have been eliminated from the source code. After this point, reference types should not be added to the AST.
     29bool referencesPermissable();
     30
     31/// Applies transformations that allow GCC to accept more complicated lvalue expressions, e.g. &(a, b).
     32ast::Expr const * generalizedLvalue( ast::Expr const * expr );
     33
    3834} // namespace GenPoly
    3935
  • src/GenPoly/ScopedSet.h

    r89a8bab rf22b170b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ScopedSet.h --
     7// ScopedSet.h -- A set that supports save/restore scoping.
    88//
    99// Author           : Aaron B. Moss
  • src/GenPoly/ScrubTyVars.cc

    r89a8bab rf22b170b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ScrubTyVars.cc --
     7// ScrubTyVars.cc -- Remove polymorphic types.
    88//
    99// Author           : Richard C. Bilson
     
    2727
    2828struct ScrubTypeVars :
    29         public ast::WithGuards,
    30         public ast::WithShortCircuiting,
    31         public ast::WithVisitorRef<ScrubTypeVars> {
     29                public ast::WithGuards,
     30                public ast::WithShortCircuiting,
     31                public ast::WithVisitorRef<ScrubTypeVars> {
    3232
    3333        ScrubTypeVars( ScrubMode m, TypeVarMap const * tv ) :
  • src/GenPoly/ScrubTyVars.h

    r89a8bab rf22b170b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ScrubTyVars.h --
     7// ScrubTyVars.h -- Remove polymorphic types.
    88//
    99// Author           : Richard C. Bilson
     
    1919
    2020#include "AST/Fwd.hpp"        // for Node
    21 #include "GenPoly.h"          // for TyVarMap, isPolyType, isDynType
     21#include "GenPoly.h"          // for TypeVarMap, isPolyType, isDynType
    2222
    2323namespace GenPoly {
  • src/GenPoly/Specialize.h

    r89a8bab rf22b170b  
    1616#pragma once
    1717
    18 #include <list>  // for list
    19 
    20 class Declaration;
    2118namespace ast {
    2219        class TranslationUnit;
     
    2421
    2522namespace GenPoly {
    26         /// generates thunks where needed
    27         void convertSpecializations( std::list< Declaration* >& translationUnit );
    2823
    29         void convertSpecializations( ast::TranslationUnit & translationUnit );
     24void convertSpecializations( ast::TranslationUnit & translationUnit );
     25
    3026} // namespace GenPoly
    3127
  • src/Makefile.am

    r89a8bab rf22b170b  
    2020
    2121SRC = main.cc \
    22       CompilationState.cc \
    23       CompilationState.h \
    24           MakeLibCfaNew.cpp \
     22        CompilationState.cc \
     23        CompilationState.h \
     24        MakeLibCfaNew.cpp \
    2525        MakeLibCfa.h
    2626
Note: See TracChangeset for help on using the changeset viewer.