Ignore:
Timestamp:
Nov 15, 2023, 5:01:36 PM (9 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
f22b170b
Parents:
45a091b
Message:

Major round of clean-up in the GenPoly? directory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/GenPoly.h

    r45a091b rb8b5535  
    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
Note: See TracChangeset for help on using the changeset viewer.