source: src/ResolvExpr/ConversionCost.h @ bff09c8

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since bff09c8 was 0c6596f, checked in by Rob Schluntz <rschlunt@…>, 7 years ago

Handle difference between reference casting and implicit conversion costs [fixes #39]

  • Property mode set to 100644
File size: 2.1 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// ConversionCost.h --
8//
9// Author           : Richard C. Bilson
10// Created On       : Sun May 17 09:37:28 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Sat Jul 22 09:38:24 2017
13// Update Count     : 4
14//
15
16#pragma once
17
18#include <functional>         // for function
19
20#include "Cost.h"             // for Cost
21#include "SynTree/Visitor.h"  // for Visitor
22#include "SynTree/SynTree.h"  // for Visitor Nodes
23
24namespace SymTab {
25        class Indexer;
26}  // namespace SymTab
27
28namespace ResolvExpr {
29        class TypeEnvironment;
30
31        class ConversionCost : public Visitor {
32          public:
33                ConversionCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env );
34
35                Cost get_cost() const { return cost; }
36
37                virtual void visit(VoidType *voidType);
38                virtual void visit(BasicType *basicType);
39                virtual void visit(PointerType *pointerType);
40                virtual void visit(ArrayType *arrayType);
41                virtual void visit(ReferenceType *refType);
42                virtual void visit(FunctionType *functionType);
43                virtual void visit(StructInstType *aggregateUseType);
44                virtual void visit(UnionInstType *aggregateUseType);
45                virtual void visit(EnumInstType *aggregateUseType);
46                virtual void visit(TraitInstType *aggregateUseType);
47                virtual void visit(TypeInstType *aggregateUseType);
48                virtual void visit(TupleType *tupleType);
49                virtual void visit(VarArgsType *varArgsType);
50                virtual void visit(ZeroType *zeroType);
51                virtual void visit(OneType *oneType);
52          protected:
53                Type *dest;
54                const SymTab::Indexer &indexer;
55                Cost cost;
56                const TypeEnvironment &env;
57        };
58
59        typedef std::function<int(Type *, Type *, const TypeEnvironment &, const SymTab::Indexer &)> PtrsFunction;
60        Cost convertToReferenceCost( Type * src, ReferenceType * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func );
61} // namespace ResolvExpr
62
63// Local Variables: //
64// tab-width: 4 //
65// mode: c++ //
66// compile-command: "make install" //
67// End: //
Note: See TracBrowser for help on using the repository browser.