My Project
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
mlir::Type Class Reference

#include <Types.h>

Inheritance diagram for mlir::Type:
Inheritance graph
[legend]
Collaboration diagram for mlir::Type:
Collaboration graph
[legend]

Public Types

enum  Kind {
  Function, Opaque, LAST_BUILTIN_TYPE = Opaque, DEFINE_SYM_KIND_RANGE,
  DEFINE_SYM_KIND_RANGE
}
 
template<typename ConcreteType , typename BaseType , typename StorageType = DefaultTypeStorage>
using TypeBase = detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer >
 Utility class for implementing types. More...
 
using ImplType = TypeStorage
 

Public Member Functions

 Type ()
 
 Type (const ImplType *impl)
 
 Type (const Type &other)=default
 
Typeoperator= (const Type &other)=default
 
bool operator== (Type other) const
 
bool operator!= (Type other) const
 
 operator bool () const
 
bool operator! () const
 
template<typename U >
bool isa () const
 
template<typename U >
dyn_cast () const
 
template<typename U >
dyn_cast_or_null () const
 
template<typename U >
cast () const
 
unsigned getKind () const
 Return the classification for this type. More...
 
MLIRContextgetContext () const
 Return the LLVMContext in which this type was uniqued. More...
 
DialectgetDialect () const
 Get the dialect this type is registered to. More...
 
bool isIndex ()
 
bool isBF16 ()
 
bool isF16 ()
 
bool isF32 ()
 
bool isF64 ()
 
bool isInteger (unsigned width)
 Return true if this is an integer type with the specified width. More...
 
unsigned getIntOrFloatBitWidth ()
 
bool isIntOrIndex ()
 Return true if this is an integer or index type. More...
 
bool isIntOrIndexOrFloat ()
 Return true if this is an integer, index, or float type. More...
 
bool isIntOrFloat ()
 Return true of this is an integer or a float type. More...
 
void print (raw_ostream &os)
 Print the current type. More...
 
void dump ()
 
unsigned getSubclassData () const
 
void setSubclassData (unsigned val)
 
const void * getAsOpaquePointer () const
 Methods for supporting PointerLikeTypeTraits. More...
 

Static Public Member Functions

static bool classof (Type)
 
static Type getFromOpaquePointer (const void *pointer)
 

Protected Attributes

ImplTypeimpl
 

Friends

::llvm::hash_code hash_value (Type arg)
 

Detailed Description

Instances of the Type class are immutable and uniqued. They wrap a pointer to the storage object owned by MLIRContext. Therefore, instances of Type are passed around by value.

Some types are "primitives" meaning they do not have any parameters, for example the Index type. Parametric types have additional information that differentiates the types of the same kind between them, for example the Integer type has bitwidth, making i8 and i16 belong to the same kind by be different instances of the IntegerType.

Types are constructed and uniqued via the 'detail::TypeUniquer' class.

Derived type classes are expected to implement several required implementation hooks:

Type storage objects inherit from TypeStorage and contain the following:

Member Typedef Documentation

◆ ImplType

◆ TypeBase

template<typename ConcreteType , typename BaseType , typename StorageType = DefaultTypeStorage>
using mlir::Type::TypeBase = detail::StorageUserBase<ConcreteType, BaseType, StorageType, detail::TypeUniquer>

Utility class for implementing types.

Member Enumeration Documentation

◆ Kind

Integer identifier for all the concrete type kinds. Note: This is not an enum class as each dialect will likely define a separate enumeration for the specific types that they define. Not being an enum class also simplifies the handling of type kinds by not requiring casts for each use.

Enumerator
Function 
Opaque 
LAST_BUILTIN_TYPE 
DEFINE_SYM_KIND_RANGE 
DEFINE_SYM_KIND_RANGE 

Constructor & Destructor Documentation

◆ Type() [1/3]

mlir::Type::Type ( )
inline

◆ Type() [2/3]

mlir::Type::Type ( const ImplType impl)
inline

◆ Type() [3/3]

mlir::Type::Type ( const Type other)
default

Member Function Documentation

◆ cast()

template<typename U >
U mlir::Type::cast ( ) const

◆ classof()

static bool mlir::Type::classof ( Type  )
inlinestatic

◆ dump()

void Type::dump ( )

◆ dyn_cast()

template<typename U >
U mlir::Type::dyn_cast ( ) const

◆ dyn_cast_or_null()

template<typename U >
U mlir::Type::dyn_cast_or_null ( ) const

◆ getAsOpaquePointer()

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

Methods for supporting PointerLikeTypeTraits.

◆ getContext()

MLIRContext * Type::getContext ( ) const

Return the LLVMContext in which this type was uniqued.

◆ getDialect()

Dialect Type::getDialect ( ) const

Get the dialect this type is registered to.

◆ getFromOpaquePointer()

static Type mlir::Type::getFromOpaquePointer ( const void *  pointer)
inlinestatic

◆ getIntOrFloatBitWidth()

unsigned Type::getIntOrFloatBitWidth ( )

Return the bit width of an integer or a float type, assert failure on other types.

◆ getKind()

unsigned Type::getKind ( ) const

Return the classification for this type.

◆ getSubclassData()

unsigned Type::getSubclassData ( ) const

◆ isa()

template<typename U >
bool mlir::Type::isa ( ) const

◆ isBF16()

bool Type::isBF16 ( )

◆ isF16()

bool Type::isF16 ( )

◆ isF32()

bool Type::isF32 ( )

◆ isF64()

bool Type::isF64 ( )

◆ isIndex()

bool Type::isIndex ( )

◆ isInteger()

bool Type::isInteger ( unsigned  width)

Return true if this is an integer type with the specified width.

◆ isIntOrFloat()

bool Type::isIntOrFloat ( )

Return true of this is an integer or a float type.

◆ isIntOrIndex()

bool Type::isIntOrIndex ( )

Return true if this is an integer or index type.

◆ isIntOrIndexOrFloat()

bool Type::isIntOrIndexOrFloat ( )

Return true if this is an integer, index, or float type.

◆ operator bool()

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

◆ operator!()

bool mlir::Type::operator! ( ) const
inline

◆ operator!=()

bool mlir::Type::operator!= ( Type  other) const
inline

◆ operator=()

Type& mlir::Type::operator= ( const Type other)
default

◆ operator==()

bool mlir::Type::operator== ( Type  other) const
inline

◆ print()

void Type::print ( raw_ostream &  os)

Print the current type.

◆ setSubclassData()

void Type::setSubclassData ( unsigned  val)

Friends And Related Function Documentation

◆ hash_value

::llvm::hash_code hash_value ( Type  arg)
friend

Member Data Documentation

◆ impl

ImplType* mlir::Type::impl
protected

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