[Mlir-commits] [mlir] [mlir] Add `convertInstruction` and `getSupportedInstructions` to `LLVMImportInterface` (PR #86799)
Christian Ulmann
llvmlistbot at llvm.org
Wed Mar 27 07:05:33 PDT 2024
================
@@ -123,12 +123,16 @@ static SmallVector<int64_t> getPositionFromIndices(ArrayRef<unsigned> indices) {
/// access to the private module import methods.
static LogicalResult convertInstructionImpl(OpBuilder &odsBuilder,
llvm::Instruction *inst,
- ModuleImport &moduleImport) {
+ ModuleImport &moduleImport,
+ LLVMImportInterface &importIface) {
// Copy the operands to an LLVM operands array reference for conversion.
SmallVector<llvm::Value *> operands(inst->operands());
ArrayRef<llvm::Value *> llvmOperands(operands);
// Convert all instructions that provide an MLIR builder.
+ if (importIface.isConvertibleInstruction(inst->getOpcode()))
+ return importIface.convertInstruction(odsBuilder, inst, llvmOperands,
+ moduleImport);
#include "mlir/Dialect/LLVMIR/LLVMOpFromLLVMIRConversions.inc"
----------------
Dinistro wrote:
I guess we could eventually add this include of TableGen files into the interface of the LLVM dialect, but this can be a followup to this change and does not need to be done by you.
Maybe adding a todo might be a good idea, though.
https://github.com/llvm/llvm-project/pull/86799
More information about the Mlir-commits
mailing list