Halide 22.0.0
Halide compiler and libraries
Loading...
Searching...
No Matches
IRVisitor.h
Go to the documentation of this file.
1#ifndef HALIDE_IR_VISITOR_H
2#define HALIDE_IR_VISITOR_H
3
4#include <set>
5
6#include "IR.h"
7
8/** \file
9 * Defines the base class for things that recursively walk over the IR
10 */
11
12namespace Halide {
13namespace Internal {
14
15/** A base class for algorithms that need to recursively walk over the
16 * IR. The default implementations just recursively walk over the
17 * children. Override the ones you care about.
18 */
19class IRVisitor {
20public:
21 IRVisitor() = default;
22 virtual ~IRVisitor() = default;
23
24protected:
25 // ExprNode<> and StmtNode<> are allowed to call visit (to implement accept())
26 template<typename T>
27 friend struct ExprNode;
28
29 template<typename T>
30 friend struct StmtNode;
31
32 virtual void visit(const IntImm *);
33 virtual void visit(const UIntImm *);
34 virtual void visit(const FloatImm *);
35 virtual void visit(const StringImm *);
36 virtual void visit(const Cast *);
37 virtual void visit(const Reinterpret *);
38 virtual void visit(const Add *);
39 virtual void visit(const Sub *);
40 virtual void visit(const Mul *);
41 virtual void visit(const Div *);
42 virtual void visit(const Mod *);
43 virtual void visit(const Min *);
44 virtual void visit(const Max *);
45 virtual void visit(const EQ *);
46 virtual void visit(const NE *);
47 virtual void visit(const LT *);
48 virtual void visit(const LE *);
49 virtual void visit(const GT *);
50 virtual void visit(const GE *);
51 virtual void visit(const And *);
52 virtual void visit(const Or *);
53 virtual void visit(const Not *);
54 virtual void visit(const Select *);
55 virtual void visit(const Load *);
56 virtual void visit(const Ramp *);
57 virtual void visit(const Broadcast *);
58 virtual void visit(const Let *);
59 virtual void visit(const LetStmt *);
60 virtual void visit(const AssertStmt *);
61 virtual void visit(const ProducerConsumer *);
62 virtual void visit(const Store *);
63 virtual void visit(const Provide *);
64 virtual void visit(const Allocate *);
65 virtual void visit(const Free *);
66 virtual void visit(const Realize *);
67 virtual void visit(const Block *);
68 virtual void visit(const Fork *);
69 virtual void visit(const IfThenElse *);
70 virtual void visit(const Evaluate *);
71 virtual void visit(const Call *);
72 virtual void visit(const Variable *);
73 virtual void visit(const For *);
74 virtual void visit(const Acquire *);
75 virtual void visit(const Shuffle *);
76 virtual void visit(const Prefetch *);
77 virtual void visit(const HoistedStorage *);
78 virtual void visit(const Atomic *);
79 virtual void visit(const VectorReduce *);
80};
81
82/** A lambda-based IR visitor that accepts multiple lambdas for different
83 * node types. */
84template<typename... Lambdas>
87 : handlers(std::move(lambdas)...) {
88 }
89
90 /** Public helper to call the base visitor from lambdas. */
91 template<typename T>
92 void visit_base(const T *op) {
94 }
95
96private:
97 LambdaOverloads<Lambdas...> handlers;
98
99 template<typename T>
100 auto visit_impl(const T *op) {
101 if constexpr (std::is_invocable_v<decltype(handlers), LambdaVisitor *, const T *>) {
102 return handlers(this, op);
103 } else {
104 return this->visit_base(op);
105 }
106 }
107
108protected:
109 void visit(const IntImm *op) override {
110 this->visit_impl(op);
111 }
112 void visit(const UIntImm *op) override {
113 this->visit_impl(op);
114 }
115 void visit(const FloatImm *op) override {
116 this->visit_impl(op);
117 }
118 void visit(const StringImm *op) override {
119 this->visit_impl(op);
120 }
121 void visit(const Cast *op) override {
122 this->visit_impl(op);
123 }
124 void visit(const Reinterpret *op) override {
125 this->visit_impl(op);
126 }
127 void visit(const Add *op) override {
128 this->visit_impl(op);
129 }
130 void visit(const Sub *op) override {
131 this->visit_impl(op);
132 }
133 void visit(const Mul *op) override {
134 this->visit_impl(op);
135 }
136 void visit(const Div *op) override {
137 this->visit_impl(op);
138 }
139 void visit(const Mod *op) override {
140 this->visit_impl(op);
141 }
142 void visit(const Min *op) override {
143 this->visit_impl(op);
144 }
145 void visit(const Max *op) override {
146 this->visit_impl(op);
147 }
148 void visit(const EQ *op) override {
149 this->visit_impl(op);
150 }
151 void visit(const NE *op) override {
152 this->visit_impl(op);
153 }
154 void visit(const LT *op) override {
155 this->visit_impl(op);
156 }
157 void visit(const LE *op) override {
158 this->visit_impl(op);
159 }
160 void visit(const GT *op) override {
161 this->visit_impl(op);
162 }
163 void visit(const GE *op) override {
164 this->visit_impl(op);
165 }
166 void visit(const And *op) override {
167 this->visit_impl(op);
168 }
169 void visit(const Or *op) override {
170 this->visit_impl(op);
171 }
172 void visit(const Not *op) override {
173 this->visit_impl(op);
174 }
175 void visit(const Select *op) override {
176 this->visit_impl(op);
177 }
178 void visit(const Load *op) override {
179 this->visit_impl(op);
180 }
181 void visit(const Ramp *op) override {
182 this->visit_impl(op);
183 }
184 void visit(const Broadcast *op) override {
185 this->visit_impl(op);
186 }
187 void visit(const Let *op) override {
188 this->visit_impl(op);
189 }
190 void visit(const LetStmt *op) override {
191 this->visit_impl(op);
192 }
193 void visit(const AssertStmt *op) override {
194 this->visit_impl(op);
195 }
196 void visit(const ProducerConsumer *op) override {
197 this->visit_impl(op);
198 }
199 void visit(const Store *op) override {
200 this->visit_impl(op);
201 }
202 void visit(const Provide *op) override {
203 this->visit_impl(op);
204 }
205 void visit(const Allocate *op) override {
206 this->visit_impl(op);
207 }
208 void visit(const Free *op) override {
209 this->visit_impl(op);
210 }
211 void visit(const Realize *op) override {
212 this->visit_impl(op);
213 }
214 void visit(const Block *op) override {
215 this->visit_impl(op);
216 }
217 void visit(const Fork *op) override {
218 this->visit_impl(op);
219 }
220 void visit(const IfThenElse *op) override {
221 this->visit_impl(op);
222 }
223 void visit(const Evaluate *op) override {
224 this->visit_impl(op);
225 }
226 void visit(const Call *op) override {
227 this->visit_impl(op);
228 }
229 void visit(const Variable *op) override {
230 this->visit_impl(op);
231 }
232 void visit(const For *op) override {
233 this->visit_impl(op);
234 }
235 void visit(const Acquire *op) override {
236 this->visit_impl(op);
237 }
238 void visit(const Shuffle *op) override {
239 this->visit_impl(op);
240 }
241 void visit(const Prefetch *op) override {
242 this->visit_impl(op);
243 }
244 void visit(const HoistedStorage *op) override {
245 this->visit_impl(op);
246 }
247 void visit(const Atomic *op) override {
248 this->visit_impl(op);
249 }
250 void visit(const VectorReduce *op) override {
251 this->visit_impl(op);
252 }
253};
254
255template<typename... Lambdas>
256void visit_with(const IRNode *ir, Lambdas &&...lambdas) {
257 LambdaVisitor visitor{std::forward<Lambdas>(lambdas)...};
258 constexpr bool all_take_two_args =
259 (std::is_invocable_v<Lambdas, decltype(&visitor), decltype(nullptr)> && ...);
260 static_assert(all_take_two_args);
261 ir->accept(&visitor);
262}
263
264template<typename... Lambdas>
266 visit_with(ir.get(), std::forward<Lambdas>(lambdas)...);
267}
268
269/** A base class for algorithms that walk recursively over the IR
270 * without visiting the same node twice. This is for passes that are
271 * capable of interpreting the IR as a DAG instead of a tree. */
272class IRGraphVisitor : public IRVisitor {
273protected:
274 /** By default these methods add the node to the visited set, and
275 * return whether or not it was already there. If it wasn't there,
276 * it delegates to the appropriate visit method. You can override
277 * them if you like. */
278 // @{
279 virtual void include(const Expr &);
280 virtual void include(const Stmt &);
281 // @}
282
283private:
284 /** The nodes visited so far. Only includes nodes with a ref count greater
285 * than one, because we know that nodes with a ref count of 1 will only be
286 * visited once if their parents are only visited once. */
287 std::set<const IRNode *> visited;
288
289protected:
290 /** These methods should call 'include' on the children to only
291 * visit them if they haven't been visited already. */
292 // @{
293 void visit(const IntImm *) override;
294 void visit(const UIntImm *) override;
295 void visit(const FloatImm *) override;
296 void visit(const StringImm *) override;
297 void visit(const Cast *) override;
298 void visit(const Reinterpret *) override;
299 void visit(const Add *) override;
300 void visit(const Sub *) override;
301 void visit(const Mul *) override;
302 void visit(const Div *) override;
303 void visit(const Mod *) override;
304 void visit(const Min *) override;
305 void visit(const Max *) override;
306 void visit(const EQ *) override;
307 void visit(const NE *) override;
308 void visit(const LT *) override;
309 void visit(const LE *) override;
310 void visit(const GT *) override;
311 void visit(const GE *) override;
312 void visit(const And *) override;
313 void visit(const Or *) override;
314 void visit(const Not *) override;
315 void visit(const Select *) override;
316 void visit(const Load *) override;
317 void visit(const Ramp *) override;
318 void visit(const Broadcast *) override;
319 void visit(const Let *) override;
320 void visit(const LetStmt *) override;
321 void visit(const AssertStmt *) override;
322 void visit(const ProducerConsumer *) override;
323 void visit(const Store *) override;
324 void visit(const Provide *) override;
325 void visit(const Allocate *) override;
326 void visit(const Free *) override;
327 void visit(const Realize *) override;
328 void visit(const Block *) override;
329 void visit(const Fork *) override;
330 void visit(const IfThenElse *) override;
331 void visit(const Evaluate *) override;
332 void visit(const Call *) override;
333 void visit(const Variable *) override;
334 void visit(const For *) override;
335 void visit(const Acquire *) override;
336 void visit(const Shuffle *) override;
337 void visit(const Prefetch *) override;
338 void visit(const HoistedStorage *) override;
339 void visit(const Atomic *) override;
340 void visit(const VectorReduce *) override;
341 // @}
342};
343
344/** A visitor/mutator capable of passing arbitrary arguments to the
345 * visit methods using CRTP and returning any types from them. All
346 * Expr visitors must have the same signature, and all Stmt visitors
347 * must have the same signature. Does not have default implementations
348 * of the visit methods. */
349template<typename T, typename ExprRet, typename StmtRet>
351private:
352 template<typename... Args>
353 ExprRet dispatch_expr(const BaseExprNode *node, Args &&...args) {
354 if (node == nullptr) {
355 return ExprRet{};
356 }
357 switch (node->node_type) {
359 return ((T *)this)->visit((const IntImm *)node, std::forward<Args>(args)...);
361 return ((T *)this)->visit((const UIntImm *)node, std::forward<Args>(args)...);
363 return ((T *)this)->visit((const FloatImm *)node, std::forward<Args>(args)...);
365 return ((T *)this)->visit((const StringImm *)node, std::forward<Args>(args)...);
367 return ((T *)this)->visit((const Broadcast *)node, std::forward<Args>(args)...);
368 case IRNodeType::Cast:
369 return ((T *)this)->visit((const Cast *)node, std::forward<Args>(args)...);
371 return ((T *)this)->visit((const Reinterpret *)node, std::forward<Args>(args)...);
373 return ((T *)this)->visit((const Variable *)node, std::forward<Args>(args)...);
374 case IRNodeType::Add:
375 return ((T *)this)->visit((const Add *)node, std::forward<Args>(args)...);
376 case IRNodeType::Sub:
377 return ((T *)this)->visit((const Sub *)node, std::forward<Args>(args)...);
378 case IRNodeType::Mod:
379 return ((T *)this)->visit((const Mod *)node, std::forward<Args>(args)...);
380 case IRNodeType::Mul:
381 return ((T *)this)->visit((const Mul *)node, std::forward<Args>(args)...);
382 case IRNodeType::Div:
383 return ((T *)this)->visit((const Div *)node, std::forward<Args>(args)...);
384 case IRNodeType::Min:
385 return ((T *)this)->visit((const Min *)node, std::forward<Args>(args)...);
386 case IRNodeType::Max:
387 return ((T *)this)->visit((const Max *)node, std::forward<Args>(args)...);
388 case IRNodeType::EQ:
389 return ((T *)this)->visit((const EQ *)node, std::forward<Args>(args)...);
390 case IRNodeType::NE:
391 return ((T *)this)->visit((const NE *)node, std::forward<Args>(args)...);
392 case IRNodeType::LT:
393 return ((T *)this)->visit((const LT *)node, std::forward<Args>(args)...);
394 case IRNodeType::LE:
395 return ((T *)this)->visit((const LE *)node, std::forward<Args>(args)...);
396 case IRNodeType::GT:
397 return ((T *)this)->visit((const GT *)node, std::forward<Args>(args)...);
398 case IRNodeType::GE:
399 return ((T *)this)->visit((const GE *)node, std::forward<Args>(args)...);
400 case IRNodeType::And:
401 return ((T *)this)->visit((const And *)node, std::forward<Args>(args)...);
402 case IRNodeType::Or:
403 return ((T *)this)->visit((const Or *)node, std::forward<Args>(args)...);
404 case IRNodeType::Not:
405 return ((T *)this)->visit((const Not *)node, std::forward<Args>(args)...);
407 return ((T *)this)->visit((const Select *)node, std::forward<Args>(args)...);
408 case IRNodeType::Load:
409 return ((T *)this)->visit((const Load *)node, std::forward<Args>(args)...);
410 case IRNodeType::Ramp:
411 return ((T *)this)->visit((const Ramp *)node, std::forward<Args>(args)...);
412 case IRNodeType::Call:
413 return ((T *)this)->visit((const Call *)node, std::forward<Args>(args)...);
414 case IRNodeType::Let:
415 return ((T *)this)->visit((const Let *)node, std::forward<Args>(args)...);
417 return ((T *)this)->visit((const Shuffle *)node, std::forward<Args>(args)...);
419 return ((T *)this)->visit((const VectorReduce *)node, std::forward<Args>(args)...);
420 // Explicitly list the Stmt types rather than using a
421 // default case so that when new IR nodes are added we
422 // don't miss them here.
426 case IRNodeType::For:
431 case IRNodeType::Free:
434 case IRNodeType::Fork:
440 internal_error << "Unreachable";
441 }
442 return ExprRet{};
443 }
444
445 template<typename... Args>
446 StmtRet dispatch_stmt(const BaseStmtNode *node, Args &&...args) {
447 if (node == nullptr) {
448 return StmtRet{};
449 }
450 switch (node->node_type) {
456 case IRNodeType::Cast:
459 case IRNodeType::Add:
460 case IRNodeType::Sub:
461 case IRNodeType::Mod:
462 case IRNodeType::Mul:
463 case IRNodeType::Div:
464 case IRNodeType::Min:
465 case IRNodeType::Max:
466 case IRNodeType::EQ:
467 case IRNodeType::NE:
468 case IRNodeType::LT:
469 case IRNodeType::LE:
470 case IRNodeType::GT:
471 case IRNodeType::GE:
472 case IRNodeType::And:
473 case IRNodeType::Or:
474 case IRNodeType::Not:
476 case IRNodeType::Load:
477 case IRNodeType::Ramp:
478 case IRNodeType::Call:
479 case IRNodeType::Let:
482 internal_error << "Unreachable";
483 break;
485 return ((T *)this)->visit((const LetStmt *)node, std::forward<Args>(args)...);
487 return ((T *)this)->visit((const AssertStmt *)node, std::forward<Args>(args)...);
489 return ((T *)this)->visit((const ProducerConsumer *)node, std::forward<Args>(args)...);
490 case IRNodeType::For:
491 return ((T *)this)->visit((const For *)node, std::forward<Args>(args)...);
493 return ((T *)this)->visit((const Acquire *)node, std::forward<Args>(args)...);
495 return ((T *)this)->visit((const Store *)node, std::forward<Args>(args)...);
497 return ((T *)this)->visit((const Provide *)node, std::forward<Args>(args)...);
499 return ((T *)this)->visit((const Allocate *)node, std::forward<Args>(args)...);
500 case IRNodeType::Free:
501 return ((T *)this)->visit((const Free *)node, std::forward<Args>(args)...);
503 return ((T *)this)->visit((const Realize *)node, std::forward<Args>(args)...);
505 return ((T *)this)->visit((const Block *)node, std::forward<Args>(args)...);
506 case IRNodeType::Fork:
507 return ((T *)this)->visit((const Fork *)node, std::forward<Args>(args)...);
509 return ((T *)this)->visit((const IfThenElse *)node, std::forward<Args>(args)...);
511 return ((T *)this)->visit((const Evaluate *)node, std::forward<Args>(args)...);
513 return ((T *)this)->visit((const Prefetch *)node, std::forward<Args>(args)...);
515 return ((T *)this)->visit((const Atomic *)node, std::forward<Args>(args)...);
517 return ((T *)this)->visit((const HoistedStorage *)node, std::forward<Args>(args)...);
518 }
519 return StmtRet{};
520 }
521
522public:
523 template<typename... Args>
525 return dispatch_stmt(s.get(), std::forward<Args>(args)...);
526 }
527
528 template<typename... Args>
530 return dispatch_stmt(s.get(), std::forward<Args>(args)...);
531 }
532
533 template<typename... Args>
535 return dispatch_expr(e.get(), std::forward<Args>(args)...);
536 }
537
538 template<typename... Args>
540 return dispatch_expr(e.get(), std::forward<Args>(args)...);
541 }
542};
543
544} // namespace Internal
545} // namespace Halide
546
547#endif
#define internal_error
Definition Error.h:229
#define HALIDE_ALWAYS_INLINE
Subtypes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
A base class for algorithms that walk recursively over the IR without visiting the same node twice.
Definition IRVisitor.h:272
void visit(const Div *) override
void visit(const Shuffle *) override
void visit(const NE *) override
void visit(const Block *) override
void visit(const EQ *) override
void visit(const Let *) override
void visit(const Provide *) override
void visit(const StringImm *) override
virtual void include(const Expr &)
By default these methods add the node to the visited set, and return whether or not it was already th...
void visit(const For *) override
void visit(const HoistedStorage *) override
void visit(const Ramp *) override
void visit(const Or *) override
void visit(const UIntImm *) override
void visit(const Mul *) override
void visit(const AssertStmt *) override
void visit(const GE *) override
void visit(const Min *) override
void visit(const Free *) override
void visit(const Add *) override
void visit(const Acquire *) override
void visit(const Store *) override
void visit(const Max *) override
void visit(const IntImm *) override
These methods should call 'include' on the children to only visit them if they haven't been visited a...
void visit(const IfThenElse *) override
void visit(const LT *) override
void visit(const VectorReduce *) override
void visit(const Atomic *) override
void visit(const Sub *) override
void visit(const Not *) override
void visit(const Mod *) override
void visit(const ProducerConsumer *) override
void visit(const LetStmt *) override
void visit(const LE *) override
void visit(const Allocate *) override
void visit(const Load *) override
virtual void include(const Stmt &)
void visit(const Realize *) override
void visit(const Prefetch *) override
void visit(const FloatImm *) override
void visit(const Fork *) override
void visit(const Call *) override
void visit(const Reinterpret *) override
void visit(const And *) override
void visit(const Variable *) override
void visit(const Evaluate *) override
void visit(const Broadcast *) override
void visit(const GT *) override
void visit(const Cast *) override
void visit(const Select *) override
A base class for algorithms that need to recursively walk over the IR.
Definition IRVisitor.h:19
virtual void visit(const NE *)
virtual void visit(const Mul *)
virtual void visit(const Max *)
virtual void visit(const Select *)
virtual void visit(const Load *)
virtual void visit(const Div *)
virtual void visit(const Fork *)
virtual void visit(const Sub *)
virtual void visit(const LE *)
virtual ~IRVisitor()=default
virtual void visit(const ProducerConsumer *)
virtual void visit(const VectorReduce *)
virtual void visit(const GE *)
virtual void visit(const StringImm *)
virtual void visit(const Allocate *)
virtual void visit(const IfThenElse *)
virtual void visit(const For *)
virtual void visit(const Prefetch *)
virtual void visit(const Block *)
virtual void visit(const UIntImm *)
virtual void visit(const HoistedStorage *)
virtual void visit(const FloatImm *)
virtual void visit(const GT *)
virtual void visit(const Mod *)
virtual void visit(const Acquire *)
virtual void visit(const Atomic *)
virtual void visit(const Ramp *)
virtual void visit(const Free *)
virtual void visit(const IntImm *)
virtual void visit(const Or *)
virtual void visit(const EQ *)
virtual void visit(const Broadcast *)
virtual void visit(const Call *)
virtual void visit(const Min *)
virtual void visit(const Variable *)
virtual void visit(const Realize *)
virtual void visit(const Add *)
virtual void visit(const Shuffle *)
virtual void visit(const Reinterpret *)
virtual void visit(const Evaluate *)
virtual void visit(const AssertStmt *)
virtual void visit(const And *)
virtual void visit(const LetStmt *)
virtual void visit(const Store *)
virtual void visit(const Provide *)
virtual void visit(const LT *)
virtual void visit(const Cast *)
virtual void visit(const Not *)
virtual void visit(const Let *)
A visitor/mutator capable of passing arbitrary arguments to the visit methods using CRTP and returnin...
Definition IRVisitor.h:350
HALIDE_ALWAYS_INLINE StmtRet dispatch(const Stmt &s, Args &&...args)
Definition IRVisitor.h:524
HALIDE_ALWAYS_INLINE ExprRet dispatch(Expr &&e, Args &&...args)
Definition IRVisitor.h:539
HALIDE_ALWAYS_INLINE StmtRet dispatch(Stmt &&s, Args &&...args)
Definition IRVisitor.h:529
HALIDE_ALWAYS_INLINE ExprRet dispatch(const Expr &e, Args &&...args)
Definition IRVisitor.h:534
void visit_with(const IRNode *ir, Lambdas &&...lambdas)
Definition IRVisitor.h:256
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
Internal::ConstantInterval cast(Type t, const Internal::ConstantInterval &a)
Cast operators for ConstantIntervals.
A fragment of Halide syntax.
Definition Expr.h:258
HALIDE_ALWAYS_INLINE const Internal::BaseExprNode * get() const
Override get() to return a BaseExprNode * instead of an IRNode *.
Definition Expr.h:321
The sum of two expressions.
Definition IR.h:66
Allocate a scratch area called with the given name, type, and size.
Definition IR.h:381
Logical and - are both expressions true.
Definition IR.h:185
If the 'condition' is false, then evaluate and return the message, which should be a call to an error...
Definition IR.h:304
Lock all the Store nodes in the body statement.
Definition IR.h:1008
A base class for expression nodes.
Definition Expr.h:143
A sequence of statements to be executed in-order.
Definition IR.h:452
A vector with 'lanes' elements, in which every element is 'value'.
Definition IR.h:269
A function call.
Definition IR.h:500
The actual IR nodes begin here.
Definition IR.h:40
The ratio of two expressions.
Definition IR.h:93
Is the first expression equal to the second.
Definition IR.h:131
Evaluate and discard an expression, presumably because it has some side-effect.
Definition IR.h:486
We use the "curiously recurring template pattern" to avoid duplicated code in the IR Nodes.
Definition Expr.h:158
Floating point constants.
Definition Expr.h:236
A for loop.
Definition IR.h:858
A pair of statements executed concurrently.
Definition IR.h:467
Free the resources associated with the given buffer.
Definition IR.h:423
Is the first expression greater than or equal to the second.
Definition IR.h:176
Is the first expression greater than the second.
Definition IR.h:167
Represents a location where storage will be hoisted to for a Func / Realize node with a given name.
Definition IR.h:992
IR nodes are passed around opaque handles to them.
Definition Expr.h:180
The abstract base classes for a node in the Halide IR.
Definition Expr.h:84
IRNodeType node_type
Each IR node subclass has a unique identifier.
Definition Expr.h:113
An if-then-else block.
Definition IR.h:476
Integer constants.
Definition Expr.h:218
Is the first expression less than or equal to the second.
Definition IR.h:158
Is the first expression less than the second.
Definition IR.h:149
A lambda-based IR visitor that accepts multiple lambdas for different node types.
Definition IRVisitor.h:85
void visit(const Atomic *op) override
Definition IRVisitor.h:247
void visit(const IntImm *op) override
Definition IRVisitor.h:109
void visit(const Mod *op) override
Definition IRVisitor.h:139
void visit(const HoistedStorage *op) override
Definition IRVisitor.h:244
void visit(const Min *op) override
Definition IRVisitor.h:142
void visit(const Max *op) override
Definition IRVisitor.h:145
void visit(const GE *op) override
Definition IRVisitor.h:163
void visit(const Variable *op) override
Definition IRVisitor.h:229
void visit(const Not *op) override
Definition IRVisitor.h:172
void visit(const Realize *op) override
Definition IRVisitor.h:211
void visit(const LT *op) override
Definition IRVisitor.h:154
void visit(const Reinterpret *op) override
Definition IRVisitor.h:124
void visit(const Prefetch *op) override
Definition IRVisitor.h:241
LambdaVisitor(Lambdas... lambdas)
Definition IRVisitor.h:86
void visit(const Fork *op) override
Definition IRVisitor.h:217
void visit(const Mul *op) override
Definition IRVisitor.h:133
void visit(const EQ *op) override
Definition IRVisitor.h:148
void visit(const Div *op) override
Definition IRVisitor.h:136
void visit(const Sub *op) override
Definition IRVisitor.h:130
void visit(const StringImm *op) override
Definition IRVisitor.h:118
void visit_base(const T *op)
Public helper to call the base visitor from lambdas.
Definition IRVisitor.h:92
void visit(const NE *op) override
Definition IRVisitor.h:151
void visit(const IfThenElse *op) override
Definition IRVisitor.h:220
void visit(const Provide *op) override
Definition IRVisitor.h:202
void visit(const Or *op) override
Definition IRVisitor.h:169
void visit(const LetStmt *op) override
Definition IRVisitor.h:190
void visit(const VectorReduce *op) override
Definition IRVisitor.h:250
void visit(const Free *op) override
Definition IRVisitor.h:208
void visit(const And *op) override
Definition IRVisitor.h:166
void visit(const Acquire *op) override
Definition IRVisitor.h:235
void visit(const Let *op) override
Definition IRVisitor.h:187
void visit(const For *op) override
Definition IRVisitor.h:232
void visit(const Allocate *op) override
Definition IRVisitor.h:205
void visit(const Shuffle *op) override
Definition IRVisitor.h:238
void visit(const ProducerConsumer *op) override
Definition IRVisitor.h:196
void visit(const LE *op) override
Definition IRVisitor.h:157
void visit(const Ramp *op) override
Definition IRVisitor.h:181
void visit(const Store *op) override
Definition IRVisitor.h:199
void visit(const Load *op) override
Definition IRVisitor.h:178
void visit(const AssertStmt *op) override
Definition IRVisitor.h:193
void visit(const GT *op) override
Definition IRVisitor.h:160
void visit(const FloatImm *op) override
Definition IRVisitor.h:115
void visit(const Evaluate *op) override
Definition IRVisitor.h:223
void visit(const Add *op) override
Definition IRVisitor.h:127
void visit(const Call *op) override
Definition IRVisitor.h:226
void visit(const Cast *op) override
Definition IRVisitor.h:121
void visit(const Select *op) override
Definition IRVisitor.h:175
void visit(const UIntImm *op) override
Definition IRVisitor.h:112
void visit(const Broadcast *op) override
Definition IRVisitor.h:184
void visit(const Block *op) override
Definition IRVisitor.h:214
A let expression, like you might find in a functional language.
Definition IR.h:281
The statement form of a let node.
Definition IR.h:292
Load a value from a named symbol if predicate is true.
Definition IR.h:227
The greater of two values.
Definition IR.h:122
The lesser of two values.
Definition IR.h:113
The remainder of a / b.
Definition IR.h:104
The product of two expressions.
Definition IR.h:84
Is the first expression not equal to the second.
Definition IR.h:140
Logical not - true if the expression false.
Definition IR.h:203
Logical or - is at least one of the expression true.
Definition IR.h:194
Represent a multi-dimensional region of a Func or an ImageParam that needs to be prefetched.
Definition IR.h:970
This node is a helpful annotation to do with permissions.
Definition IR.h:325
This defines the value of a function at a multi-dimensional location.
Definition IR.h:364
A linear ramp vector node.
Definition IR.h:257
Allocate a multi-dimensional buffer of the given type and size.
Definition IR.h:437
Reinterpret value as another type, without affecting any of the bits (on little-endian systems).
Definition IR.h:57
A ternary operator.
Definition IR.h:214
Construct a new vector by taking elements from another sequence of vectors.
Definition IR.h:898
A reference-counted handle to a statement node.
Definition Expr.h:427
Store a 'value' to the buffer called 'name' at a given 'index' if 'predicate' is true.
Definition IR.h:343
String constants.
Definition Expr.h:245
The difference of two expressions.
Definition IR.h:75
Unsigned integer constants.
Definition Expr.h:227
A named variable.
Definition IR.h:813
Horizontally reduce a vector to a scalar or narrower vector using the given commutative and associati...
Definition IR.h:1026