MLIR  20.0.0git
Public Member Functions | List of all members
mlir::OneToNTypeMapping Class Reference

Stores a 1:N mapping of types and provides several useful accessors. More...

#include "mlir/Transforms/OneToNTypeConversion.h"

+ Inheritance diagram for mlir::OneToNTypeMapping:

Public Member Functions

 OneToNTypeMapping (TypeRange originalTypes)
 
TypeRange getConvertedTypes (unsigned originalTypeNo) const
 Returns the list of types that corresponds to the original type at the given index. More...
 
TypeRange getOriginalTypes () const
 Returns the list of original types. More...
 
ValueRange getConvertedValues (ValueRange convertedValues, unsigned originalValueNo) const
 Returns the slice of converted values that corresponds the original value at the given index. More...
 
void convertLocation (Value originalValue, unsigned originalValueNo, llvm::SmallVectorImpl< Location > &result) const
 Fills the given result vector with as many copies of the location of the original value as the number of values it is converted to. More...
 
void convertLocations (ValueRange originalValues, llvm::SmallVectorImpl< Location > &result) const
 Fills the given result vector with as many copies of the lociation of each original value as the number of values they are respectively converted to. More...
 
bool hasNonIdentityConversion () const
 Returns true iff at least one type conversion maps an input type to a type that is different from itself. More...
 
- Public Member Functions inherited from mlir::TypeConverter::SignatureConversion
 SignatureConversion (unsigned numOrigInputs)
 
ArrayRef< TypegetConvertedTypes () const
 Return the argument types for the new signature. More...
 
std::optional< InputMappinggetInputMapping (unsigned input) const
 Get the input mapping for the given argument. More...
 
void addInputs (unsigned origInputNo, ArrayRef< Type > types)
 Remap an input of the original signature with a new set of types. More...
 
void addInputs (ArrayRef< Type > types)
 Append new input types to the signature conversion, this should only be used if the new types are not intended to remap an existing input. More...
 
void remapInput (unsigned origInputNo, Value replacement)
 Remap an input of the original signature to another replacement value. More...
 

Detailed Description

Stores a 1:N mapping of types and provides several useful accessors.

This class extends SignatureConversion, which already supports 1:N type mappings but lacks some accessors into the mapping as well as access to the original types.

Definition at line 40 of file OneToNTypeConversion.h.

Constructor & Destructor Documentation

◆ OneToNTypeMapping()

mlir::OneToNTypeMapping::OneToNTypeMapping ( TypeRange  originalTypes)
inline

Definition at line 42 of file OneToNTypeConversion.h.

Member Function Documentation

◆ convertLocation()

void OneToNTypeMapping::convertLocation ( Value  originalValue,
unsigned  originalValueNo,
llvm::SmallVectorImpl< Location > &  result 
) const

Fills the given result vector with as many copies of the location of the original value as the number of values it is converted to.

Definition at line 35 of file OneToNTypeConversion.cpp.

References mlir::Value::getLoc().

◆ convertLocations()

void OneToNTypeMapping::convertLocations ( ValueRange  originalValues,
llvm::SmallVectorImpl< Location > &  result 
) const

Fills the given result vector with as many copies of the lociation of each original value as the number of values they are respectively converted to.

Definition at line 42 of file OneToNTypeConversion.cpp.

References mlir::detail::enumerate().

◆ getConvertedTypes()

TypeRange OneToNTypeMapping::getConvertedTypes ( unsigned  originalTypeNo) const

Returns the list of types that corresponds to the original type at the given index.

Definition at line 20 of file OneToNTypeConversion.cpp.

Referenced by buildUnrealizedBackwardsCasts(), buildUnrealizedForwardCasts(), ConvertTypesInSCFIfOp::matchAndRewrite(), ConvertTypesInSCFWhileOp::matchAndRewrite(), and mlir::OneToNPatternRewriter::replaceOp().

◆ getConvertedValues()

ValueRange OneToNTypeMapping::getConvertedValues ( ValueRange  convertedValues,
unsigned  originalValueNo 
) const

Returns the slice of converted values that corresponds the original value at the given index.

Definition at line 28 of file OneToNTypeConversion.cpp.

◆ getOriginalTypes()

TypeRange mlir::OneToNTypeMapping::getOriginalTypes ( ) const
inline

Returns the list of original types.

Definition at line 53 of file OneToNTypeConversion.h.

Referenced by buildUnrealizedBackwardsCasts(), and mlir::OneToNPatternRewriter::replaceOp().

◆ hasNonIdentityConversion()

bool OneToNTypeMapping::hasNonIdentityConversion ( ) const

Returns true iff at least one type conversion maps an input type to a type that is different from itself.

Definition at line 53 of file OneToNTypeConversion.cpp.

References mlir::detail::enumerate(), and isIdentityConversion().

Referenced by ConvertTypesInSCFForOp::matchAndRewrite(), ConvertTypesInSCFIfOp::matchAndRewrite(), and ConvertTypesInSCFWhileOp::matchAndRewrite().


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