Halide 22.0.0 Halide compiler and libraries

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Halide::Internal::IRNode Struct Referenceabstract

The abstract base classes for a node in the Halide IR. More...

`#include <Expr.h>`

Inheritance diagram for Halide::Internal::IRNode:

## Public Member Functions
virtual void | accept (IRVisitor *v) const =0
| We use the visitor pattern to traverse IR nodes throughout the compiler, so we have a virtual accept method which accepts visitors.
| IRNode (IRNodeType t)
virtual | ~IRNode ()=default

## Public Attributes
RefCount | ref_count
| These classes are all managed with intrusive reference counting, so we also track a reference count.
IRNodeType | node_type
| Each IR node subclass has a unique identifier.

## Detailed Description

The abstract base classes for a node in the Halide IR.

Definition at line 84 of file Expr.h.

## Constructor & Destructor Documentation

## ◆ IRNode()

Halide::Internal::IRNode::IRNode | ( | IRNodeType | t | ) |
| inline

Definition at line 91 of file Expr.h.

## ◆ ~IRNode()

virtual Halide::Internal::IRNode::~IRNode | ( |  | ) |
| virtual default

## Member Function Documentation

## ◆ accept()

virtual void Halide::Internal::IRNode::accept | ( | IRVisitor * | v | ) | const
| pure virtual

We use the visitor pattern to traverse IR nodes throughout the compiler, so we have a virtual accept method which accepts visitors.

Implemented in Halide::Internal::ExprNode< Add >, Halide::Internal::ExprNode< And >, Halide::Internal::ExprNode< Broadcast >, Halide::Internal::ExprNode< Call >, Halide::Internal::ExprNode< Cast >, Halide::Internal::ExprNode< Div >, Halide::Internal::ExprNode< EQ >, Halide::Internal::ExprNode< FloatImm >, Halide::Internal::ExprNode< GE >, Halide::Internal::ExprNode< GT >, Halide::Internal::ExprNode< IntImm >, Halide::Internal::ExprNode< LE >, Halide::Internal::ExprNode< Let >, Halide::Internal::ExprNode< Load >, Halide::Internal::ExprNode< LT >, Halide::Internal::ExprNode< Max >, Halide::Internal::ExprNode< Min >, Halide::Internal::ExprNode< Mod >, Halide::Internal::ExprNode< Mul >, Halide::Internal::ExprNode< NE >, Halide::Internal::ExprNode< Not >, Halide::Internal::ExprNode< Or >, Halide::Internal::ExprNode< Ramp >, Halide::Internal::ExprNode< Reinterpret >, Halide::Internal::ExprNode< Select >, Halide::Internal::ExprNode< Shuffle >, Halide::Internal::ExprNode< StringImm >, Halide::Internal::ExprNode< Sub >, Halide::Internal::ExprNode< UIntImm >, Halide::Internal::ExprNode< Variable >, Halide::Internal::ExprNode< VectorReduce >, Halide::Internal::ExprNode< T >, Halide::Internal::StmtNode< T >, Halide::Internal::StmtNode< Acquire >, Halide::Internal::StmtNode< Allocate >, Halide::Internal::StmtNode< AssertStmt >, Halide::Internal::StmtNode< Atomic >, Halide::Internal::StmtNode< Block >, Halide::Internal::StmtNode< Evaluate >, Halide::Internal::StmtNode< For >, Halide::Internal::StmtNode< Fork >, Halide::Internal::StmtNode< Free >, Halide::Internal::StmtNode< HoistedStorage >, Halide::Internal::StmtNode< IfThenElse >, Halide::Internal::StmtNode< LetStmt >, Halide::Internal::StmtNode< Prefetch >, Halide::Internal::StmtNode< ProducerConsumer >, Halide::Internal::StmtNode< Provide >, Halide::Internal::StmtNode< Realize >, and Halide::Internal::StmtNode< Store >.

Referenced by Halide::Internal::IRHandle::accept().

## Member Data Documentation

## ◆ ref_count

RefCount Halide::Internal::IRNode::ref_count
| mutable

These classes are all managed with intrusive reference counting, so we also track a reference count.

It's mutable so that we can do reference counting even through const references to IR nodes.

Definition at line 101 of file Expr.h.

## ◆ node_type

IRNodeType Halide::Internal::IRNode::node_type

Each IR node subclass has a unique identifier.

We can compare these values to do runtime type identification. We don't compile with rtti because that injects run-time type identification stuff everywhere (and often breaks when linking external libraries compiled without it), and we only want it for IR nodes. One might want to put this value in the vtable, but that adds another level of indirection, and for Exprs we have 32 free bits in between the ref count and the Type anyway, so this doesn't increase the memory footprint of an IR node.

Definition at line 113 of file Expr.h.

Referenced by Halide::Internal::IRHandle::as(), Halide::Internal::equal(), Halide::Internal::graph_equal(), Halide::Internal::graph_less_than(), Halide::Internal::less_than(), Halide::Internal::IRMatcher::WildConstInt< i >::match(), Halide::Internal::IRMatcher::WildConstUInt< i >::match(), Halide::Internal::IRMatcher::WildConstFloat< i >::match(), Halide::Internal::IRMatcher::WildConst< i >::match(), Halide::Internal::IRMatcher::IntLiteral::match(), Halide::Internal::IRMatcher::SimplifiedNegateOp< i >::match(), and Halide::Internal::IRHandle::node_type().

The documentation for this struct was generated from the following file:

- src/Expr.h