source: src/ResolvExpr/ConversionCost.h @ babeeda

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 babeeda was bd0b6b62, checked in by Rob Schluntz <rschlunt@…>, 7 years ago

Convert ConversionCost? and CastCost? to PassVisitor?

  • Property mode set to 100644
File size: 2.3 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
22#include "Common/PassVisitor.h"
23#include "SynTree/Visitor.h"  // for Visitor
24#include "SynTree/SynTree.h"  // for Visitor Nodes
25
26namespace SymTab {
27        class Indexer;
28}  // namespace SymTab
29
30namespace ResolvExpr {
31        class TypeEnvironment;
32
33        typedef std::function<Cost(Type *, Type *, const SymTab::Indexer &, const TypeEnvironment &)> CostFunction;
34        struct ConversionCost : public WithShortCircuiting {
35          public:
36                ConversionCost( Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env, CostFunction );
37
38                Cost get_cost() const { return cost; }
39
40                void previsit( BaseSyntaxNode * ) { visit_children = false; }
41
42                void postvisit( VoidType * voidType );
43                void postvisit( BasicType * basicType );
44                void postvisit( PointerType * pointerType );
45                void postvisit( ArrayType * arrayType );
46                void postvisit( ReferenceType * refType );
47                void postvisit( FunctionType * functionType );
48                void postvisit( StructInstType * aggregateUseType );
49                void postvisit( UnionInstType * aggregateUseType );
50                void postvisit( EnumInstType * aggregateUseType );
51                void postvisit( TraitInstType * aggregateUseType );
52                void postvisit( TypeInstType * aggregateUseType );
53                void postvisit( TupleType * tupleType );
54                void postvisit( VarArgsType * varArgsType );
55                void postvisit( ZeroType * zeroType );
56                void postvisit( OneType * oneType );
57          protected:
58                Type *dest;
59                const SymTab::Indexer &indexer;
60                Cost cost;
61                const TypeEnvironment &env;
62                CostFunction costFunc;
63        };
64
65        typedef std::function<int(Type *, Type *, const SymTab::Indexer &, const TypeEnvironment &)> PtrsFunction;
66        Cost convertToReferenceCost( Type * src, ReferenceType * dest, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func );
67} // namespace ResolvExpr
68
69// Local Variables: //
70// tab-width: 4 //
71// mode: c++ //
72// compile-command: "make install" //
73// End: //
Note: See TracBrowser for help on using the repository browser.