MLIR 22.0.0git
mlir::LLVMImportDialectInterface Class Reference

Base class for dialect interfaces used to import LLVM IR. More...

#include "mlir/Target/LLVMIR/LLVMImportInterface.h"

Inheritance diagram for mlir::LLVMImportDialectInterface:

Public Member Functions

 LLVMImportDialectInterface (Dialect *dialect)
virtual LogicalResult convertIntrinsic (OpBuilder &builder, llvm::CallInst *inst, LLVM::ModuleImport &moduleImport) const
 Hook for derived dialect interfaces to implement the import of intrinsics into MLIR.
virtual LogicalResult convertInstruction (OpBuilder &builder, llvm::Instruction *inst, ArrayRef< llvm::Value * > llvmOperands, LLVM::ModuleImport &moduleImport) const
 Hook for derived dialect interfaces to implement the import of instructions into MLIR.
virtual LogicalResult setMetadataAttrs (OpBuilder &builder, unsigned kind, llvm::MDNode *node, Operation *op, LLVM::ModuleImport &moduleImport) const
 Hook for derived dialect interfaces to implement the import of metadata into MLIR.
virtual ArrayRef< unsignedgetSupportedIntrinsics () const
 Hook for derived dialect interfaces to publish the supported intrinsics.
virtual ArrayRef< unsignedgetSupportedInstructions () const
 Hook for derived dialect interfaces to publish the supported instructions.
virtual ArrayRef< unsignedgetSupportedMetadata (llvm::LLVMContext &ctx) const
 Hook for derived dialect interfaces to publish the supported metadata kinds.
Public Member Functions inherited from mlir::DialectInterface
virtual ~DialectInterface ()
DialectgetDialect () const
 Return the dialect that this interface represents.
MLIRContextgetContext () const
 Return the context that holds the parent dialect of this interface.
TypeID getID () const
 Return the derived interface id.

Additional Inherited Members

Public Types inherited from mlir::detail::DialectInterfaceBase< ConcreteType, DialectInterface >
using Base
Public Types inherited from mlir::DialectInterface
template<typename ConcreteType>
using Base = detail::DialectInterfaceBase<ConcreteType, DialectInterface>
 The base class used for all derived interface types.
Static Public Member Functions inherited from mlir::detail::DialectInterfaceBase< ConcreteType, DialectInterface >
static TypeID getInterfaceID ()
 Get a unique id for the derived interface type.
Protected Member Functions inherited from mlir::detail::DialectInterfaceBase< ConcreteType, DialectInterface >
 DialectInterfaceBase (Dialect *dialect)
Protected Member Functions inherited from mlir::DialectInterface
 DialectInterface (Dialect *dialect, TypeID id)

Detailed Description

Base class for dialect interfaces used to import LLVM IR.

Dialects that can be imported should provide an implementation of this interface for the supported intrinsics. The interface may be implemented in a separate library to avoid the "main" dialect library depending on LLVM IR. The interface can be attached using the delayed registration mechanism available in DialectRegistry.

Definition at line 41 of file LLVMImportInterface.h.

Constructor & Destructor Documentation

◆ LLVMImportDialectInterface()

mlir::LLVMImportDialectInterface::LLVMImportDialectInterface ( Dialect * dialect)
inline

Definition at line 44 of file LLVMImportInterface.h.

Member Function Documentation

◆ convertInstruction()

virtual LogicalResult mlir::LLVMImportDialectInterface::convertInstruction ( OpBuilder & builder,
llvm::Instruction * inst,
ArrayRef< llvm::Value * > llvmOperands,
LLVM::ModuleImport & moduleImport ) const
inlinevirtual

Hook for derived dialect interfaces to implement the import of instructions into MLIR.

Definition at line 57 of file LLVMImportInterface.h.

Referenced by mlir::LLVMImportInterface::convertInstruction().

◆ convertIntrinsic()

virtual LogicalResult mlir::LLVMImportDialectInterface::convertIntrinsic ( OpBuilder & builder,
llvm::CallInst * inst,
LLVM::ModuleImport & moduleImport ) const
inlinevirtual

Hook for derived dialect interfaces to implement the import of intrinsics into MLIR.

Definition at line 49 of file LLVMImportInterface.h.

Referenced by mlir::LLVMImportInterface::convertIntrinsic().

◆ getSupportedInstructions()

virtual ArrayRef< unsigned > mlir::LLVMImportDialectInterface::getSupportedInstructions ( ) const
inlinevirtual

Hook for derived dialect interfaces to publish the supported instructions.

As every LLVM IR instruction has a unique integer identifier, the function returns the list of supported instruction identifiers. These identifiers will then be used to match LLVM instructions to the appropriate import interface and convertInstruction method. It is an error to have multiple interfaces overriding the same instruction.

Definition at line 83 of file LLVMImportInterface.h.

Referenced by mlir::LLVMImportInterface::initializeImport().

◆ getSupportedIntrinsics()

virtual ArrayRef< unsigned > mlir::LLVMImportDialectInterface::getSupportedIntrinsics ( ) const
inlinevirtual

Hook for derived dialect interfaces to publish the supported intrinsics.

As every LLVM IR intrinsic has a unique integer identifier, the function returns the list of supported intrinsic identifiers.

Definition at line 75 of file LLVMImportInterface.h.

Referenced by mlir::LLVMImportInterface::initializeImport().

◆ getSupportedMetadata()

virtual ArrayRef< unsigned > mlir::LLVMImportDialectInterface::getSupportedMetadata ( llvm::LLVMContext & ctx) const
inlinevirtual

Hook for derived dialect interfaces to publish the supported metadata kinds.

As every metadata kind has a unique integer identifier, the function returns the list of supported metadata identifiers. ctx can be used to obtain IDs of metadata kinds that do not have a fixed static one.

Definition at line 90 of file LLVMImportInterface.h.

Referenced by mlir::LLVMImportInterface::initializeImport().

◆ setMetadataAttrs()

virtual LogicalResult mlir::LLVMImportDialectInterface::setMetadataAttrs ( OpBuilder & builder,
unsigned kind,
llvm::MDNode * node,
Operation * op,
LLVM::ModuleImport & moduleImport ) const
inlinevirtual

Hook for derived dialect interfaces to implement the import of metadata into MLIR.

Attaches the converted metadata kind and node to the provided operation.

Definition at line 67 of file LLVMImportInterface.h.

Referenced by mlir::LLVMImportInterface::setMetadataAttrs().


The documentation for this class was generated from the following file: