14 #ifndef MLIR_CONVERSION_LLVMCOMMON_TYPECONVERTER_H
15 #define MLIR_CONVERSION_LLVMCOMMON_TYPECONVERTER_H
22 class DataLayoutAnalysis;
23 class LowerToLLVMOptions;
27 class LLVMPointerType;
28 class LLVMFunctionType;
90 options = std::move(newOptions);
111 std::pair<LLVM::LLVMFunctionType, LLVM::LLVMStructType>
119 return dataLayoutAnalysis;
135 unsigned addressSpace = 0);
167 Type convertFunctionType(FunctionType type);
171 Type convertIndexType(IndexType type);
174 Type convertIntegerType(IntegerType type);
184 Type convertComplexType(ComplexType type);
187 Type convertMemRefType(MemRefType type);
211 bool unpackAggregates);
232 Type convertVectorType(VectorType type);
This class provides a shared interface for ranked and unranked memref types.
This class implements a pattern rewriter for use with ConversionPatterns.
Stores data layout objects for each operation that specifies the data layout above and below the give...
The main mechanism for performing data layout queries.
This class provides support for representing a failure result, or a valid value of type T.
Conversion from types to the LLVM IR dialect.
LLVM::LLVMDialect * llvmDialect
Pointer to the LLVM dialect.
unsigned getPointerBitwidth(unsigned addressSpace=0)
Gets the pointer bitwidth.
Type packFunctionResults(TypeRange types)
Convert a non-empty list of types to be returned from a function into a supported LLVM IR type.
LLVM::LLVMDialect * getDialect()
Returns the LLVM dialect.
SmallVector< Value, 4 > promoteOperands(Location loc, ValueRange opOperands, ValueRange operands, OpBuilder &builder)
Promote the LLVM representation of all operands including promoting MemRef descriptors to stack and u...
std::pair< LLVM::LLVMFunctionType, LLVM::LLVMStructType > convertFunctionTypeCWrapper(FunctionType type)
Converts the function type to a C-compatible format, in particular using pointers to memref descripto...
const LowerToLLVMOptions & getOptions() const
const llvm::DataLayout & getDataLayout()
Returns the data layout to use during and after conversion.
const DataLayoutAnalysis * getDataLayoutAnalysis() const
Returns the data layout analysis to query during conversion.
MLIRContext & getContext()
Returns the MLIR context.
Type convertCallingConventionType(Type type)
Convert a type in the context of the default or bare pointer calling convention.
Type getIndexType()
Gets the LLVM representation of the index type.
unsigned getMemRefDescriptorSize(MemRefType type, const DataLayout &layout)
Returns the size of the memref descriptor object in bytes.
void promoteBarePtrsToDescriptors(ConversionPatternRewriter &rewriter, Location loc, ArrayRef< Type > stdTypes, SmallVectorImpl< Value > &values)
Promote the bare pointers in 'values' that resulted from memrefs to descriptors.
LLVM::LLVMPointerType getPointerType(Type elementType, unsigned addressSpace=0)
Creates an LLVM pointer type with the given element type and address space.
Type convertFunctionSignature(FunctionType funcTy, bool isVariadic, SignatureConversion &result)
Convert a function type.
void dangerousSetOptions(LowerToLLVMOptions newOptions)
Set the lowering options to newOptions.
FailureOr< unsigned > getMemRefAddressSpace(BaseMemRefType type)
Return the LLVM address space corresponding to the memory space of the memref type type or failure if...
friend LogicalResult structFuncArgTypeConverter(LLVMTypeConverter &converter, Type type, SmallVectorImpl< Type > &result)
Give structFuncArgTypeConverter access to memref-specific functions.
LLVMTypeConverter(MLIRContext *ctx, const DataLayoutAnalysis *analysis=nullptr)
Create an LLVMTypeConverter using the default LowerToLLVMOptions.
static bool canConvertToBarePtr(BaseMemRefType type)
Check if a memref type can be converted to a bare pointer.
unsigned getIndexTypeBitwidth()
Gets the bitwidth of the index type when converted to LLVM.
Value promoteOneMemRefDescriptor(Location loc, Value operand, OpBuilder &builder)
Promote the LLVM struct representation of one MemRef descriptor to stack and use pointer to struct to...
bool useOpaquePointers() const
Returns true if using opaque pointers was enabled in the lowering options.
unsigned getUnrankedMemRefDescriptorSize(UnrankedMemRefType type, const DataLayout &layout)
Returns the size of the unranked memref descriptor object in bytes.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Options to control the LLVM lowering.
llvm::DataLayout dataLayout
The data layout of the module to produce.
unsigned getIndexBitwidth() const
Get the index bitwidth.
MLIRContext is the top-level object for a collection of MLIR operations.
This class helps build Operations.
This class provides all of the information necessary to convert a type signature.
LogicalResult convertType(Type t, SmallVectorImpl< Type > &results)
Convert the given type.
This class provides an abstraction over the various different ranges of value types.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
This class provides an abstraction over the different types of ranges over Values.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Include the generated interface declarations.
LogicalResult barePtrFuncArgTypeConverter(LLVMTypeConverter &converter, Type type, SmallVectorImpl< Type > &result)
Callback to convert function argument types.
LogicalResult structFuncArgTypeConverter(LLVMTypeConverter &converter, Type type, SmallVectorImpl< Type > &result)
Callback to convert function argument types.
This class represents an efficient way to signal success or failure.