[51587aa] | 1 | //
|
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
---|
| 3 | //
|
---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
---|
| 5 | // file "LICENCE" distributed with Cforall.
|
---|
| 6 | //
|
---|
[01aeade] | 7 | // GenPoly.h --
|
---|
[51587aa] | 8 | //
|
---|
| 9 | // Author : Richard C. Bilson
|
---|
| 10 | // Created On : Mon May 18 07:44:20 2015
|
---|
[bdf1954] | 11 | // Last Modified By : Rob Schluntz
|
---|
| 12 | // Last Modified On : Tue Nov 24 15:24:38 2015
|
---|
| 13 | // Update Count : 6
|
---|
[51587aa] | 14 | //
|
---|
[51b73452] | 15 |
|
---|
[b1a6d6b] | 16 | #ifndef GENPOLY_H
|
---|
| 17 | #define GENPOLY_H
|
---|
| 18 |
|
---|
[51b73452] | 19 | #include <map>
|
---|
| 20 | #include <string>
|
---|
| 21 | #include <iostream>
|
---|
[ffad73a] | 22 |
|
---|
[51b73452] | 23 | #include "SynTree/Declaration.h"
|
---|
[ffad73a] | 24 | #include "SynTree/TypeSubstitution.h"
|
---|
[51b73452] | 25 |
|
---|
| 26 | namespace GenPoly {
|
---|
[01aeade] | 27 | typedef std::map< std::string, TypeDecl::Kind > TyVarMap;
|
---|
[51b73452] | 28 |
|
---|
[ffad73a] | 29 | /// A function needs an adapter if it returns a polymorphic value or if any of its
|
---|
| 30 | /// parameters have polymorphic type
|
---|
[01aeade] | 31 | bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVarr );
|
---|
[ffad73a] | 32 |
|
---|
| 33 | /// true iff function has polymorphic return type
|
---|
[e56cfdb0] | 34 | bool isPolyRet( FunctionType *function, std::string &name, const TyVarMap &otherTyVars );
|
---|
| 35 | bool isPolyRet( FunctionType *function, std::string &name );
|
---|
| 36 | bool isPolyRet( FunctionType *function, const TyVarMap &otherTyVars );
|
---|
[bdf1954] | 37 |
|
---|
[ffad73a] | 38 | /// returns polymorphic type if is polymorphic type, NULL otherwise; will look up substitution in env if provided
|
---|
| 39 | Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
|
---|
| 40 |
|
---|
| 41 | /// returns polymorphic type if is pointer to polymorphic type, NULL otherwise; will look up substitution in env if provided
|
---|
| 42 | Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
|
---|
| 43 |
|
---|
| 44 | /// Prints type variable map
|
---|
[01aeade] | 45 | void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap );
|
---|
[ffad73a] | 46 |
|
---|
| 47 | /// Gets the name of the sizeof parameter for the type
|
---|
| 48 | std::string sizeofName( Type *ty );
|
---|
| 49 |
|
---|
| 50 | /// Gets the name of the alignof parameter for the type
|
---|
| 51 | std::string alignofName( Type *ty );
|
---|
[51b73452] | 52 | } // namespace GenPoly
|
---|
[b1a6d6b] | 53 |
|
---|
[01aeade] | 54 | #endif // GENPOLY_H
|
---|
| 55 |
|
---|
[51587aa] | 56 | // Local Variables: //
|
---|
| 57 | // tab-width: 4 //
|
---|
| 58 | // mode: c++ //
|
---|
| 59 | // compile-command: "make install" //
|
---|
| 60 | // End: //
|
---|