MLIR
15.0.0git
|
Namespaces | |
detail | |
Classes | |
class | LLVMArrayType |
LLVM dialect array type. More... | |
class | LLVMFixedVectorType |
LLVM dialect fixed vector type, represents a sequence of elements of known length that can be processed as one. More... | |
class | LLVMFunctionType |
LLVM dialect function type. More... | |
class | LLVMPointerType |
LLVM dialect pointer type. More... | |
class | LLVMScalableVectorType |
LLVM dialect scalable vector type, represents a sequence of elements of unknown length that is known to be divisible by some constant. More... | |
class | LLVMStructType |
LLVM dialect structure type representing a collection of different-typed elements manipulated together. More... | |
class | LoopOptionsAttrBuilder |
Builder class for LoopOptionsAttr. More... | |
class | ModuleTranslation |
Implementation class for module translation. More... | |
class | TypeFromLLVMIRTranslator |
Utility class to translate LLVM IR types to the MLIR LLVM dialect. More... | |
class | TypeToLLVMIRTranslator |
Utility class to translate MLIR LLVM dialect types to LLVM IR. More... | |
Functions | |
LLVM::LLVMFuncOp | lookupOrCreatePrintI64Fn (ModuleOp moduleOp) |
Helper functions to lookup or create the declaration for commonly used external C function calls. More... | |
LLVM::LLVMFuncOp | lookupOrCreatePrintU64Fn (ModuleOp moduleOp) |
LLVM::LLVMFuncOp | lookupOrCreatePrintF32Fn (ModuleOp moduleOp) |
LLVM::LLVMFuncOp | lookupOrCreatePrintF64Fn (ModuleOp moduleOp) |
LLVM::LLVMFuncOp | lookupOrCreatePrintOpenFn (ModuleOp moduleOp) |
LLVM::LLVMFuncOp | lookupOrCreatePrintCloseFn (ModuleOp moduleOp) |
LLVM::LLVMFuncOp | lookupOrCreatePrintCommaFn (ModuleOp moduleOp) |
LLVM::LLVMFuncOp | lookupOrCreatePrintNewlineFn (ModuleOp moduleOp) |
LLVM::LLVMFuncOp | lookupOrCreateMallocFn (ModuleOp moduleOp, Type indexType) |
LLVM::LLVMFuncOp | lookupOrCreateAlignedAllocFn (ModuleOp moduleOp, Type indexType) |
LLVM::LLVMFuncOp | lookupOrCreateFreeFn (ModuleOp moduleOp) |
LLVM::LLVMFuncOp | lookupOrCreateMemRefCopyFn (ModuleOp moduleOp, Type indexType, Type unrankedDescriptorType) |
LLVM::LLVMFuncOp | lookupOrCreateFn (ModuleOp moduleOp, StringRef name, ArrayRef< Type > paramTypes={}, Type resultType={}) |
Create a FuncOp with signature resultType (paramTypes )and name name`. More... | |
Operation::result_range | createLLVMCall (OpBuilder &b, Location loc, LLVM::LLVMFuncOp fn, ValueRange args={}, ArrayRef< Type > resultTypes={}) |
Helper wrapper to create a call to fn with args and resultTypes . More... | |
Value | createGlobalString (Location loc, OpBuilder &builder, StringRef name, StringRef value, Linkage linkage) |
Create an LLVM global containing the string "value" at the module containing surrounding the insertion point of builder. More... | |
bool | satisfiesLLVMModule (Operation *op) |
LLVM requires some operations to be inside of a Module operation. More... | |
DEFINE_TRIVIAL_LLVM_TYPE (LLVMVoidType) | |
DEFINE_TRIVIAL_LLVM_TYPE (LLVMPPCFP128Type) | |
DEFINE_TRIVIAL_LLVM_TYPE (LLVMX86MMXType) | |
DEFINE_TRIVIAL_LLVM_TYPE (LLVMTokenType) | |
DEFINE_TRIVIAL_LLVM_TYPE (LLVMLabelType) | |
DEFINE_TRIVIAL_LLVM_TYPE (LLVMMetadataType) | |
bool | isCompatibleType (Type type) |
Returns true if the given type is compatible with the LLVM dialect. More... | |
bool | isCompatibleOuterType (Type type) |
Returns true if the given outer type is compatible with the LLVM dialect without checking its potential nested types such as struct elements. More... | |
bool | isCompatibleFloatingPointType (Type type) |
Returns true if the given type is a floating-point type compatible with the LLVM dialect. More... | |
bool | isCompatibleVectorType (Type type) |
Returns true if the given type is a vector type compatible with the LLVM dialect. More... | |
Type | getVectorElementType (Type type) |
Returns the element type of any vector type compatible with the LLVM dialect. More... | |
llvm::ElementCount | getVectorNumElements (Type type) |
Returns the element count of any LLVM-compatible vector type. More... | |
bool | isScalableVectorType (Type vectorType) |
Returns whether a vector type is scalable or not. More... | |
Type | getVectorType (Type elementType, unsigned numElements, bool isScalable=false) |
Creates an LLVM dialect-compatible vector type with the given element type and length. More... | |
Type | getFixedVectorType (Type elementType, unsigned numElements) |
Creates an LLVM dialect-compatible type with the given element type and length. More... | |
Type | getScalableVectorType (Type elementType, unsigned numElements) |
Creates an LLVM dialect-compatible type with the given element type and length. More... | |
llvm::TypeSize | getPrimitiveTypeSizeInBits (Type type) |
Returns the size of the given primitive LLVM dialect-compatible type (including vectors) in bits, for example, the size of i16 is 16 and the size of vector<4xi16> is 64. More... | |
void | ensureDistinctSuccessors (Operation *op) |
Make argument-taking successors of each block distinct. More... | |
std::unique_ptr< Pass > | createLegalizeForExportPass () |
Creates a pass that legalizes the LLVM dialect operations so that they can be translated to LLVM IR. More... | |
Value mlir::LLVM::createGlobalString | ( | Location | loc, |
OpBuilder & | builder, | ||
StringRef | name, | ||
StringRef | value, | ||
LLVM::Linkage | linkage | ||
) |
Create an LLVM global containing the string "value" at the module containing surrounding the insertion point of builder.
Obtain the address of that global and use it to compute the address of the first character in the string (operations inserted at the builder insertion point).
Definition at line 2870 of file LLVMDialect.cpp.
References mlir::OpBuilder::create(), mlir::LLVM::LLVMArrayType::get(), mlir::LLVM::LLVMPointerType::get(), mlir::Builder::getContext(), mlir::Builder::getIndexType(), mlir::OpBuilder::getInsertionBlock(), mlir::Builder::getIntegerAttr(), mlir::OpBuilder::getListener(), mlir::Operation::getParentOfType(), mlir::Block::getParentOp(), and mlir::Builder::getStringAttr().
Referenced by isDefinedByCallTo().
std::unique_ptr< Pass > mlir::LLVM::createLegalizeForExportPass | ( | ) |
Creates a pass that legalizes the LLVM dialect operations so that they can be translated to LLVM IR.
Definition at line 78 of file LegalizeForExport.cpp.
Operation::result_range mlir::LLVM::createLLVMCall | ( | OpBuilder & | b, |
Location | loc, | ||
LLVM::LLVMFuncOp | fn, | ||
ValueRange | args = {} , |
||
ArrayRef< Type > | resultTypes = {} |
||
) |
Helper wrapper to create a call to fn
with args
and resultTypes
.
Definition at line 127 of file FunctionCallUtils.cpp.
References mlir::OpBuilder::create().
mlir::LLVM::DEFINE_TRIVIAL_LLVM_TYPE | ( | LLVMVoidType | ) |
mlir::LLVM::DEFINE_TRIVIAL_LLVM_TYPE | ( | LLVMPPCFP128Type | ) |
mlir::LLVM::DEFINE_TRIVIAL_LLVM_TYPE | ( | LLVMX86MMXType | ) |
mlir::LLVM::DEFINE_TRIVIAL_LLVM_TYPE | ( | LLVMTokenType | ) |
mlir::LLVM::DEFINE_TRIVIAL_LLVM_TYPE | ( | LLVMLabelType | ) |
mlir::LLVM::DEFINE_TRIVIAL_LLVM_TYPE | ( | LLVMMetadataType | ) |
Make argument-taking successors of each block distinct.
PHI nodes in LLVM IR use the predecessor ID to identify which value to take. They do not support different values coming from the same predecessor. If a block has another block as a successor more than once with different values, insert a new dummy block for LLVM PHI nodes to tell the sources apart.
Definition at line 59 of file LegalizeForExport.cpp.
References ensureDistinctSuccessors(), mlir::Operation::getRegions(), and mlir::Operation::walk().
Referenced by prepareLLVMModule().
Creates an LLVM dialect-compatible type with the given element type and length.
Definition at line 856 of file LLVMTypes.cpp.
References mlir::LLVM::LLVMFixedVectorType::get(), and mlir::LLVM::LLVMFixedVectorType::isValidElementType().
Referenced by convertIntrinsicResult(), getIndexedPtrs(), mlir::nvgpu::getMmaSyncRegisterType(), inferIntrinsicResultType(), printNVVMIntrinsicOp(), replaceTransferOpWithMubuf(), mlir::LLVM::detail::TypeFromLLVMIRTranslatorImpl::translateType(), and unpackOperandVector().
llvm::TypeSize mlir::LLVM::getPrimitiveTypeSizeInBits | ( | Type | type | ) |
Returns the size of the given primitive LLVM dialect-compatible type (including vectors) in bits, for example, the size of i16 is 16 and the size of vector<4xi16> is 64.
Returns 0 for non-primitive (aggregates such as struct) or types that don't have a size (such as void).
Definition at line 879 of file LLVMTypes.cpp.
References mlir::LLVM::LLVMFixedVectorType::getElementType(), mlir::LLVM::LLVMFixedVectorType::getNumElements(), mlir::Type::isa(), isCompatibleType(), and isCompatibleVectorType().
Creates an LLVM dialect-compatible type with the given element type and length.
Definition at line 867 of file LLVMTypes.cpp.
References mlir::LLVM::LLVMScalableVectorType::get(), and mlir::LLVM::LLVMScalableVectorType::isValidElementType().
Returns the element type of any vector type compatible with the LLVM dialect.
Definition at line 804 of file LLVMTypes.cpp.
Referenced by getInsertExtractValueElementType(), getLLVMTypeBitWidth(), getLoadStoreElementType(), and isZeroAttribute().
llvm::ElementCount mlir::LLVM::getVectorNumElements | ( | Type | type | ) |
Returns the element count of any LLVM-compatible vector type.
Definition at line 813 of file LLVMTypes.cpp.
References mlir::LLVM::LLVMScalableVectorType::getMinNumElements(), and mlir::LLVM::LLVMFixedVectorType::getNumElements().
Referenced by replaceTransferOpWithMubuf().
Creates an LLVM dialect-compatible vector type with the given element type and length.
Definition at line 841 of file LLVMTypes.cpp.
References mlir::LLVM::LLVMFixedVectorType::get(), mlir::LLVM::LLVMScalableVectorType::get(), and mlir::LLVM::LLVMFixedVectorType::isValidElementType().
Referenced by isZeroAttribute().
bool mlir::LLVM::isCompatibleFloatingPointType | ( | Type | type | ) |
Returns true
if the given type is a floating-point type compatible with the LLVM dialect.
Definition at line 783 of file LLVMTypes.cpp.
References mlir::Type::isa().
Referenced by mlir::LLVM::LLVMScalableVectorType::isValidElementType().
bool mlir::LLVM::isCompatibleOuterType | ( | Type | type | ) |
Returns true
if the given outer type is compatible with the LLVM dialect without checking its potential nested types such as struct elements.
Definition at line 687 of file LLVMTypes.cpp.
References mlir::Type::dyn_cast(), and mlir::Type::isa().
Referenced by mlir::LLVM::LLVMPointerType::isValidElementType().
bool mlir::LLVM::isCompatibleType | ( | Type | type | ) |
Returns true
if the given type is compatible with the LLVM dialect.
Definition at line 778 of file LLVMTypes.cpp.
References isCompatibleImpl().
Referenced by areAllLLVMTypes(), buildLLVMFunctionType(), mlir::LLVM::ModuleTranslation::convertBlock(), mlir::LLVMTypeConverter::convertFunctionTypeCWrapper(), declareReduction(), dispatchPrint(), mlir::LLVM::detail::extractNDVectorTypeInfo(), getInsertExtractValueElementType(), getLoadStoreElementType(), getPrimitiveTypeSizeInBits(), mlir::LLVMTypeConverter::LLVMTypeConverter(), optionallyTruncateOrExtend(), mlir::LLVMTypeConverter::packFunctionResults(), mlir::StructBuilder::StructBuilder(), mlir::LLVM::detail::vectorOneToOneRewrite(), and wrapExternalFunction().
bool mlir::LLVM::isCompatibleVectorType | ( | Type | type | ) |
Returns true
if the given type is a vector type compatible with the LLVM dialect.
Compatible types include 1D built-in vector types of built-in integers and floating-point values, LLVM dialect fixed vector types of LLVM dialect pointers and LLVM dialect scalable vector types.
Definition at line 788 of file LLVMTypes.cpp.
References mlir::Type::dyn_cast(), and mlir::Type::isa().
Referenced by mlir::LLVMTypeConverter::canConvertToBarePtr(), mlir::LLVM::detail::extractNDVectorTypeInfo(), getInsertExtractValueElementType(), getLLVMTypeBitWidth(), getLoadStoreElementType(), getPrimitiveTypeSizeInBits(), isZeroAttribute(), and mlir::LLVM::detail::TypeToLLVMIRTranslatorImpl::translateType().
bool mlir::LLVM::isScalableVectorType | ( | Type | vectorType | ) |
Returns whether a vector type is scalable or not.
Definition at line 831 of file LLVMTypes.cpp.
References mlir::Type::cast(), and mlir::Type::isa().
Referenced by isZeroAttribute().
LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreateAlignedAllocFn | ( | ModuleOp | moduleOp, |
Type | indexType | ||
) |
Definition at line 104 of file FunctionCallUtils.cpp.
References mlir::LLVM::LLVMPointerType::get(), kAlignedAlloc, and lookupOrCreateFn().
Referenced by addResumeFunction().
LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreateFn | ( | ModuleOp | moduleOp, |
StringRef | name, | ||
ArrayRef< Type > | paramTypes = {} , |
||
Type | resultType = {} |
||
) |
Create a FuncOp with signature resultType
(paramTypes
)and name
name`.
Generic print function lookupOrCreate helper.
Definition at line 41 of file FunctionCallUtils.cpp.
References mlir::OpBuilder::create(), and mlir::LLVM::LLVMFunctionType::get().
Referenced by lookupOrCreateAlignedAllocFn(), lookupOrCreateFreeFn(), lookupOrCreateMallocFn(), lookupOrCreateMemRefCopyFn(), lookupOrCreatePrintCloseFn(), lookupOrCreatePrintCommaFn(), lookupOrCreatePrintF32Fn(), lookupOrCreatePrintF64Fn(), lookupOrCreatePrintI64Fn(), lookupOrCreatePrintNewlineFn(), lookupOrCreatePrintOpenFn(), and lookupOrCreatePrintU64Fn().
LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreateFreeFn | ( | ModuleOp | moduleOp | ) |
Definition at line 111 of file FunctionCallUtils.cpp.
References mlir::LLVM::LLVMPointerType::get(), kFree, and lookupOrCreateFn().
Referenced by addResumeFunction(), and mlir::ConvertToLLVMPattern::copyUnrankedDescriptors().
LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreateMallocFn | ( | ModuleOp | moduleOp, |
Type | indexType | ||
) |
Definition at line 97 of file FunctionCallUtils.cpp.
References mlir::LLVM::LLVMPointerType::get(), kMalloc, and lookupOrCreateFn().
Referenced by mlir::ConvertToLLVMPattern::copyUnrankedDescriptors().
LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreateMemRefCopyFn | ( | ModuleOp | moduleOp, |
Type | indexType, | ||
Type | unrankedDescriptorType | ||
) |
Definition at line 119 of file FunctionCallUtils.cpp.
References kMemRefCopy, and lookupOrCreateFn().
LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreatePrintCloseFn | ( | ModuleOp | moduleOp | ) |
Definition at line 82 of file FunctionCallUtils.cpp.
References kPrintClose, and lookupOrCreateFn().
LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreatePrintCommaFn | ( | ModuleOp | moduleOp | ) |
Definition at line 87 of file FunctionCallUtils.cpp.
References kPrintComma, and lookupOrCreateFn().
LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreatePrintF32Fn | ( | ModuleOp | moduleOp | ) |
Definition at line 65 of file FunctionCallUtils.cpp.
References kPrintF32, and lookupOrCreateFn().
LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreatePrintF64Fn | ( | ModuleOp | moduleOp | ) |
Definition at line 71 of file FunctionCallUtils.cpp.
References kPrintF64, and lookupOrCreateFn().
LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreatePrintI64Fn | ( | ModuleOp | moduleOp | ) |
Helper functions to lookup or create the declaration for commonly used external C function calls.
Such ops can then be invoked by creating a CallOp with the proper arguments via createLLVMCall
. The list of functions provided here must be implemented separately (e.g. as part of a support runtime library or as part of the libc).
Definition at line 53 of file FunctionCallUtils.cpp.
References kPrintI64, and lookupOrCreateFn().
LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreatePrintNewlineFn | ( | ModuleOp | moduleOp | ) |
Definition at line 92 of file FunctionCallUtils.cpp.
References kPrintNewline, and lookupOrCreateFn().
LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreatePrintOpenFn | ( | ModuleOp | moduleOp | ) |
Definition at line 77 of file FunctionCallUtils.cpp.
References kPrintOpen, and lookupOrCreateFn().
LLVM::LLVMFuncOp mlir::LLVM::lookupOrCreatePrintU64Fn | ( | ModuleOp | moduleOp | ) |
Definition at line 59 of file FunctionCallUtils.cpp.
References kPrintU64, and lookupOrCreateFn().
bool mlir::LLVM::satisfiesLLVMModule | ( | Operation * | op | ) |
LLVM requires some operations to be inside of a Module operation.
This function confirms that the Operation has the desired properties.
Definition at line 2898 of file LLVMDialect.cpp.
References mlir::AsmParser::emitError(), mlir::failed(), mlir::failure(), mlir::AsmParser::getContext(), mlir::AsmParser::getNameLoc(), mlir::Operation::hasTrait(), mlir::AsmParser::parseCommaSeparatedList(), mlir::AsmParser::parseGreater(), mlir::AsmParser::parseKeyword(), mlir::AsmParser::parseLess(), mlir::AsmParser::parseOptionalGreater(), print(), and mlir::success().
Referenced by mlir::LLVM::detail::getLLVMConstant(), isZeroAttribute(), lookupSymbolInModule(), and prepareLLVMModule().