Changeset 265e460 for src/GenPoly/GenPoly.h
- Timestamp:
- Oct 8, 2022, 9:43:21 AM (3 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- b2ddaf3
- Parents:
- 815943f (diff), d8c96a9 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/GenPoly.h
r815943f r265e460 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Aug 19 16:03:00 202213 // Update Count : 812 // Last Modified On : Fri Oct 7 15:06:00 2022 13 // Update Count : 9 14 14 // 15 15 … … 20 20 21 21 #include "ErasableScopedMap.h" // for ErasableScopedMap 22 #include "AST/Fwd.hpp" 22 #include "AST/Decl.hpp" // for TypeDecl::Data 23 #include "AST/Fwd.hpp" // for ApplicationExpr, BaseInstType, Func... 23 24 #include "SymTab/Mangler.h" // for Mangler 24 25 #include "SynTree/Declaration.h" // for TypeDecl::Data, AggregateDecl, Type... … … 29 30 // TODO Via some tricks this works for ast::TypeDecl::Data as well. 30 31 typedef ErasableScopedMap< std::string, TypeDecl::Data > TyVarMap; 32 using TypeVarMap = ErasableScopedMap< std::string, ast::TypeDecl::Data >; 31 33 32 34 /// Replaces a TypeInstType by its referrent in the environment, if applicable … … 39 41 /// returns polymorphic type if is polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided 40 42 Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 ); 41 const ast::Type * isPolyType( const ast::Type * type, const TyVarMap & tyVars, const ast::TypeSubstitution * env = nullptr);43 const ast::Type * isPolyType( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst = nullptr ); 42 44 43 45 /// returns dynamic-layout type if is dynamic-layout type in tyVars, NULL otherwise; will look up substitution in env if provided 44 46 ReferenceToType *isDynType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 ); 45 const ast::BaseInstType *isDynType( const ast::Type * type, const TyVarMap &tyVars, const ast::TypeSubstitution *typeSubs= 0 );47 const ast::BaseInstType *isDynType( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst = 0 ); 46 48 47 49 /// true iff function has dynamic-layout return type under the given type variable map 48 50 ReferenceToType *isDynRet( FunctionType *function, const TyVarMap &tyVars ); 51 const ast::BaseInstType *isDynRet( const ast::FunctionType * type, const TypeVarMap & typeVars ); 49 52 50 53 /// true iff function has dynamic-layout return type under the type variable map generated from its forall-parameters … … 53 56 /// A function needs an adapter if it returns a dynamic-layout value or if any of its parameters have dynamic-layout type 54 57 bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVarr ); 58 bool needsAdapter( ast::FunctionType const * adaptee, const TypeVarMap & typeVars ); 55 59 56 60 /// returns polymorphic type if is pointer to polymorphic type, NULL otherwise; will look up substitution in env if provided … … 59 63 /// returns polymorphic type if is pointer to polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided 60 64 Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 ); 65 const ast::Type * isPolyPtr( const ast::Type * type, const TypeVarMap & typeVars, const ast::TypeSubstitution * env = 0 ); 61 66 62 67 /// if the base type (after dereferencing N >= 0 pointers) is a polymorphic type, returns the base type, NULL otherwise; … … 67 72 /// N will be stored in levels, if provided, will look up substitution in env if provided 68 73 Type *hasPolyBase( Type *type, const TyVarMap &tyVars, int *levels = 0, const TypeSubstitution *env = 0 ); 74 const ast::Type * hasPolyBase( const ast::Type * type, const TypeVarMap & typeVars, int * levels = 0, const ast::TypeSubstitution * env = 0 ); 69 75 70 76 /// true iff this type or some base of this type after dereferencing pointers is either polymorphic or a generic type with at least one … … 90 96 /// true if arg requires boxing given exprTyVars 91 97 bool needsBoxing( Type * param, Type * arg, const TyVarMap &exprTyVars, const TypeSubstitution * env ); 92 bool needsBoxing( const ast::Type * param, const ast::Type * arg, const Ty VarMap &exprTyVars, const ast::TypeSubstitution * env);98 bool needsBoxing( const ast::Type * param, const ast::Type * arg, const TypeVarMap & typeVars, const ast::TypeSubstitution * subst ); 93 99 94 100 /// true if arg requires boxing in the call to appExpr 95 101 bool needsBoxing( Type * param, Type * arg, ApplicationExpr * appExpr, const TypeSubstitution * env ); 96 bool needsBoxing( const ast::Type * param, const ast::Type * arg, const ast::ApplicationExpr * appExpr, const ast::TypeSubstitution * env);102 bool needsBoxing( const ast::Type * param, const ast::Type * arg, const ast::ApplicationExpr * expr, const ast::TypeSubstitution * subst ); 97 103 98 104 /// Adds the type variable `tyVar` to `tyVarMap` 99 105 void addToTyVarMap( TypeDecl * tyVar, TyVarMap &tyVarMap ); 106 void addToTypeVarMap( const ast::TypeDecl * type, TypeVarMap & typeVars ); 100 107 101 108 /// Adds the declarations in the forall list of type (and its pointed-to type if it's a pointer type) to `tyVarMap` 102 109 void makeTyVarMap( Type *type, TyVarMap &tyVarMap ); 103 void makeTy VarMap(const ast::Type * type, TyVarMap & tyVarMap);110 void makeTypeVarMap( const ast::Type * type, TypeVarMap & typeVars ); 104 111 105 112 /// Prints type variable map 106 113 void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap ); 114 void printTypeVarMap( std::ostream &os, const TypeVarMap & typeVars ); 107 115 108 116 /// Gets the mangled name of this type; alias for SymTab::Mangler::mangleType().
Note:
See TracChangeset
for help on using the changeset viewer.