MLIR
22.0.0git
|
Conversion from types to the LLVM IR dialect. More...
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
Public Member Functions | |
LLVMTypeConverter (MLIRContext *ctx, const DataLayoutAnalysis *analysis=nullptr) | |
Create an LLVMTypeConverter using the default LowerToLLVMOptions. More... | |
LLVMTypeConverter (MLIRContext *ctx, const LowerToLLVMOptions &options, const DataLayoutAnalysis *analysis=nullptr) | |
Create an LLVMTypeConverter using custom LowerToLLVMOptions. More... | |
Type | convertFunctionSignature (FunctionType funcTy, bool isVariadic, bool useBarePtrCallConv, SignatureConversion &result) const |
Convert a function type. More... | |
Type | convertFunctionSignature (FunctionOpInterface funcOp, bool isVariadic, bool useBarePtrCallConv, LLVMTypeConverter::SignatureConversion &result, SmallVectorImpl< std::optional< NamedAttribute >> &byValRefNonPtrAttrs) const |
Convert a function type. More... | |
Type | packFunctionResults (TypeRange types, bool useBarePointerCallConv=false, SmallVector< SmallVector< Type >> *groupedTypes=nullptr, int64_t *numConvertedTypes=nullptr) const |
Convert a non-empty list of types to be returned from a function into an LLVM-compatible type. More... | |
Type | packOperationResults (TypeRange types) const |
Convert a non-empty list of types of values produced by an operation into an LLVM-compatible type. More... | |
LogicalResult | convertCallingConventionType (Type type, SmallVectorImpl< Type > &result, bool useBarePointerCallConv=false) const |
Convert a type in the context of the default or bare pointer calling convention. More... | |
MLIRContext & | getContext () const |
Returns the MLIR context. More... | |
LLVM::LLVMDialect * | getDialect () const |
Returns the LLVM dialect. More... | |
const LowerToLLVMOptions & | getOptions () const |
SmallVector< Value, 4 > | promoteOperands (Location loc, ValueRange opOperands, ArrayRef< ValueRange > adaptorOperands, OpBuilder &builder, bool useBarePtrCallConv=false) const |
Promote the LLVM representation of all operands including promoting MemRef descriptors to stack and use pointers to struct to avoid the complexity of the platform-specific C/C++ ABI lowering related to struct argument passing. More... | |
SmallVector< Value, 4 > | promoteOperands (Location loc, ValueRange opOperands, ValueRange adaptorOperands, OpBuilder &builder, bool useBarePtrCallConv=false) const |
Value | promoteOneMemRefDescriptor (Location loc, Value operand, OpBuilder &builder) const |
Promote the LLVM struct representation of one MemRef descriptor to stack and use pointer to struct to avoid the complexity of the platform-specific C/C++ ABI lowering related to struct argument passing. More... | |
std::pair< LLVM::LLVMFunctionType, LLVM::LLVMStructType > | convertFunctionTypeCWrapper (FunctionType type) const |
Converts the function type to a C-compatible format, in particular using pointers to memref descriptors for arguments. More... | |
const llvm::DataLayout & | getDataLayout () const |
Returns the data layout to use during and after conversion. More... | |
const DataLayoutAnalysis * | getDataLayoutAnalysis () const |
Returns the data layout analysis to query during conversion. More... | |
Type | getIndexType () const |
Gets the LLVM representation of the index type. More... | |
unsigned | getIndexTypeBitwidth () const |
Gets the bitwidth of the index type when converted to LLVM. More... | |
unsigned | getPointerBitwidth (unsigned addressSpace=0) const |
Gets the pointer bitwidth. More... | |
unsigned | getMemRefDescriptorSize (MemRefType type, const DataLayout &layout) const |
Returns the size of the memref descriptor object in bytes. More... | |
unsigned | getUnrankedMemRefDescriptorSize (UnrankedMemRefType type, const DataLayout &layout) const |
Returns the size of the unranked memref descriptor object in bytes. More... | |
FailureOr< unsigned > | getMemRefAddressSpace (BaseMemRefType type) const |
Return the LLVM address space corresponding to the memory space of the memref type type or failure if the memory space cannot be converted to an integer. More... | |
SmallVector< Type, 5 > | getMemRefDescriptorFields (MemRefType type, bool unpackAggregates) const |
Convert a memref type into a list of LLVM IR types that will form the memref descriptor. More... | |
SmallVector< Type, 2 > | getUnrankedMemRefDescriptorFields () const |
Convert an unranked memref type into a list of non-aggregate LLVM IR types that will form the unranked memref descriptor. More... | |
LogicalResult | convertType (Type t, SmallVectorImpl< Type > &results) const |
Convert the given type. More... | |
LogicalResult | convertType (Value v, SmallVectorImpl< Type > &results) const |
Convert the type of the given value. More... | |
Type | convertType (Type t) const |
This hook simplifies defining 1-1 type conversions. More... | |
Type | convertType (Value v) const |
template<typename TargetType > | |
TargetType | convertType (Type t) const |
Attempts a 1-1 type conversion, expecting the result type to be TargetType . More... | |
template<typename TargetType > | |
TargetType | convertType (Value v) const |
![]() | |
virtual | ~TypeConverter ()=default |
TypeConverter ()=default | |
TypeConverter (const TypeConverter &other) | |
TypeConverter & | operator= (const TypeConverter &other) |
template<typename FnT , typename T = typename llvm::function_traits< std::decay_t<FnT>>::template arg_t<0>> | |
void | addConversion (FnT &&callback) |
Register a conversion function. More... | |
template<typename FnT , typename T = typename llvm::function_traits< std::decay_t<FnT>>::template arg_t<1>> | |
void | addSourceMaterialization (FnT &&callback) |
All of the following materializations require function objects that are convertible to the following form: Value(OpBuilder &, T, ValueRange, Location) , where T is any subclass of Type . More... | |
template<typename FnT , typename T = typename llvm::function_traits< std::decay_t<FnT>>::template arg_t<1>> | |
void | addTargetMaterialization (FnT &&callback) |
This method registers a materialization that will be called when converting a value to a target type according to a pattern's type converter. More... | |
template<typename FnT , typename T = typename llvm::function_traits<std::decay_t<FnT>>::template arg_t<0>, typename A = typename llvm::function_traits<std::decay_t<FnT>>::template arg_t<1>> | |
void | addTypeAttributeConversion (FnT &&callback) |
Register a conversion function for attributes within types. More... | |
LogicalResult | convertType (Type t, SmallVectorImpl< Type > &results) const |
Convert the given type. More... | |
LogicalResult | convertType (Value v, SmallVectorImpl< Type > &results) const |
Convert the type of the given value. More... | |
Type | convertType (Type t) const |
This hook simplifies defining 1-1 type conversions. More... | |
Type | convertType (Value v) const |
template<typename TargetType > | |
TargetType | convertType (Type t) const |
Attempts a 1-1 type conversion, expecting the result type to be TargetType . More... | |
template<typename TargetType > | |
TargetType | convertType (Value v) const |
LogicalResult | convertTypes (TypeRange types, SmallVectorImpl< Type > &results) const |
Convert the given types, filling 'results' as necessary. More... | |
LogicalResult | convertTypes (ValueRange values, SmallVectorImpl< Type > &results) const |
Convert the types of the given values, filling 'results' as necessary. More... | |
bool | isLegal (Type type) const |
Return true if the given type is legal for this type converter, i.e. More... | |
bool | isLegal (Value value) const |
bool | isLegal (TypeRange range) const |
Return true if all of the given types are legal for this type converter. More... | |
bool | isLegal (ValueRange range) const |
bool | isLegal (Operation *op) const |
Return true if the given operation has legal operand and result types. More... | |
bool | isLegal (Region *region) const |
Return true if the types of block arguments within the region are legal. More... | |
bool | isSignatureLegal (FunctionType ty) const |
Return true if the inputs and outputs of the given function type are legal. More... | |
LogicalResult | convertSignatureArg (unsigned inputNo, Type type, SignatureConversion &result) const |
This method allows for converting a specific argument of a signature. More... | |
LogicalResult | convertSignatureArgs (TypeRange types, SignatureConversion &result, unsigned origInputOffset=0) const |
LogicalResult | convertSignatureArg (unsigned inputNo, Value value, SignatureConversion &result) const |
LogicalResult | convertSignatureArgs (ValueRange values, SignatureConversion &result, unsigned origInputOffset=0) const |
std::optional< SignatureConversion > | convertBlockSignature (Block *block) const |
This function converts the type signature of the given block, by invoking 'convertSignatureArg' for each argument. More... | |
Value | materializeSourceConversion (OpBuilder &builder, Location loc, Type resultType, ValueRange inputs) const |
Materialize a conversion from a set of types into one result type by generating a cast sequence of some kind. More... | |
Value | materializeTargetConversion (OpBuilder &builder, Location loc, Type resultType, ValueRange inputs, Type originalType={}) const |
SmallVector< Value > | materializeTargetConversion (OpBuilder &builder, Location loc, TypeRange resultType, ValueRange inputs, Type originalType={}) const |
std::optional< Attribute > | convertTypeAttribute (Type type, Attribute attr) const |
Convert an attribute present attr from within the type type using the registered conversion functions. More... | |
Static Public Member Functions | |
static bool | canConvertToBarePtr (BaseMemRefType type) |
Check if a memref type can be converted to a bare pointer. More... | |
Protected Member Functions | |
SmallVector< Type > & | getCurrentThreadRecursiveStack () |
Protected Attributes | |
LLVM::LLVMDialect * | llvmDialect |
Pointer to the LLVM dialect. More... | |
DenseMap< uint64_t, std::unique_ptr< SmallVector< Type > > > | conversionCallStack |
llvm::sys::SmartRWMutex< true > | callStackMutex |
Friends | |
LogicalResult | structFuncArgTypeConverter (const LLVMTypeConverter &converter, Type type, SmallVectorImpl< Type > &result) |
Give structFuncArgTypeConverter access to memref-specific functions. More... | |
Conversion from types to the LLVM IR dialect.
Definition at line 35 of file TypeConverter.h.
LLVMTypeConverter::LLVMTypeConverter | ( | MLIRContext * | ctx, |
const DataLayoutAnalysis * | analysis = nullptr |
||
) |
Create an LLVMTypeConverter using the default LowerToLLVMOptions.
Create an LLVMTypeConverter using default LowerToLLVMOptions.
Optionally takes a data layout analysis to use in conversions.
Definition at line 42 of file TypeConverter.cpp.
LLVMTypeConverter::LLVMTypeConverter | ( | MLIRContext * | ctx, |
const LowerToLLVMOptions & | options, | ||
const DataLayoutAnalysis * | analysis = nullptr |
||
) |
Create an LLVMTypeConverter using custom LowerToLLVMOptions.
Optionally takes a data layout analysis to use in conversions.
Definition at line 115 of file TypeConverter.cpp.
References mlir::TypeConverter::addConversion(), mlir::TypeConverter::addSourceMaterialization(), mlir::TypeConverter::addTargetMaterialization(), mlir::TypeConverter::addTypeAttributeConversion(), convertType(), mlir::TypeConverter::convertTypes(), mlir::remark::failed(), mlir::get(), getCurrentThreadRecursiveStack(), mlir::LLVM::isCompatibleType(), llvmDialect, packRankedMemRefDesc(), packUnrankedMemRefDesc(), rankedMemRefMaterialization(), and unrankedMemRefMaterialization().
|
static |
Check if a memref type can be converted to a bare pointer.
Definition at line 593 of file TypeConverter.cpp.
References mlir::remark::failed().
Referenced by canBeCalledWithBarePointers().
LogicalResult LLVMTypeConverter::convertCallingConventionType | ( | Type | type, |
SmallVectorImpl< Type > & | result, | ||
bool | useBarePtrCallConv = false |
||
) | const |
Convert a type in the context of the default or bare pointer calling convention.
Calling convention sensitive types, such as MemRefType and UnrankedMemRefType, are converted following the specific rules for the calling convention. Calling convention independent types are converted following the default LLVM type conversions.
Definition at line 662 of file TypeConverter.cpp.
References convertType().
Referenced by mlir::barePtrFuncArgTypeConverter(), and packFunctionResults().
Type LLVMTypeConverter::convertFunctionSignature | ( | FunctionOpInterface | funcOp, |
bool | isVariadic, | ||
bool | useBarePtrCallConv, | ||
LLVMTypeConverter::SignatureConversion & | result, | ||
SmallVectorImpl< std::optional< NamedAttribute >> & | byValRefNonPtrAttrs | ||
) | const |
Convert a function type.
The arguments and results are converted one by one and results are packed into a wrapped LLVM IR structure type. result
is populated with argument mapping. Converted types of llvm.byval
and llvm.byref
function arguments which are not LLVM pointers are overridden with LLVM pointers. Overridden arguments are returned in byValRefNonPtrAttrs
.
Definition at line 411 of file TypeConverter.cpp.
References filterByValRefArgAttrs().
Type LLVMTypeConverter::convertFunctionSignature | ( | FunctionType | funcTy, |
bool | isVariadic, | ||
bool | useBarePtrCallConv, | ||
LLVMTypeConverter::SignatureConversion & | result | ||
) | const |
Convert a function type.
The arguments and results are converted one by one and results are packed into a wrapped LLVM IR structure type. result
is populated with argument mapping.
Definition at line 403 of file TypeConverter.cpp.
Referenced by mlir::convertFuncOpToLLVMFuncOp(), and mlir::GPUFuncOpLowering::matchAndRewrite().
std::pair< LLVM::LLVMFunctionType, LLVM::LLVMStructType > LLVMTypeConverter::convertFunctionTypeCWrapper | ( | FunctionType | type | ) | const |
Converts the function type to a C-compatible format, in particular using pointers to memref descriptors for arguments.
Also converts the return type to a pointer argument if it is a struct. Returns true if this was the case.
Definition at line 427 of file TypeConverter.cpp.
References convertType(), mlir::get(), getContext(), mlir::LLVM::isCompatibleType(), and packFunctionResults().
Referenced by wrapExternalFunction(), and wrapForExternalCallers().
Type TypeConverter::convertType |
This hook simplifies defining 1-1 type conversions.
This function returns the type to convert to on success, and a null type on failure.
Definition at line 274 of file DialectConversion.cpp.
|
inline |
Attempts a 1-1 type conversion, expecting the result type to be TargetType
.
Returns the converted type cast to TargetType
on success, and a null type on conversion or cast failure.
Definition at line 281 of file DialectConversion.h.
LogicalResult TypeConverter::convertType |
Convert the given type.
This function returns 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.
Note: This overload invokes only context-unaware type conversion functions. Users should call the other overload if possible.
Definition at line 261 of file DialectConversion.cpp.
Referenced by mlir::MemRefDescriptor::bufferPtr(), convertCallingConventionType(), mlir::convertFuncOpToLLVMFuncOp(), convertFunctionTypeCWrapper(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptor(), mlir::LLVM::detail::extractNDVectorTypeInfo(), extractOne(), mlir::MemRefDescriptor::fromStaticShape(), getDynamicSharedMemorySymbol(), getIndexedPtrs(), getMemRefAlignment(), getMemRefDescriptorFields(), mlir::LLVM::getStridedElementPtr(), getVectorAlignment(), insertOne(), LLVMTypeConverter(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::MemRefDescriptor::pack(), mlir::UnrankedMemRefDescriptor::pack(), packOperationResults(), restoreByValRefArgumentType(), mlir::impl::scalarizeVectorOp(), scalarizeVectorOpHelper(), mlir::structFuncArgTypeConverter(), wrapExternalFunction(), and wrapForExternalCallers().
Type TypeConverter::convertType |
Definition at line 275 of file DialectConversion.cpp.
|
inline |
Definition at line 285 of file DialectConversion.h.
LogicalResult TypeConverter::convertType |
Convert the type of the given value.
This function returns 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.
Note: This overload invokes both context-aware and context-unaware type conversion functions.
Definition at line 270 of file DialectConversion.cpp.
MLIRContext & LLVMTypeConverter::getContext | ( | ) | const |
Returns the MLIR context.
Definition at line 275 of file TypeConverter.cpp.
References getDialect().
Referenced by addOpaquePointerConversion(), convertFunctionTypeCWrapper(), getCurrentThreadRecursiveStack(), getIndexType(), getUnrankedMemRefDescriptorFields(), packFunctionResults(), packOperationResults(), mlir::populateAMXLegalizeForLLVMExportPatterns(), mlir::populateGpuToLLVMSPVConversionPatterns(), and mlir::populateGpuToNVVMConversionPatterns().
|
protected |
Definition at line 21 of file TypeConverter.cpp.
References callStackMutex, conversionCallStack, and getContext().
Referenced by LLVMTypeConverter().
|
inline |
Returns the data layout to use during and after conversion.
Definition at line 136 of file TypeConverter.h.
References mlir::LowerToLLVMOptions::dataLayout.
Referenced by getMemRefAlignment(), and getVectorAlignment().
|
inline |
Returns the data layout analysis to query during conversion.
Definition at line 139 of file TypeConverter.h.
|
inline |
Returns the LLVM dialect.
Definition at line 105 of file TypeConverter.h.
References llvmDialect.
Referenced by getContext(), mlir::ConvertToLLVMPattern::getDialect(), and mlir::populateVectorToLLVMConversionPatterns().
Type LLVMTypeConverter::getIndexType | ( | ) | const |
Gets the LLVM representation of the index type.
The returned type is an integer type with the size configured for this type converter.
Definition at line 279 of file TypeConverter.cpp.
References mlir::get(), getContext(), and getIndexTypeBitwidth().
Referenced by mlir::MemRefDescriptor::bufferPtr(), mlir::UnrankedMemRefDescriptor::computeSize(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptor(), createMemRefMetadataType(), mlir::ConvertToLLVMPattern::getIndexType(), getMemRefDescriptorFields(), getMemRefDescriptorSize(), mlir::LLVM::getStridedElementPtr(), getUnrankedMemRefDescriptorFields(), getUnrankedMemRefDescriptorSize(), mlir::UnrankedMemRefDescriptor::offset(), mlir::UnrankedMemRefDescriptor::setSize(), mlir::UnrankedMemRefDescriptor::setStride(), mlir::UnrankedMemRefDescriptor::size(), mlir::UnrankedMemRefDescriptor::sizeBasePtr(), mlir::UnrankedMemRefDescriptor::stride(), and mlir::UnrankedMemRefDescriptor::strideBasePtr().
|
inline |
Gets the bitwidth of the index type when converted to LLVM.
Definition at line 148 of file TypeConverter.h.
References mlir::LowerToLLVMOptions::getIndexBitwidth().
Referenced by mlir::UnrankedMemRefDescriptor::computeSize(), getIndexType(), and truncOrExtToLLVMType().
FailureOr< unsigned > LLVMTypeConverter::getMemRefAddressSpace | ( | BaseMemRefType | type | ) | const |
Return the LLVM address space corresponding to the memory space of the memref type type
or failure if the memory space cannot be converted to an integer.
Definition at line 575 of file TypeConverter.cpp.
References mlir::TypeConverter::convertTypeAttribute(), and mlir::BaseMemRefType::getMemorySpace().
Referenced by mlir::ConvertToLLVMPattern::copyUnrankedDescriptor(), createMemRefMetadataType(), getDynamicSharedMemorySymbol(), mlir::ConvertToLLVMPattern::getElementPtrType(), getMemRefDescriptorFields(), getMemRefDescriptorSize(), getUnrankedMemRefDescriptorSize(), and isMemRefTypeSupported().
SmallVector< Type, 5 > LLVMTypeConverter::getMemRefDescriptorFields | ( | MemRefType | type, |
bool | unpackAggregates | ||
) | const |
Convert a memref type into a list of LLVM IR types that will form the memref descriptor.
If unpackAggregates
is true the sizes
and strides
arrays in the descriptors are unpacked to individual index-typed elements, else they are kept as rank-sized arrays of index type. In particular, the list will contain:
For example, memref<?x?xf32> is converted to the following list:
!llvm<"float*">
(allocated pointer),!llvm<"float*">
(aligned pointer),i64
(offset),i64
, i64
(sizes),i64
, i64
(strides). These types can be recomposed to a memref descriptor struct.
The result contains the following types:
index
-type integer containing the distance between the beginning of the buffer and the first element to be accessed through the view, followed byindex
-type integers as the rank of the MemRef: the array represents the size, in number of elements, of the memref along the given dimension. For constant MemRef dimensions, the corresponding size entry is a constant whose runtime value must match the static value, followed byindex
-type integers as the rank of the MemRef: the second array represents the "stride" (in tensor abstraction sense), i.e. the number of consecutive elements of the underlying buffer. TODO: add assertions for the static cases.If unpackAggregates
is set to true, the arrays described in (4) and (5) are expanded into individual index-type elements.
template <typename Elem, typename Index, size_t Rank> struct { Elem *allocatedPtr; Elem *alignedPtr; Index offset; Index sizes[Rank]; // omitted when rank == 0 Index strides[Rank]; // omitted when rank == 0 };
Definition at line 486 of file TypeConverter.cpp.
References convertType(), mlir::emitError(), mlir::remark::failed(), mlir::get(), getIndexType(), and getMemRefAddressSpace().
Referenced by packRankedMemRefDesc(), and mlir::structFuncArgTypeConverter().
unsigned LLVMTypeConverter::getMemRefDescriptorSize | ( | MemRefType | type, |
const DataLayout & | layout | ||
) | const |
Returns the size of the memref descriptor object in bytes.
Definition at line 526 of file TypeConverter.cpp.
References mlir::detail::divideCeil(), getIndexType(), getMemRefAddressSpace(), getPointerBitwidth(), and mlir::DataLayout::getTypeSize().
|
inline |
Definition at line 107 of file TypeConverter.h.
Referenced by mlir::GPUReturnOpLowering::matchAndRewrite(), mlir::populateFinalizeMemRefToLLVMConversionPatterns(), and shouldUseBarePtrCallConv().
unsigned LLVMTypeConverter::getPointerBitwidth | ( | unsigned | addressSpace = 0 | ) | const |
Gets the pointer bitwidth.
Definition at line 283 of file TypeConverter.cpp.
References mlir::LowerToLLVMOptions::dataLayout.
Referenced by mlir::UnrankedMemRefDescriptor::computeSize(), getMemRefDescriptorSize(), and getUnrankedMemRefDescriptorSize().
SmallVector< Type, 2 > LLVMTypeConverter::getUnrankedMemRefDescriptorFields | ( | ) | const |
Convert an unranked memref type into a list of non-aggregate LLVM IR types that will form the unranked memref descriptor.
In particular, this list contains:
a pointer to the memref descriptor struct. For example, memref<xf32> is converted to the following list: i64 (rank) !llvm<"i8</em>"> (type-erased pointer). These types can be recomposed to a unranked memref descriptor struct.
In particular, the fields for an unranked memref descriptor are:
Definition at line 554 of file TypeConverter.cpp.
References mlir::get(), getContext(), and getIndexType().
Referenced by packUnrankedMemRefDesc(), and mlir::structFuncArgTypeConverter().
unsigned LLVMTypeConverter::getUnrankedMemRefDescriptorSize | ( | UnrankedMemRefType | type, |
const DataLayout & | layout | ||
) | const |
Returns the size of the unranked memref descriptor object in bytes.
Definition at line 558 of file TypeConverter.cpp.
References mlir::detail::divideCeil(), getIndexType(), getMemRefAddressSpace(), getPointerBitwidth(), and mlir::DataLayout::getTypeSize().
Type LLVMTypeConverter::packFunctionResults | ( | TypeRange | types, |
bool | useBarePtrCallConv = false , |
||
SmallVector< SmallVector< Type >> * | groupedTypes = nullptr , |
||
int64_t * | numConvertedTypes = nullptr |
||
) | const |
Convert a non-empty list of types to be returned from a function into an LLVM-compatible type.
In particular, if more than one value is returned, create an LLVM dialect structure type with elements that correspond to each of the types converted with convertCallingConventionType
.
Populate the converted (unpacked) types into groupedTypes
, if provided. groupedType
contains one nested vector per input type. In case of a 1:N conversion, a nested vector may contain 0 or more then 1 converted type.
In particular, if more than one value is returned, create an LLVM dialect structure type with elements that correspond to each of the types converted with convertCallingConventionType
.
Definition at line 702 of file TypeConverter.cpp.
References convertCallingConventionType(), mlir::remark::failed(), getContext(), and mlir::LowerToLLVMOptions::useBarePtrCallConv.
Referenced by convertFunctionTypeCWrapper(), and mlir::GPUReturnOpLowering::matchAndRewrite().
Convert a non-empty list of types of values produced by an operation into an LLVM-compatible type.
In particular, if more than one value is produced, create a literal structure with elements that correspond to each of the LLVM-compatible types converted with convertType
.
In particular, if more than one value is produced, create a literal structure with elements that correspond to each of the types converted with convertType
.
Definition at line 681 of file TypeConverter.cpp.
References convertType(), getContext(), and mlir::LLVM::isCompatibleType().
Referenced by mlir::LLVM::detail::intrinsicRewrite(), and mlir::LLVM::detail::oneToOneRewrite().
Value LLVMTypeConverter::promoteOneMemRefDescriptor | ( | Location | loc, |
Value | operand, | ||
OpBuilder & | builder | ||
) | const |
Promote the LLVM struct representation of one MemRef descriptor to stack and use pointer to struct to avoid the complexity of the platform-specific C/C++ ABI lowering related to struct argument passing.
Definition at line 734 of file TypeConverter.cpp.
References mlir::get(), mlir::Builder::getContext(), mlir::Builder::getI64Type(), mlir::Builder::getIndexAttr(), and mlir::Value::getType().
SmallVector< Value, 4 > LLVMTypeConverter::promoteOperands | ( | Location | loc, |
ValueRange | opOperands, | ||
ArrayRef< ValueRange > | adaptorOperands, | ||
OpBuilder & | builder, | ||
bool | useBarePtrCallConv = false |
||
) | const |
Promote the LLVM representation of all operands including promoting MemRef descriptors to stack and use pointers to struct to avoid the complexity of the platform-specific C/C++ ABI lowering related to struct argument passing.
(The ArrayRef variant is for 1:N.)
Definition at line 757 of file TypeConverter.cpp.
References mlir::MemRefDescriptor::alignedPtr(), mlir::MemRefDescriptor::unpack(), mlir::UnrankedMemRefDescriptor::unpack(), and mlir::LowerToLLVMOptions::useBarePtrCallConv.
Referenced by promoteOperands().
SmallVector< Value, 4 > LLVMTypeConverter::promoteOperands | ( | Location | loc, |
ValueRange | opOperands, | ||
ValueRange | adaptorOperands, | ||
OpBuilder & | builder, | ||
bool | useBarePtrCallConv = false |
||
) | const |
Definition at line 748 of file TypeConverter.cpp.
References promoteOperands().
|
friend |
Give structFuncArgTypeConverter access to memref-specific functions.
It converts a MemRef function argument to a list of non-aggregate types containing descriptor information, and an UnrankedmemRef function argument to a list containing the rank and a pointer to a descriptor struct.
|
protected |
Definition at line 211 of file TypeConverter.h.
Referenced by getCurrentThreadRecursiveStack().
|
protected |
Definition at line 210 of file TypeConverter.h.
Referenced by getCurrentThreadRecursiveStack().
|
protected |
Pointer to the LLVM dialect.
Definition at line 206 of file TypeConverter.h.
Referenced by getDialect(), and LLVMTypeConverter().