MLIR  20.0.0git
Static Public Member Functions | List of all members
llvm::CastInfo< To, From, std::enable_if_t< std::is_same_v< mlir::Value, std::remove_const_t< From > >||std::is_base_of_v< mlir::Value, From > > > Struct Template Reference

Add support for llvm style casts. More...

#include "mlir/IR/Value.h"

+ Inheritance diagram for llvm::CastInfo< To, From, std::enable_if_t< std::is_same_v< mlir::Value, std::remove_const_t< From > >||std::is_base_of_v< mlir::Value, From > > >:

Static Public Member Functions

static bool isPossible (mlir::Value ty)
 Arguments are taken as mlir::Value here and not as From, because when casting from an intermediate type of the hierarchy to one of its children, the val.getKind() inside T::classof will use the static getKind() of the parent instead of the non-static ValueImpl::getKind() that returns the dynamic type. More...
 
static To doCast (mlir::Value value)
 

Detailed Description

template<typename To, typename From>
struct llvm::CastInfo< To, From, std::enable_if_t< std::is_same_v< mlir::Value, std::remove_const_t< From > >||std::is_base_of_v< mlir::Value, From > > >

Add support for llvm style casts.

We provide a cast between To and From if From is mlir::Value or derives from it.

Definition at line 597 of file Value.h.

Member Function Documentation

◆ doCast()

template<typename To , typename From >
static To llvm::CastInfo< To, From, std::enable_if_t< std::is_same_v< mlir::Value, std::remove_const_t< From > >||std::is_base_of_v< mlir::Value, From > > >::doCast ( mlir::Value  value)
inlinestatic

Definition at line 619 of file Value.h.

References mlir::Value::getImpl().

◆ isPossible()

template<typename To , typename From >
static bool llvm::CastInfo< To, From, std::enable_if_t< std::is_same_v< mlir::Value, std::remove_const_t< From > >||std::is_base_of_v< mlir::Value, From > > >::isPossible ( mlir::Value  ty)
inlinestatic

Arguments are taken as mlir::Value here and not as From, because when casting from an intermediate type of the hierarchy to one of its children, the val.getKind() inside T::classof will use the static getKind() of the parent instead of the non-static ValueImpl::getKind() that returns the dynamic type.

This means that T::classof would end up comparing the static Kind of the children to the static Kind of its parent, making it impossible to downcast from the parent to the child.

Return a constant true instead of a dynamic true when casting to self or up the hierarchy.

Definition at line 610 of file Value.h.


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