source: src/ResolvExpr/Unify.h @ 329487c

Last change on this file since 329487c was 251ce80, checked in by Fangren Yu <f37yu@…>, 17 months ago

remove reference to symbol table in unify

  • Property mode set to 100644
File size: 4.0 KB
RevLine 
[a32b204]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//
[66f8528]7// Unify.h --
[a32b204]8//
9// Author           : Richard C. Bilson
10// Created On       : Sun May 17 13:09:04 2015
[e563edf]11// Last Modified By : Andrew Beach
12// Last Modified On : Tue Jan 17 11:12:00 2023
13// Update Count     : 5
[a32b204]14//
[51b7345]15
[6b0b624]16#pragma once
[51b7345]17
[ea6332d]18#include <list>                   // for list
19
[f474e91]20#include "AST/Node.hpp"             // for ptr
[d76c588]21#include "AST/TypeEnvironment.hpp"  // for TypeEnvironment, AssertionSet, OpenVarSet
[ea6332d]22#include "Common/utility.h"       // for deleteAll
23#include "SynTree/Declaration.h"  // for TypeDecl, TypeDecl::Data
24#include "TypeEnvironment.h"      // for AssertionSet, OpenVarSet
[d76c588]25#include "WidenMode.h"              // for WidenMode
[ea6332d]26
27class Type;
28class TypeInstType;
29namespace SymTab {
[d76c588]30        class Indexer;
31}
32
33namespace ast {
34        class SymbolTable;
35        class Type;
36}
[51b7345]37
38namespace ResolvExpr {
[e563edf]39
40bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
41bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, Type *&commonType );
42bool unifyExact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
43bool unifyInexact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widen, const SymTab::Indexer &indexer, Type *&common );
44
45bool typesCompatible( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env );
46bool typesCompatibleIgnoreQualifiers( const Type *, const Type *, const SymTab::Indexer & indexer, const TypeEnvironment & env );
47
48inline bool typesCompatible( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) {
49        TypeEnvironment env;
50        return typesCompatible( t1, t2, indexer, env );
51}
52
53inline bool typesCompatibleIgnoreQualifiers( const Type * t1, const Type * t2, const SymTab::Indexer & indexer ) {
54        TypeEnvironment env;
55        return typesCompatibleIgnoreQualifiers( t1, t2, indexer, env );
56}
57
58bool unify(
59        const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
60        ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
[251ce80]61        ast::OpenVarSet & open );
[e563edf]62
63bool unify(
64        const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
65        ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
[251ce80]66        ast::OpenVarSet & open, ast::ptr<ast::Type> & common );
[e563edf]67
68bool unifyExact(
69        const ast::Type * type1, const ast::Type * type2, ast::TypeEnvironment & env,
70        ast::AssertionSet & need, ast::AssertionSet & have, const ast::OpenVarSet & open,
[251ce80]71        WidenMode widen );
[e563edf]72
73bool unifyInexact(
74        const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
75        ast::TypeEnvironment & env, ast::AssertionSet & need, ast::AssertionSet & have,
[251ce80]76        const ast::OpenVarSet & open, WidenMode widen, 
[e563edf]77        ast::ptr<ast::Type> & common );
78
79bool typesCompatible(
[251ce80]80        const ast::Type *, const ast::Type *, 
[e563edf]81        const ast::TypeEnvironment & env = {} );
82
83bool typesCompatibleIgnoreQualifiers(
[251ce80]84        const ast::Type *, const ast::Type *,
[e563edf]85        const ast::TypeEnvironment & env = {} );
[d76c588]86
[7b5694d]87/// Creates the type represented by the list of returnVals in a FunctionType.
88/// The caller owns the return value.
89Type * extractResultType( FunctionType * functionType );
90/// Creates or extracts the type represented by returns in a `FunctionType`.
91ast::ptr<ast::Type> extractResultType( const ast::FunctionType * func );
92
93std::vector<ast::ptr<ast::Type>> flattenList(
94        const std::vector<ast::ptr<ast::Type>> & src, ast::TypeEnvironment & env
95);
96
[51b7345]97} // namespace ResolvExpr
98
[a32b204]99// Local Variables: //
100// tab-width: 4 //
101// mode: c++ //
102// compile-command: "make install" //
103// End: //
Note: See TracBrowser for help on using the repository browser.