source: src/GenPoly/FindFunction.h @ 6b1c4f2

ast-experimental
Last change on this file since 6b1c4f2 was c97b448, checked in by Andrew Beach <ajbeach@…>, 21 months ago

Added some box pass utilities that I believe are working and I don't want to look at all the time.

  • Property mode set to 100644
File size: 1.8 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// FindFunction.h --
8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
11// Last Modified By : Andrew Beach
12// Last Modified On : Fri Oct  7 10:30:00 2022
13// Update Count     : 3
14//
15
16#pragma once
17
18#include <list>       // for list
19
20#include "GenPoly.h"  // for TyVarMap
21
22class FunctionType;
23class Type;
24
25namespace GenPoly {
26        typedef bool (*FindFunctionPredicate)( FunctionType*, const TyVarMap& );
27
28        /// recursively walk `type`, placing all functions that match `predicate` under `tyVars` into `functions`
29        void findFunction( Type *type, std::list< FunctionType const * > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate );
30        /// like `findFunction`, but also replaces the function type with void ()(void)
31        void findAndReplaceFunction( Type *&type, std::list< FunctionType const * > &functions, const TyVarMap &tyVars, FindFunctionPredicate predicate );
32
33typedef bool (*FindFunctionPred)( const ast::FunctionType *, const TypeVarMap & );
34
35/// Recursively walks `type`, placing all functions that match `predicate`
36/// under `typeVars` into `functions`.
37void findFunction( const ast::Type * type,
38                std::vector<ast::ptr<ast::FunctionType>> & functions,
39                const TypeVarMap & typeVars, FindFunctionPred predicate );
40/// Like findFunction, but also replaces the function type with `void ()(void)`.
41const ast::Type * findAndReplaceFunction( const ast::Type * type,
42                std::vector<ast::ptr<ast::FunctionType>> & functions,
43                const TypeVarMap & typeVars, FindFunctionPred predicate );
44
45} // namespace GenPoly
46
47// Local Variables: //
48// tab-width: 4 //
49// mode: c++ //
50// compile-command: "make install" //
51// End: //
Note: See TracBrowser for help on using the repository browser.