MLIR  20.0.0git
Public Member Functions | List of all members
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. More...
 
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. More...
 
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. More...
 
virtual ArrayRef< unsigned > getSupportedIntrinsics () const
 Hook for derived dialect interfaces to publish the supported intrinsics. More...
 
virtual ArrayRef< unsigned > getSupportedInstructions () const
 Hook for derived dialect interfaces to publish the supported instructions. More...
 
virtual ArrayRef< unsigned > getSupportedMetadata (llvm::LLVMContext &ctx) const
 Hook for derived dialect interfaces to publish the supported metadata kinds. More...
 

Additional Inherited Members

- Public Types inherited from mlir::detail::DialectInterfaceBase< ConcreteType, BaseT >
using Base = DialectInterfaceBase< ConcreteType, BaseT >
 
- Static Public Member Functions inherited from mlir::detail::DialectInterfaceBase< ConcreteType, BaseT >
static TypeID getInterfaceID ()
 Get a unique id for the derived interface type. More...
 
- Protected Member Functions inherited from mlir::detail::DialectInterfaceBase< ConcreteType, BaseT >
 DialectInterfaceBase (Dialect *dialect)
 

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.

◆ 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.


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