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 | // |
---|
7 | // Candidate.hpp -- |
---|
8 | // |
---|
9 | // Author : Aaron B. Moss |
---|
10 | // Created On : Wed Jun 5 14:30:00 2019 |
---|
11 | // Last Modified By : Aaron B. Moss |
---|
12 | // Last Modified On : Wed Jun 5 14:30:00 2019 |
---|
13 | // Update Count : 1 |
---|
14 | // |
---|
15 | |
---|
16 | #pragma once |
---|
17 | |
---|
18 | #include <iosfwd> |
---|
19 | #include <memory> // for shared_ptr |
---|
20 | #include <vector> |
---|
21 | |
---|
22 | #include "Cost.h" |
---|
23 | #include "AST/Node.hpp" |
---|
24 | #include "AST/TypeEnvironment.hpp" |
---|
25 | #include "Common/Indenter.h" |
---|
26 | |
---|
27 | namespace ast { |
---|
28 | class Expr; |
---|
29 | |
---|
30 | /// A list of unresolved assertions |
---|
31 | using AssertionList = std::vector<AssertionSet::value_type>; |
---|
32 | } |
---|
33 | |
---|
34 | namespace ResolvExpr { |
---|
35 | |
---|
36 | /// One option for resolution of an expression |
---|
37 | struct Candidate { |
---|
38 | ast::ptr<ast::Expr> expr; ///< Satisfying expression |
---|
39 | Cost cost; ///< Cost of the whole expression |
---|
40 | Cost cvtCost; ///< Cost of conversions to satisfying expression |
---|
41 | ast::TypeEnvironment env; ///< Containing type environment |
---|
42 | ast::OpenVarSet open; ///< Open variables for environment |
---|
43 | ast::AssertionList need; ///< Assertions which need to be resolved |
---|
44 | }; |
---|
45 | |
---|
46 | /// Shared reference to a candidate |
---|
47 | using CandidateRef = std::shared_ptr< Candidate >; |
---|
48 | |
---|
49 | /// List of candidates |
---|
50 | using CandidateList = std::vector< CandidateRef >; |
---|
51 | |
---|
52 | void print( std::ostream & os, const Candidate & cand, Indenter indent = {} ); |
---|
53 | |
---|
54 | void print( std::ostream & os, const CandidateList & cands, Indenter indent = {} ); |
---|
55 | |
---|
56 | } // namespace ResolvExpr |
---|
57 | |
---|
58 | // Local Variables: // |
---|
59 | // tab-width: 4 // |
---|
60 | // mode: c++ // |
---|
61 | // compile-command: "make install" // |
---|
62 | // End: // |
---|