MLIR  18.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
mlir::PDLValue Class Reference

Storage type of byte-code interpreter values. More...

#include "mlir/IR/PatternMatch.h"

Public Types

enum class  Kind {
  Attribute , Operation , Type , TypeRange ,
  Value , ValueRange
}
 The underlying kind of a PDL value. More...
 

Public Member Functions

 PDLValue (const PDLValue &other)=default
 Construct a new PDL value. More...
 
 PDLValue (std::nullptr_t=nullptr)
 
 PDLValue (Attribute value)
 
 PDLValue (Operation *value)
 
 PDLValue (Type value)
 
 PDLValue (TypeRange *value)
 
 PDLValue (Value value)
 
 PDLValue (ValueRange *value)
 
template<typename T >
bool isa () const
 Returns true if the type of the held value is T. More...
 
template<typename T , typename ResultT = std::conditional_t< std::is_convertible<T, bool>::value, T, std::optional<T>>>
ResultT dyn_cast () const
 Attempt to dynamically cast this value to type T, returns null if this value is not an instance of T. More...
 
template<typename T >
cast () const
 Cast this value to type T, asserts if this value is not an instance of T. More...
 
const void * getAsOpaquePointer () const
 Get an opaque pointer to the value. More...
 
 operator bool () const
 Return if this value is null or not. More...
 
Kind getKind () const
 Return the kind of this value. More...
 
void print (raw_ostream &os) const
 Print this value to the provided output stream. More...
 

Static Public Member Functions

static void print (raw_ostream &os, Kind kind)
 Print the specified value kind to an output stream. More...
 

Detailed Description

Storage type of byte-code interpreter values.

These are passed to constraint functions as arguments.

Definition at line 747 of file PatternMatch.h.

Member Enumeration Documentation

◆ Kind

enum mlir::PDLValue::Kind
strong

The underlying kind of a PDL value.

Enumerator
Attribute 
Operation 
Type 
TypeRange 
Value 
ValueRange 

Definition at line 750 of file PatternMatch.h.

Constructor & Destructor Documentation

◆ PDLValue() [1/8]

mlir::PDLValue::PDLValue ( const PDLValue other)
default

Construct a new PDL value.

◆ PDLValue() [2/8]

mlir::PDLValue::PDLValue ( std::nullptr_t  = nullptr)
inline

Definition at line 754 of file PatternMatch.h.

◆ PDLValue() [3/8]

mlir::PDLValue::PDLValue ( Attribute  value)
inline

Definition at line 755 of file PatternMatch.h.

◆ PDLValue() [4/8]

mlir::PDLValue::PDLValue ( Operation value)
inline

Definition at line 757 of file PatternMatch.h.

◆ PDLValue() [5/8]

mlir::PDLValue::PDLValue ( Type  value)
inline

Definition at line 758 of file PatternMatch.h.

◆ PDLValue() [6/8]

mlir::PDLValue::PDLValue ( TypeRange value)
inline

Definition at line 759 of file PatternMatch.h.

◆ PDLValue() [7/8]

mlir::PDLValue::PDLValue ( Value  value)
inline

Definition at line 760 of file PatternMatch.h.

◆ PDLValue() [8/8]

mlir::PDLValue::PDLValue ( ValueRange value)
inline

Definition at line 762 of file PatternMatch.h.

Member Function Documentation

◆ cast()

template<typename T >
T mlir::PDLValue::cast ( ) const
inline

Cast this value to type T, asserts if this value is not an instance of T.

Definition at line 783 of file PatternMatch.h.

Referenced by mlir::detail::pdl_function_builder::ProcessBuiltinPDLValue< T >::processAsArg().

◆ dyn_cast()

template<typename T , typename ResultT = std::conditional_t< std::is_convertible<T, bool>::value, T, std::optional<T>>>
ResultT mlir::PDLValue::dyn_cast ( ) const
inline

Attempt to dynamically cast this value to type T, returns null if this value is not an instance of T.

Definition at line 776 of file PatternMatch.h.

◆ getAsOpaquePointer()

const void* mlir::PDLValue::getAsOpaquePointer ( ) const
inline

Get an opaque pointer to the value.

Definition at line 789 of file PatternMatch.h.

◆ getKind()

Kind mlir::PDLValue::getKind ( ) const
inline

Return the kind of this value.

Definition at line 795 of file PatternMatch.h.

◆ isa()

template<typename T >
bool mlir::PDLValue::isa ( ) const
inline

Returns true if the type of the held value is T.

Definition at line 766 of file PatternMatch.h.

◆ operator bool()

mlir::PDLValue::operator bool ( ) const
inlineexplicit

Return if this value is null or not.

Definition at line 792 of file PatternMatch.h.

◆ print() [1/2]

void PDLValue::print ( raw_ostream &  os) const

Print this value to the provided output stream.

Definition at line 104 of file PatternMatch.cpp.

References Attribute, Operation, Type, TypeRange, Value, and ValueRange.

Referenced by mlir::operator<<().

◆ print() [2/2]

void PDLValue::print ( raw_ostream &  os,
Kind  kind 
)
static

Print the specified value kind to an output stream.

Definition at line 131 of file PatternMatch.cpp.


The documentation for this class was generated from the following files: