source: src/ResolvExpr/Unify.h@ a935892

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since a935892 was d76c588, checked in by Aaron Moss <a3moss@…>, 7 years ago

Stubs for new resolver, implementation of new indexer, type environment

  • Property mode set to 100644
File size: 3.4 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
[d286cf68]11// Last Modified By : Aaron B. Moss
12// Last Modified On : Mon Jun 18 11:58:00 2018
13// Update Count : 4
[a32b204]14//
[51b73452]15
[6b0b624]16#pragma once
[51b73452]17
[ea6332d]18#include <list> // for list
19
[d76c588]20#include "AST/TypeEnvironment.hpp" // for TypeEnvironment, AssertionSet, OpenVarSet
[ea6332d]21#include "Common/utility.h" // for deleteAll
22#include "SynTree/Declaration.h" // for TypeDecl, TypeDecl::Data
23#include "TypeEnvironment.h" // for AssertionSet, OpenVarSet
[d76c588]24#include "WidenMode.h" // for WidenMode
[ea6332d]25
26class Type;
27class TypeInstType;
28namespace SymTab {
[d76c588]29 class Indexer;
30}
31
32namespace ast {
33 class SymbolTable;
34 class Type;
35}
[51b73452]36
37namespace ResolvExpr {
[a32b204]38 bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
39 bool unify( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, Type *&commonType );
40 bool unifyExact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer );
[d286cf68]41 bool unifyInexact( Type *type1, Type *type2, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, const OpenVarSet &openVars, WidenMode widenMode, const SymTab::Indexer &indexer, Type *&common );
[51b73452]42
[a32b204]43 template< typename Iterator1, typename Iterator2 >
44 bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer, std::list< Type* > &commonTypes ) {
45 for ( ; list1Begin != list1End && list2Begin != list2End; ++list1Begin, ++list2Begin ) {
46 Type *commonType = 0;
47 if ( ! unify( *list1Begin, *list2Begin, env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
48 return false;
49 } // if
50 commonTypes.push_back( commonType );
51 } // for
52 if ( list1Begin != list1End || list2Begin != list2End ) {
53 return false;
54 } else {
55 return true;
56 } // if
57 }
58
59 template< typename Iterator1, typename Iterator2 >
60 bool unifyList( Iterator1 list1Begin, Iterator1 list1End, Iterator2 list2Begin, Iterator2 list2End, TypeEnvironment &env, AssertionSet &needAssertions, AssertionSet &haveAssertions, OpenVarSet &openVars, const SymTab::Indexer &indexer ) {
61 std::list< Type* > commonTypes;
62 if ( unifyList( list1Begin, list1End, list2Begin, list2End, env, needAssertions, haveAssertions, openVars, indexer, commonTypes ) ) {
63 deleteAll( commonTypes );
64 return true;
65 } else {
66 return false;
67 } // if
68 }
[51b73452]69
[d76c588]70 bool unifyInexact(
71 const ast::Type * type1, const ast::Type * type2, ast::TypeEnvironment & env,
72 ast::AssertionSet & need, ast::AssertionSet & have, const ast::OpenVarSet & openVars,
73 WidenMode widenMode, const ast::SymbolTable & symtab, const ast::Type *& common );
74
[51b73452]75} // namespace ResolvExpr
76
[a32b204]77// Local Variables: //
78// tab-width: 4 //
79// mode: c++ //
80// compile-command: "make install" //
81// End: //
Note: See TracBrowser for help on using the repository browser.