Halide 22.0.0 Halide compiler and libraries

Public Member Functions | List of all members
Halide::Expr Struct Reference

A fragment of Halide syntax. More...

`#include <Expr.h>`

Inheritance diagram for Halide::Expr:

## Public Member Functions
HALIDE_ALWAYS_INLINE | Expr ()=default
| Make an undefined expression. More...
HALIDE_ALWAYS_INLINE | Expr (const Internal::BaseExprNode *n)
| Make an expression from a concrete expression node pointer (e.g. More...
| Expr (int8_t x)
| Make an expression representing numeric constants of various types. More...
| Expr (int16_t x)
| Expr (int32_t x)
| Expr (int64_t x)
| Expr (uint8_t x)
| Expr (uint16_t x)
| Expr (uint32_t x)
| Expr (uint64_t x)
| Expr (float16_t x)
| Expr (bfloat16_t x)
| Expr (float x)
| Expr (double x)
| Expr (const std::string &s)
| Make an expression representing a const string (i.e. More...
HALIDE_ALWAYS_INLINE const Internal::BaseExprNode * | get () const
| Override get() to return a BaseExprNode * instead of an IRNode *. More...
HALIDE_ALWAYS_INLINE Type | type () const
| Get the type of this expression node. More...
Public Member Functions inherited from Halide::Internal::IRHandle
HALIDE_ALWAYS_INLINE | IRHandle ()=default
HALIDE_ALWAYS_INLINE | IRHandle (const IRNode *p)
void | accept (IRVisitor *v) const
| Dispatch to the correct visitor method for this node. More...
template<typename T >
const T * | as () const
| Downcast this ir node to its actual type (e.g. More...
IRNodeType | node_type () const
Public Member Functions inherited from Halide::Internal::IntrusivePtr< const IRNode >
const IRNode * | get () const
| Access the raw pointer in a variety of ways. More...
const IRNode & | operator* () const
const IRNode * | operator-> () const
| ~IntrusivePtr ()
HALIDE_ALWAYS_INLINE | IntrusivePtr ()=default
HALIDE_ALWAYS_INLINE | IntrusivePtr (const IRNode *p)
HALIDE_ALWAYS_INLINE | IntrusivePtr (const IntrusivePtr< const IRNode > &other) noexcept
HALIDE_ALWAYS_INLINE | IntrusivePtr (IntrusivePtr< const IRNode > &&other) noexcept
IntrusivePtr< const IRNode > & | operator= (const IntrusivePtr< const IRNode > &other)
IntrusivePtr< const IRNode > & | operator= (IntrusivePtr< const IRNode > &&other) noexcept
HALIDE_ALWAYS_INLINE bool | defined () const
HALIDE_ALWAYS_INLINE bool | same_as (const IntrusivePtr &other) const
HALIDE_ALWAYS_INLINE bool | operator< (const IntrusivePtr< const IRNode > &other) const
HALIDE_ALWAYS_INLINE bool | is_sole_reference () const

## Additional Inherited Members
Protected Attributes inherited from Halide::Internal::IntrusivePtr< const IRNode >
const IRNode * | ptr

## Detailed Description

A fragment of Halide syntax.

It's implemented as reference-counted handle to a concrete expression node, but it's immutable, so you can treat it as a value type.

Examples
  tutorial/lesson_01_basics.cpp, and tutorial/lesson_02_input_image.cpp.

Definition at line 258 of file Expr.h.

## Constructor & Destructor Documentation

## ◆ Expr() [1/15]

HALIDE_ALWAYS_INLINE Halide::Expr::Expr | ( |  | ) |
| default

Make an undefined expression.

## ◆ Expr() [2/15]

HALIDE_ALWAYS_INLINE Halide::Expr::Expr | ( | const Internal::BaseExprNode * | n | ) |
| inline

Make an expression from a concrete expression node pointer (e.g.

Add)

Definition at line 265 of file Expr.h.

## ◆ Expr() [3/15]

Halide::Expr::Expr | ( | int8_t | x | ) |
| inlineexplicit

Make an expression representing numeric constants of various types.

Definition at line 271 of file Expr.h.

References Halide::Internal.

## ◆ Expr() [4/15]

Halide::Expr::Expr | ( | int16_t | x | ) |
| inlineexplicit

Definition at line 274 of file Expr.h.

References Halide::Internal.

## ◆ Expr() [5/15]

Halide::Expr::Expr | ( | int32_t | x | ) |
| inline

Definition at line 277 of file Expr.h.

References Halide::Internal.

## ◆ Expr() [6/15]

Halide::Expr::Expr | ( | int64_t | x | ) |
| inlineexplicit

Definition at line 280 of file Expr.h.

References Halide::Internal.

## ◆ Expr() [7/15]

Halide::Expr::Expr | ( | uint8_t | x | ) |
| inlineexplicit

Definition at line 283 of file Expr.h.

References Halide::Internal.

## ◆ Expr() [8/15]

Halide::Expr::Expr | ( | uint16_t | x | ) |
| inlineexplicit

Definition at line 286 of file Expr.h.

References Halide::Internal.

## ◆ Expr() [9/15]

Halide::Expr::Expr | ( | uint32_t | x | ) |
| inlineexplicit

Definition at line 289 of file Expr.h.

References Halide::Internal.

## ◆ Expr() [10/15]

Halide::Expr::Expr | ( | uint64_t | x | ) |
| inlineexplicit

Definition at line 292 of file Expr.h.

References Halide::Internal.

## ◆ Expr() [11/15]

Halide::Expr::Expr | ( | float16_t | x | ) |
| inline

Definition at line 295 of file Expr.h.

References Halide::Internal.

## ◆ Expr() [12/15]

Halide::Expr::Expr | ( | bfloat16_t | x | ) |
| inline

Definition at line 298 of file Expr.h.

References Halide::Internal.

## ◆ Expr() [13/15]

Halide::Expr::Expr | ( | float | x | ) |
| inline

Definition at line 306 of file Expr.h.

References Halide::Internal.

## ◆ Expr() [14/15]

Halide::Expr::Expr | ( | double | x | ) |
| inlineexplicit

Definition at line 309 of file Expr.h.

References Halide::Internal.

## ◆ Expr() [15/15]

Halide::Expr::Expr | ( | const std::string & | s | ) |
| inline

Make an expression representing a const string (i.e.

a StringImm)

Definition at line 315 of file Expr.h.

References Halide::Internal.

## Member Function Documentation

## ◆ get()

HALIDE_ALWAYS_INLINE const Internal::BaseExprNode * Halide::Expr::get | ( |  | ) | const
| inline

Override get() to return a BaseExprNode * instead of an IRNode *.

Definition at line 321 of file Expr.h.

References Halide::Internal::IntrusivePtr< const IRNode >::ptr.

Referenced by Halide::Internal::VariadicVisitor< T, ExprRet, StmtRet >::dispatch(), Halide::Internal::IRMatcher::NotOp< A >::match(), Halide::Internal::IRMatcher::SimplifiedNegateOp< i >::match(), Halide::Internal::IRMatcher::SelectOp< C, T, F >::match(), Halide::Internal::IRMatcher::BroadcastOp< A, B >::match(), Halide::Internal::IRMatcher::RampOp< A, B, C >::match(), Halide::Internal::IRMatcher::VectorReduceOp< A, B, reduce_op >::match(), Halide::Internal::IRMatcher::NegateOp< A >::match(), Halide::Internal::IRMatcher::CastOp< A >::match(), Halide::Internal::IRMatcher::WidenOp< A >::match(), Halide::ExprCompare::operator()(), Halide::Internal::IRMatcher::pattern_arg(), and type().

## ◆ type()

HALIDE_ALWAYS_INLINE Type Halide::Expr::type | ( |  | ) | const
| inline

Get the type of this expression node.

Definition at line 327 of file Expr.h.

References get(), and Halide::Internal::BaseExprNode::type.

Referenced by Halide::ConciseCasts::bf16(), Halide::Internal::equal(), Halide::evaluate(), Halide::evaluate_may_gpu(), Halide::ConciseCasts::f16(), Halide::ConciseCasts::f32(), Halide::ConciseCasts::f64(), Halide::ConciseCasts::i16(), Halide::ConciseCasts::i16_sat(), Halide::ConciseCasts::i32(), Halide::ConciseCasts::i32_sat(), Halide::ConciseCasts::i64(), Halide::ConciseCasts::i64_sat(), Halide::ConciseCasts::i8(), Halide::ConciseCasts::i8_sat(), Halide::Internal::HexagonAlignmentAnalyzer::is_aligned(), Halide::Internal::HexagonAlignmentAnalyzer::is_aligned_impl(), Halide::Internal::Cast::is_reinterpret(), Halide::Internal::IRMatcher::CmpOp< Op, A, B >::make(), Halide::Internal::IRMatcher::NegateOp< A >::make(), Halide::Internal::IRMatcher::WidenOp< A >::make(), Halide::Internal::IRMatcher::BinOp< Op, A, B >::make(), Halide::Internal::IRMatcher::CanProve< A, Prover >::make_folded_const(), Halide::Internal::IRMatcher::WidenOp< A >::match(), Halide::Param< T >::set_max_value(), Halide::Param< T >::set_min_value(), Halide::Internal::GeneratorInput_DynamicScalar< T >::type(), Halide::Internal::GeneratorInput_Scalar< T >::type(), Halide::ConciseCasts::u16(), Halide::ConciseCasts::u16_sat(), Halide::ConciseCasts::u32(), Halide::ConciseCasts::u32_sat(), Halide::ConciseCasts::u64(), Halide::ConciseCasts::u64_sat(), Halide::ConciseCasts::u8(), and Halide::ConciseCasts::u8_sat().

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

- src/Expr.h