Changeset 33a7b6d for src/GenPoly
- Timestamp:
- Nov 15, 2016, 5:30:52 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- d9fa60a
- Parents:
- 8f9cc50
- Location:
- src/GenPoly
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/GenPoly/Box.cc ¶
r8f9cc50 r33a7b6d 1288 1288 TyVarMap exprTyVars( (TypeDecl::Kind)-1 ); 1289 1289 makeTyVarMap( function, exprTyVars ); 1290 ReferenceToType *concRetType = dynamic_cast< ReferenceToType* >( appExpr->get_result() ); // xxx - is concRetType a good name? 1290 1291 ReferenceToType *dynRetType = isDynRet( function, exprTyVars ); 1291 1292 1292 1293 if ( dynRetType ) { 1293 ret = addDynRetParam( appExpr, function, dynRetType, arg );1294 ret = addDynRetParam( appExpr, function, concRetType, arg ); // xxx - used to use dynRetType instead of concRetType 1294 1295 } else if ( needsAdapter( function, scopeTyVars ) ) { 1295 1296 // std::cerr << "needs adapter: "; … … 1301 1302 arg = appExpr->get_args().begin(); 1302 1303 1303 passTypeVars( appExpr, dynRetType, arg, exprTyVars );1304 passTypeVars( appExpr, concRetType, arg, exprTyVars ); // xxx - used to use dynRetType instead of concRetType 1304 1305 addInferredParams( appExpr, function, arg, exprTyVars ); 1305 1306 … … 1364 1365 // line below cloned from FixFunction.cc 1365 1366 // xxx - functionObj is never added to a list of declarations... 1367 // alternatively, this function could return a new VariableExpr( functionDecl ) and change the result type of the new expression 1366 1368 ObjectDecl *functionObj = new ObjectDecl( functionDecl->get_name(), functionDecl->get_storageClass(), functionDecl->get_linkage(), 0, 1367 1369 new PointerType( Type::Qualifiers(), functionDecl->get_type()->clone() ), 0 ); -
TabularUnified src/GenPoly/GenPoly.cc ¶
r8f9cc50 r33a7b6d 92 92 } 93 93 94 Type *isDynType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) {94 ReferenceToType *isDynType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) { 95 95 type = replaceTypeInst( type, env ); 96 96 … … 98 98 auto var = tyVars.find( typeInst->get_name() ); 99 99 if ( var != tyVars.end() && var->second == TypeDecl::Any ) { 100 return type ;100 return typeInst; 101 101 } 102 102 } else if ( StructInstType *structType = dynamic_cast< StructInstType* >( type ) ) { 103 if ( hasDynParams( structType->get_parameters(), tyVars, env ) ) return type;103 if ( hasDynParams( structType->get_parameters(), tyVars, env ) ) return structType; 104 104 } else if ( UnionInstType *unionType = dynamic_cast< UnionInstType* >( type ) ) { 105 if ( hasDynParams( unionType->get_parameters(), tyVars, env ) ) return type;105 if ( hasDynParams( unionType->get_parameters(), tyVars, env ) ) return unionType; 106 106 } 107 107 return 0; -
TabularUnified src/GenPoly/GenPoly.h ¶
r8f9cc50 r33a7b6d 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // GenPoly.h -- 7 // GenPoly.h -- 8 8 // 9 9 // Author : Richard C. Bilson … … 34 34 /// Replaces a TypeInstType by its referrent in the environment, if applicable 35 35 Type* replaceTypeInst( Type* type, const TypeSubstitution* env ); 36 36 37 37 /// returns polymorphic type if is polymorphic type, NULL otherwise; will look up substitution in env if provided 38 38 Type *isPolyType( Type *type, const TypeSubstitution *env = 0 ); 39 39 40 40 /// returns polymorphic type if is polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided 41 41 Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 ); 42 42 43 43 /// returns dynamic-layout type if is dynamic-layout type in tyVars, NULL otherwise; will look up substitution in env if provided 44 Type *isDynType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );44 ReferenceToType *isDynType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 ); 45 45 46 46 /// true iff function has dynamic-layout return type under the given type variable map … … 55 55 /// returns polymorphic type if is pointer to polymorphic type, NULL otherwise; will look up substitution in env if provided 56 56 Type *isPolyPtr( Type *type, const TypeSubstitution *env = 0 ); 57 57 58 58 /// returns polymorphic type if is pointer to polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided 59 59 Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 ); … … 76 76 /// Adds the declarations in the forall list of type (and its pointed-to type if it's a pointer type) to `tyVarMap` 77 77 void makeTyVarMap( Type *type, TyVarMap &tyVarMap ); 78 78 79 79 /// Prints type variable map 80 80 void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap ); … … 82 82 /// Gets the mangled name of this type; alias for SymTab::Mangler::mangleType(). 83 83 inline std::string mangleType( Type *ty ) { return SymTab::Mangler::mangleType( ty ); } 84 84 85 85 /// Gets the name of the sizeof parameter for the type, given its mangled name 86 86 inline std::string sizeofName( const std::string &name ) { return std::string( "_sizeof_" ) + name; } … … 94 94 /// Gets the name of the layout function for a given aggregate type, given its declaration 95 95 inline std::string layoutofName( AggregateDecl *decl ) { return std::string( "_layoutof_" ) + decl->get_name(); } 96 96 97 97 } // namespace GenPoly 98 98
Note: See TracChangeset
for help on using the changeset viewer.