My Project
Classes | Public Member Functions | List of all members
mlir::TypeConverter Class Reference

#include <DialectConversion.h>

Inheritance diagram for mlir::TypeConverter:
Inheritance graph
[legend]

Classes

class  SignatureConversion
 

Public Member Functions

virtual ~TypeConverter ()=default
 
virtual LogicalResult convertType (Type t, SmallVectorImpl< Type > &results)
 This hooks allows for converting a type. More...
 
virtual Type convertType (Type t)
 
LogicalResult convertTypes (ArrayRef< Type > types, SmallVectorImpl< Type > &results)
 
bool isLegal (Type type)
 
bool isSignatureLegal (FunctionType funcType)
 
virtual LogicalResult convertSignatureArg (unsigned inputNo, Type type, SignatureConversion &result)
 This hook allows for converting a specific argument of a signature. More...
 
Optional< SignatureConversionconvertBlockSignature (Block *block)
 
virtual OperationmaterializeConversion (PatternRewriter &rewriter, Type resultType, ArrayRef< Value > inputs, Location loc)
 

Detailed Description

Base class for type conversion interface. Specific converters must derive this class and implement the pure virtual functions.

Constructor & Destructor Documentation

◆ ~TypeConverter()

virtual mlir::TypeConverter::~TypeConverter ( )
virtualdefault

Member Function Documentation

◆ convertBlockSignature()

auto TypeConverter::convertBlockSignature ( Block block)

This function converts the type signature of the given block, by invoking 'convertSignatureArg' for each argument. This function should return a valid conversion for the signature on success, None otherwise.

◆ convertSignatureArg()

LogicalResult TypeConverter::convertSignatureArg ( unsigned  inputNo,
Type  type,
SignatureConversion result 
)
virtual

This hook allows for converting a specific argument of a signature.

This hook allows for converting a specific argument of a signature. It takes as inputs the original argument input number, type. On success, this function should populate 'result' with any new mappings.

◆ convertType() [1/2]

LogicalResult TypeConverter::convertType ( Type  t,
SmallVectorImpl< Type > &  results 
)
virtual

This hooks allows for converting a type.

This hook allows for converting a type. This function should return failure if no valid conversion exists, success otherwise. If the new set of types is empty, the type is removed and any usages of the existing value are expected to be removed during conversion.

◆ convertType() [2/2]

virtual Type mlir::TypeConverter::convertType ( Type  t)
inlinevirtual

This hook simplifies defining 1-1 type conversions. This function returns the type to convert to on success, and a null type on failure.

Reimplemented in mlir::LLVMTypeConverter, mlir::SPIRVTypeConverter, and mlir::LinalgTypeConverter.

◆ convertTypes()

LogicalResult TypeConverter::convertTypes ( ArrayRef< Type types,
SmallVectorImpl< Type > &  results 
)

Convert the given set of types, filling 'results' as necessary. This returns failure if the conversion of any of the types fails, success otherwise.

◆ isLegal()

bool TypeConverter::isLegal ( Type  type)

Return true if the given type is legal for this type converter, i.e. the type converts to itself.

◆ isSignatureLegal()

bool TypeConverter::isSignatureLegal ( FunctionType  funcType)

Return true if the inputs and outputs of the given function type are legal.

◆ materializeConversion()

virtual Operation* mlir::TypeConverter::materializeConversion ( PatternRewriter rewriter,
Type  resultType,
ArrayRef< Value inputs,
Location  loc 
)
inlinevirtual

This hook allows for materializing a conversion from a set of types into one result type by generating a cast operation of some kind. The generated operation should produce one result, of 'resultType', with the provided 'inputs' as operands. This hook must be overridden when a type conversion results in more than one type, or if a type conversion may persist after the conversion has finished.


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