Halide  12.0.1
Halide compiler and libraries
ExternFuncArgument.h
Go to the documentation of this file.
1 #ifndef HALIDE_EXTERNFUNCARGUMENT_H
2 #define HALIDE_EXTERNFUNCARGUMENT_H
3 
4 /** \file
5  * Defines the internal representation of a halide ExternFuncArgument
6  */
7 
8 #include "Buffer.h"
9 #include "Expr.h"
10 #include "FunctionPtr.h"
11 #include "Parameter.h"
12 
13 namespace Halide {
14 
15 /** An argument to an extern-defined Func. May be a Function, Buffer,
16  * ImageParam or Expr. */
18  enum ArgType { UndefinedArg = 0,
28 
30  : arg_type(FuncArg), func(std::move(f)) {
31  }
32 
33  template<typename T>
35  : arg_type(BufferArg), buffer(b) {
36  }
38  : arg_type(ExprArg), expr(std::move(e)) {
39  }
41  : arg_type(ExprArg), expr(e) {
42  }
44  : arg_type(ExprArg), expr(e) {
45  }
46 
49  // Scalar params come in via the Expr constructor.
51  }
52  ExternFuncArgument() = default;
53 
54  bool is_func() const {
55  return arg_type == FuncArg;
56  }
57  bool is_expr() const {
58  return arg_type == ExprArg;
59  }
60  bool is_buffer() const {
61  return arg_type == BufferArg;
62  }
63  bool is_image_param() const {
64  return arg_type == ImageParamArg;
65  }
66  bool defined() const {
67  return arg_type != UndefinedArg;
68  }
69 };
70 
71 } // namespace Halide
72 
73 #endif // HALIDE_EXTERNFUNCARGUMENT_H
#define internal_assert(c)
Definition: Errors.h:19
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
Defines the internal representation of parameters to halide piplines.
A Halide::Buffer is a named shared reference to a Halide::Runtime::Buffer.
Definition: Buffer.h:115
A reference-counted handle to a parameter to a halide pipeline.
Definition: Parameter.h:29
bool is_buffer() const
Does this parameter refer to a buffer/image?
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
A fragment of Halide syntax.
Definition: Expr.h:256
An argument to an extern-defined Func.
ExternFuncArgument(Internal::FunctionPtr f)
Internal::Parameter image_param
ExternFuncArgument(const Internal::Parameter &p)
Internal::FunctionPtr func
A possibly-weak pointer to a Halide function.
Definition: FunctionPtr.h:27