MLIR
21.0.0git
|
#include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMIRToLLVMTranslation.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMInterfaces.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Target/LLVMIR/ModuleImport.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Support/ModRef.h"
#include "mlir/Dialect/LLVMIR/LLVMConversionEnumsFromLLVM.inc"
#include "mlir/Dialect/LLVMIR/LLVMConvertibleLLVMIRIntrinsics.inc"
#include "mlir/Dialect/LLVMIR/LLVMIntrinsicFromLLVMIRConversions.inc"
Go to the source code of this file.
Functions | |
static bool | isConvertibleIntrinsic (llvm::Intrinsic::ID id) |
Returns true if the LLVM IR intrinsic is convertible to an MLIR LLVM dialect intrinsic. More... | |
static ArrayRef< unsigned > | getSupportedIntrinsicsImpl () |
Returns the list of LLVM IR intrinsic identifiers that are convertible to MLIR LLVM dialect intrinsics. More... | |
static LogicalResult | convertIntrinsicImpl (OpBuilder &odsBuilder, llvm::CallInst *inst, LLVM::ModuleImport &moduleImport) |
Converts the LLVM intrinsic to an MLIR LLVM dialect operation if a conversion exits. More... | |
static ArrayRef< unsigned > | getSupportedMetadataImpl (llvm::LLVMContext &context) |
Returns the list of LLVM IR metadata kinds that are convertible to MLIR LLVM dialect attributes. More... | |
static LogicalResult | setProfilingAttr (OpBuilder &builder, llvm::MDNode *node, Operation *op, LLVM::ModuleImport &moduleImport) |
Converts the given profiling metadata node to an MLIR profiling attribute and attaches it to the imported operation if the translation succeeds. More... | |
static LogicalResult | setTBAAAttr (const llvm::MDNode *node, Operation *op, LLVM::ModuleImport &moduleImport) |
Searches for the attribute that maps to the given TBAA metadata node and attaches it to the imported operation if the lookup succeeds. More... | |
static LogicalResult | setAccessGroupsAttr (const llvm::MDNode *node, Operation *op, LLVM::ModuleImport &moduleImport) |
Looks up all the access group attributes that map to the access group nodes starting from the access group metadata node , and attaches all of them to the imported operation if the lookups succeed. More... | |
static LogicalResult | setDereferenceableAttr (const llvm::MDNode *node, unsigned kindID, Operation *op, LLVM::ModuleImport &moduleImport) |
Converts the given dereferenceable metadata node to a dereferenceable attribute, and attaches it to the imported operation if the translation succeeds. More... | |
static LogicalResult | setLoopAttr (const llvm::MDNode *node, Operation *op, LLVM::ModuleImport &moduleImport) |
Converts the given loop metadata node to an MLIR loop annotation attribute and attaches it to the imported operation if the translation succeeds. More... | |
static LogicalResult | setAliasScopesAttr (const llvm::MDNode *node, Operation *op, LLVM::ModuleImport &moduleImport) |
Looks up all the alias scope attributes that map to the alias scope nodes starting from the alias scope metadata node , and attaches all of them to the imported operation if the lookups succeed. More... | |
static LogicalResult | setNoaliasScopesAttr (const llvm::MDNode *node, Operation *op, LLVM::ModuleImport &moduleImport) |
Looks up all the alias scope attributes that map to the alias scope nodes starting from the noalias metadata node , and attaches all of them to the imported operation if the lookups succeed. More... | |
static std::optional< int32_t > | parseIntegerMD (llvm::Metadata *md) |
Extracts an integer from the provided metadata md if possible. More... | |
static VecTypeHintAttr | convertVecTypeHint (Builder builder, llvm::MDNode *node, ModuleImport &moduleImport) |
Converts the provided metadata node node to an LLVM dialect VecTypeHintAttr if possible. More... | |
static DenseI32ArrayAttr | convertDenseI32Array (Builder builder, llvm::MDNode *node) |
Converts the provided metadata node node to an MLIR DenseI32ArrayAttr if possible. More... | |
static IntegerAttr | convertIntegerMD (Builder builder, llvm::MDNode *node) |
Convert an MDNode to an MLIR IntegerAttr if possible. More... | |
static LogicalResult | setVecTypeHintAttr (Builder &builder, llvm::MDNode *node, Operation *op, LLVM::ModuleImport &moduleImport) |
static LogicalResult | setWorkGroupSizeHintAttr (Builder &builder, llvm::MDNode *node, Operation *op) |
static LogicalResult | setReqdWorkGroupSizeAttr (Builder &builder, llvm::MDNode *node, Operation *op) |
static LogicalResult | setIntelReqdSubGroupSizeAttr (Builder &builder, llvm::MDNode *node, Operation *op) |
Converts the given intel required subgroup size metadata node to an MLIR attribute and attaches it to the imported operation if the translation succeeds. More... | |
Variables | |
static constexpr StringLiteral | vecTypeHintMDName = "vec_type_hint" |
static constexpr StringLiteral | workGroupSizeHintMDName = "work_group_size_hint" |
static constexpr StringLiteral | reqdWorkGroupSizeMDName = "reqd_work_group_size" |
static constexpr StringLiteral | intelReqdSubGroupSizeMDName |
|
static |
Converts the provided metadata node node
to an MLIR DenseI32ArrayAttr if possible.
Definition at line 306 of file LLVMIRToLLVMTranslation.cpp.
References mlir::Builder::getDenseI32ArrayAttr(), and parseIntegerMD().
Referenced by setReqdWorkGroupSizeAttr(), and setWorkGroupSizeHintAttr().
|
static |
Convert an MDNode
to an MLIR IntegerAttr
if possible.
Definition at line 321 of file LLVMIRToLLVMTranslation.cpp.
References mlir::Builder::getI32IntegerAttr(), and parseIntegerMD().
Referenced by setIntelReqdSubGroupSizeAttr().
|
static |
Converts the LLVM intrinsic to an MLIR LLVM dialect operation if a conversion exits.
Returns failure otherwise.
Definition at line 61 of file LLVMIRToLLVMTranslation.cpp.
References isConvertibleIntrinsic().
|
static |
Converts the provided metadata node node
to an LLVM dialect VecTypeHintAttr if possible.
Definition at line 285 of file LLVMIRToLLVMTranslation.cpp.
References mlir::LLVM::ModuleImport::convertType(), mlir::get(), mlir::Builder::getAttr(), and parseIntegerMD().
Referenced by setVecTypeHintAttr().
|
static |
Returns the list of LLVM IR intrinsic identifiers that are convertible to MLIR LLVM dialect intrinsics.
Definition at line 52 of file LLVMIRToLLVMTranslation.cpp.
|
static |
Returns the list of LLVM IR metadata kinds that are convertible to MLIR LLVM dialect attributes.
Definition at line 85 of file LLVMIRToLLVMTranslation.cpp.
References intelReqdSubGroupSizeMDName, reqdWorkGroupSizeMDName, vecTypeHintMDName, and workGroupSizeHintMDName.
|
static |
Returns true if the LLVM IR intrinsic is convertible to an MLIR LLVM dialect intrinsic.
Returns false otherwise.
Definition at line 43 of file LLVMIRToLLVMTranslation.cpp.
Referenced by convertIntrinsicImpl().
|
static |
Extracts an integer from the provided metadata md
if possible.
Returns nullopt otherwise.
Definition at line 271 of file LLVMIRToLLVMTranslation.cpp.
Referenced by convertDenseI32Array(), convertIntegerMD(), and convertVecTypeHint().
|
static |
Looks up all the access group attributes that map to the access group nodes starting from the access group metadata node
, and attaches all of them to the imported operation if the lookups succeed.
Returns failure otherwise.
Definition at line 176 of file LLVMIRToLLVMTranslation.cpp.
References mlir::get(), and mlir::LLVM::ModuleImport::lookupAccessGroupAttrs().
|
static |
Looks up all the alias scope attributes that map to the alias scope nodes starting from the alias scope metadata node
, and attaches all of them to the imported operation if the lookups succeed.
Returns failure otherwise.
Definition at line 233 of file LLVMIRToLLVMTranslation.cpp.
References mlir::get(), and mlir::LLVM::ModuleImport::lookupAliasScopeAttrs().
|
static |
Converts the given dereferenceable metadata node to a dereferenceable attribute, and attaches it to the imported operation if the translation succeeds.
Returns failure if the LLVM IR metadata node is ill-formed.
Definition at line 196 of file LLVMIRToLLVMTranslation.cpp.
References mlir::LLVM::ModuleImport::translateDereferenceableAttr().
|
static |
Converts the given intel required subgroup size metadata node to an MLIR attribute and attaches it to the imported operation if the translation succeeds.
Returns failure otherwise.
Definition at line 376 of file LLVMIRToLLVMTranslation.cpp.
References convertIntegerMD().
|
static |
Converts the given loop metadata node to an MLIR loop annotation attribute and attaches it to the imported operation if the translation succeeds.
Returns failure otherwise.
Definition at line 215 of file LLVMIRToLLVMTranslation.cpp.
References mlir::Operation::getLoc(), and mlir::LLVM::ModuleImport::translateLoopAnnotationAttr().
|
static |
Looks up all the alias scope attributes that map to the alias scope nodes starting from the noalias metadata node
, and attaches all of them to the imported operation if the lookups succeed.
Returns failure otherwise.
Definition at line 252 of file LLVMIRToLLVMTranslation.cpp.
References mlir::get(), and mlir::LLVM::ModuleImport::lookupAliasScopeAttrs().
|
static |
Converts the given profiling metadata node
to an MLIR profiling attribute and attaches it to the imported operation if the translation succeeds.
Returns failure otherwise.
Definition at line 105 of file LLVMIRToLLVMTranslation.cpp.
References mlir::Operation::emitWarning(), and mlir::Builder::getDenseI32ArrayAttr().
|
static |
Definition at line 360 of file LLVMIRToLLVMTranslation.cpp.
References convertDenseI32Array().
|
static |
Searches for the attribute that maps to the given TBAA metadata node
and attaches it to the imported operation if the lookup succeeds.
Returns failure otherwise.
Definition at line 159 of file LLVMIRToLLVMTranslation.cpp.
References mlir::get(), and mlir::LLVM::ModuleImport::lookupTBAAAttr().
|
static |
Definition at line 330 of file LLVMIRToLLVMTranslation.cpp.
References convertVecTypeHint().
|
static |
Definition at line 346 of file LLVMIRToLLVMTranslation.cpp.
References convertDenseI32Array().
|
staticconstexpr |
Definition at line 38 of file LLVMIRToLLVMTranslation.cpp.
Referenced by getSupportedMetadataImpl().
|
staticconstexpr |
Definition at line 37 of file LLVMIRToLLVMTranslation.cpp.
Referenced by getSupportedMetadataImpl().
|
staticconstexpr |
Definition at line 35 of file LLVMIRToLLVMTranslation.cpp.
Referenced by getSupportedMetadataImpl().
|
staticconstexpr |
Definition at line 36 of file LLVMIRToLLVMTranslation.cpp.
Referenced by getSupportedMetadataImpl().