MLIR
20.0.0git
|
Interface collection for the import of LLVM IR that dispatches to a concrete dialect interface implementation. More...
#include "mlir/Target/LLVMIR/LLVMImportInterface.h"
Public Member Functions | |
LogicalResult | initializeImport (llvm::LLVMContext &llvmContext) |
Queries all registered dialect interfaces for the supported LLVM IR intrinsic and metadata kinds and builds the dispatch tables for the conversion. More... | |
LogicalResult | convertIntrinsic (OpBuilder &builder, llvm::CallInst *inst, LLVM::ModuleImport &moduleImport) const |
Converts the LLVM intrinsic to an MLIR operation if a conversion exists. More... | |
bool | isConvertibleIntrinsic (llvm::Intrinsic::ID id) |
Returns true if the given LLVM IR intrinsic is convertible to an MLIR operation. More... | |
LogicalResult | convertInstruction (OpBuilder &builder, llvm::Instruction *inst, ArrayRef< llvm::Value * > llvmOperands, LLVM::ModuleImport &moduleImport) const |
Converts the LLVM instruction to an MLIR operation if a conversion exists. More... | |
bool | isConvertibleInstruction (unsigned id) |
Returns true if the given LLVM IR instruction is convertible to an MLIR operation. More... | |
LogicalResult | setMetadataAttrs (OpBuilder &builder, unsigned kind, llvm::MDNode *node, Operation *op, LLVM::ModuleImport &moduleImport) const |
Attaches the given LLVM metadata to the imported operation if a conversion to one or more MLIR dialect attributes exists and succeeds. More... | |
bool | isConvertibleMetadata (unsigned kind) |
Returns true if the given LLVM IR metadata is convertible to an MLIR attribute. More... | |
Public Member Functions inherited from mlir::DialectInterfaceCollection< LLVMImportDialectInterface > | |
DialectInterfaceCollection (MLIRContext *ctx) | |
Collect the registered dialect interfaces within the provided context. More... | |
const LLVMImportDialectInterface * | getInterfaceFor (Object *obj) const |
Get the interface for a given object, or null if one is not registered. More... | |
iterator | begin () const |
iterator | end () const |
Public Member Functions inherited from mlir::detail::DialectInterfaceCollectionBase | |
DialectInterfaceCollectionBase (MLIRContext *ctx, TypeID interfaceKind, StringRef interfaceName) | |
virtual | ~DialectInterfaceCollectionBase () |
Additional Inherited Members | |
Public Types inherited from mlir::DialectInterfaceCollection< LLVMImportDialectInterface > | |
using | Base = DialectInterfaceCollection< LLVMImportDialectInterface > |
using | iterator = detail::DialectInterfaceCollectionBase::iterator< LLVMImportDialectInterface > |
Iterator access to the held interfaces. More... | |
Protected Member Functions inherited from mlir::detail::DialectInterfaceCollectionBase | |
const DialectInterface * | getInterfaceFor (Operation *op) const |
Get the interface for the dialect of given operation, or null if one is not registered. More... | |
const DialectInterface * | getInterfaceFor (Dialect *dialect) const |
Get the interface for the given dialect. More... | |
template<typename InterfaceT > | |
iterator< InterfaceT > | interface_begin () const |
Iterator access to the held interfaces. More... | |
template<typename InterfaceT > | |
iterator< InterfaceT > | interface_end () const |
Interface collection for the import of LLVM IR that dispatches to a concrete dialect interface implementation.
Queries the dialect interfaces to obtain a list of the supported LLVM IR constructs and then builds a mapping for the efficient dispatch.
Definition at line 99 of file LLVMImportInterface.h.
|
inline |
Converts the LLVM instruction to an MLIR operation if a conversion exists.
Returns failure otherwise.
Definition at line 176 of file LLVMImportInterface.h.
References mlir::LLVMImportDialectInterface::convertInstruction().
Referenced by convertInstructionImpl().
|
inline |
Converts the LLVM intrinsic to an MLIR operation if a conversion exists.
Returns failure otherwise.
Definition at line 155 of file LLVMImportInterface.h.
References mlir::LLVMImportDialectInterface::convertIntrinsic(), and mlir::DialectInterfaceCollection< LLVMImportDialectInterface >::getInterfaceFor().
|
inline |
Queries all registered dialect interfaces for the supported LLVM IR intrinsic and metadata kinds and builds the dispatch tables for the conversion.
Returns failure if multiple dialect interfaces translate the same LLVM IR intrinsic.
Definition at line 108 of file LLVMImportInterface.h.
References mlir::emitError(), mlir::get(), mlir::LLVMImportDialectInterface::getSupportedInstructions(), mlir::LLVMImportDialectInterface::getSupportedIntrinsics(), and mlir::LLVMImportDialectInterface::getSupportedMetadata().
Referenced by mlir::LLVM::ModuleImport::initializeImportInterface().
|
inline |
Returns true if the given LLVM IR instruction is convertible to an MLIR operation.
Definition at line 190 of file LLVMImportInterface.h.
Referenced by convertInstructionImpl().
|
inline |
Returns true if the given LLVM IR intrinsic is convertible to an MLIR operation.
Definition at line 170 of file LLVMImportInterface.h.
Referenced by mlir::LLVM::ModuleImport::processFunction().
|
inline |
Returns true if the given LLVM IR metadata is convertible to an MLIR attribute.
Definition at line 222 of file LLVMImportInterface.h.
Referenced by mlir::LLVM::ModuleImport::processFunction().
|
inline |
Attaches the given LLVM metadata to the imported operation if a conversion to one or more MLIR dialect attributes exists and succeeds.
Returns success if at least one of the conversions is successful and failure if all of them fail.
Definition at line 198 of file LLVMImportInterface.h.
References mlir::DialectInterfaceCollection< LLVMImportDialectInterface >::getInterfaceFor(), and mlir::LLVMImportDialectInterface::setMetadataAttrs().
Referenced by mlir::LLVM::ModuleImport::processFunction().