source: src/GenPoly/GenPoly.h@ 771b3c3

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 with_gc
Last change on this file since 771b3c3 was 7754cde, checked in by Aaron Moss <a3moss@…>, 10 years ago

First draft of passing generic size/align

  • Property mode set to 100644
File size: 2.5 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"
[ffad73a]24#include "SynTree/TypeSubstitution.h"
[51b73452]25
26namespace 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
[0f889a77]39 Type *isPolyType( Type *type, const TypeSubstitution *env = 0 );
40
41 /// returns polymorphic type if is polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided
[ffad73a]42 Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
43
44 /// returns polymorphic type if is pointer to polymorphic type, NULL otherwise; will look up substitution in env if provided
[0f889a77]45 Type *isPolyPtr( Type *type, const TypeSubstitution *env = 0 );
46
47 /// returns polymorphic type if is pointer to polymorphic type in tyVars, NULL otherwise; will look up substitution in env if provided
[ffad73a]48 Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
49
[7754cde]50 /// Returns a pointer to the base FunctionType if ty is the type of a function (or pointer to one), NULL otherwise
51 FunctionType * getFunctionType( Type *ty );
52
[ffad73a]53 /// Prints type variable map
[01aeade]54 void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap );
[ffad73a]55
56 /// Gets the name of the sizeof parameter for the type
57 std::string sizeofName( Type *ty );
58
59 /// Gets the name of the alignof parameter for the type
60 std::string alignofName( Type *ty );
[51b73452]61} // namespace GenPoly
[b1a6d6b]62
[01aeade]63#endif // GENPOLY_H
64
[51587aa]65// Local Variables: //
66// tab-width: 4 //
67// mode: c++ //
68// compile-command: "make install" //
69// End: //
Note: See TracBrowser for help on using the repository browser.