source: src/GenPoly/GenPoly.h@ 4a79e3c9

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay gc_noraii jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new string stuck-waitfor-destruct with_gc
Last change on this file since 4a79e3c9 was 05d47278, checked in by Aaron Moss <a3moss@…>, 10 years ago

First draft of member expressions by passed offset

  • Property mode set to 100644
File size: 3.3 KB
RevLine 
[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"
[aadc9a4]24#include "SynTree/Type.h"
[ffad73a]25#include "SynTree/TypeSubstitution.h"
[51b73452]26
27namespace GenPoly {
[01aeade]28 typedef std::map< std::string, TypeDecl::Kind > TyVarMap;
[51b73452]29
[ffad73a]30 /// A function needs an adapter if it returns a polymorphic value or if any of its
31 /// parameters have polymorphic type
[01aeade]32 bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVarr );
[ffad73a]33
34 /// true iff function has polymorphic return type
[aadc9a4]35 ReferenceToType *isPolyRet( FunctionType *function );
[bdf1954]36
[ffad73a]37 /// returns polymorphic type if is polymorphic type, NULL otherwise; will look up substitution in env if provided
[0f889a77]38 Type *isPolyType( Type *type, const TypeSubstitution *env = 0 );
39
40 /// returns polymorphic type if is polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided
[ffad73a]41 Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
42
43 /// returns polymorphic type if is pointer to polymorphic type, NULL otherwise; will look up substitution in env if provided
[0f889a77]44 Type *isPolyPtr( Type *type, const TypeSubstitution *env = 0 );
45
46 /// returns polymorphic type if is pointer to polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided
[ffad73a]47 Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
48
[05d47278]49 /// returns polymorphic base type if the base type (after dereferencing any number of pointers) is a polymorphic type, NULL otherwise;
50 /// will look up substitution in env if provided
51 Type *hasPolyBase( Type *type, const TypeSubstitution *env = 0 );
52
53 /// returns polymorphic base type if the base type (after dereferencing any number of pointers) is a polymorphic type in tyVars, NULL otherwise;
54 /// will look up substitution in env if provided
55 Type *hasPolyBase( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
56
[7754cde]57 /// Returns a pointer to the base FunctionType if ty is the type of a function (or pointer to one), NULL otherwise
[05d47278]58 FunctionType *getFunctionType( Type *ty );
59
60 /// Returns the base variable (possibly repeatedly dereferenced) for an expression, NULL if none found
61 VariableExpr *getBaseVar( Expression *expr );
[7754cde]62
[aadc9a4]63 /// Adds the declarations in the forall list of type (and its pointed-to type if it's a pointer type) to `tyVarMap`
64 void makeTyVarMap( Type *type, TyVarMap &tyVarMap );
65
[ffad73a]66 /// Prints type variable map
[01aeade]67 void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap );
[ffad73a]68
69 /// Gets the name of the sizeof parameter for the type
70 std::string sizeofName( Type *ty );
71
72 /// Gets the name of the alignof parameter for the type
73 std::string alignofName( Type *ty );
[05d47278]74
75 /// Gets the name of the offsetof parameter for the type
76 std::string offsetofName( Type *ty );
[51b73452]77} // namespace GenPoly
[b1a6d6b]78
[01aeade]79#endif // GENPOLY_H
80
[51587aa]81// Local Variables: //
82// tab-width: 4 //
83// mode: c++ //
84// compile-command: "make install" //
85// End: //
Note: See TracBrowser for help on using the repository browser.