Halide
Halide::Internal::IRNode Struct Referenceabstract

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

#include <Expr.h>

Inherited by Halide::Internal::BaseExprNode, and Halide::Internal::BaseStmtNode.

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. More...
 
 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. More...
 
IRNodeType node_type
 Each IR node subclass has a unique identifier. More...
 

Detailed Description

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

Definition at line 82 of file Expr.h.

Constructor & Destructor Documentation

◆ IRNode()

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

Definition at line 89 of file Expr.h.

◆ ~IRNode()

virtual Halide::Internal::IRNode::~IRNode ( )
virtualdefault

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

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 99 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 111 of file Expr.h.

Referenced by Halide::Internal::IRHandle::as(), Halide::Internal::IRMatcher::WildConstInt< i >::match(), Halide::Internal::IRMatcher::WildConstUInt< i >::match(), Halide::Internal::IRMatcher::WildConstFloat< i >::match(), Halide::Internal::IRMatcher::WildConst< 3 >::match(), Halide::Internal::IRMatcher::Const::match(), and Halide::Internal::IRHandle::node_type().


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