source: src/ResolvExpr/Candidate.hpp@ d57e349

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 d57e349 was d57e349, checked in by Aaron Moss <a3moss@…>, 7 years ago

More resolver porting

  • Property mode set to 100644
File size: 1.9 KB
Line 
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
27namespace ast {
28 class Expr;
29
30 /// A list of unresolved assertions
31 using AssertionList = std::vector<AssertionSet::value_type>;
32}
33
34namespace ResolvExpr {
35
36/// One option for resolution of an expression
37struct 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 Candidate() = default;
46};
47
48/// Shared reference to a candidate
49using CandidateRef = std::shared_ptr< Candidate >;
50
51/// List of candidates
52using CandidateList = std::vector< CandidateRef >;
53
54/// Holdover behaviour from old `findMinCost` -- xxx -- can maybe be eliminated?
55static inline void promoteCvtCost( CandidateList & candidates ) {
56 for ( CandidateRef & r : candidates ) {
57 r->cost = r->cvtCost;
58 }
59}
60
61void print( std::ostream & os, const Candidate & cand, Indenter indent = {} );
62
63void print( std::ostream & os, const CandidateList & cands, Indenter indent = {} );
64
65} // namespace ResolvExpr
66
67// Local Variables: //
68// tab-width: 4 //
69// mode: c++ //
70// compile-command: "make install" //
71// End: //
Note: See TracBrowser for help on using the repository browser.