Halide 19.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
FindCalls.h
Go to the documentation of this file.
1#ifndef FIND_CALLS_H
2#define FIND_CALLS_H
3
4/** \file
5 *
6 * Defines analyses to extract the functions called a function.
7 */
8
9#include <map>
10#include <string>
11#include <vector>
12
13#include "Expr.h"
14
15namespace Halide {
16namespace Internal {
17
18class Function;
19
20/** Construct a map from name to Function definition object for all Halide
21 * functions called directly in the definition of the Function f, including
22 * in update definitions, update index expressions, and RDom extents. This map
23 * _does not_ include the Function f, unless it is called recursively by
24 * itself.
25 */
26std::map<std::string, Function> find_direct_calls(const Function &f);
27
28/** Construct a map from name to Function definition object for all Halide
29 * functions called directly in the definition of the Function f, or
30 * indirectly in those functions' definitions, recursively. This map always
31 * _includes_ the Function f.
32 */
33std::map<std::string, Function> find_transitive_calls(const Function &f);
34
35/** Find all Functions transitively referenced by any Function in `funcs` and return
36 * a map of them. */
37std::map<std::string, Function> build_environment(const std::vector<Function> &funcs);
38
39/** Returns the same Functions as build_environment, but returns a vector of
40 * Functions instead, where the order is the order in which the Functions were
41 * first encountered. This is stable to changes in the names of the Functions. */
42std::vector<Function> called_funcs_in_order_found(const std::vector<Function> &funcs);
43
44} // namespace Internal
45} // namespace Halide
46
47#endif
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
A reference-counted handle to Halide's internal representation of a function.
Definition Function.h:39
std::map< std::string, Function > find_transitive_calls(const Function &f)
Construct a map from name to Function definition object for all Halide functions called directly in t...
std::map< std::string, Function > build_environment(const std::vector< Function > &funcs)
Find all Functions transitively referenced by any Function in funcs and return a map of them.
std::vector< Function > called_funcs_in_order_found(const std::vector< Function > &funcs)
Returns the same Functions as build_environment, but returns a vector of Functions instead,...
std::map< std::string, Function > find_direct_calls(const Function &f)
Construct a map from name to Function definition object for all Halide functions called directly in t...
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.