//===- ToLLVMInterface.h - Conversion to LLVM iface ---*- C++ -*-=============// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef MLIR_CONVERSION_CONVERTTOLLVM_TOLLVMINTERFACE_H #define MLIR_CONVERSION_CONVERTTOLLVM_TOLLVMINTERFACE_H #include "mlir/IR/DialectInterface.h" #include "mlir/IR/MLIRContext.h" namespace mlir { class ConversionTarget; class LLVMTypeConverter; class MLIRContext; class Operation; class RewritePatternSet; /// Base class for dialect interfaces providing translation to LLVM IR. /// Dialects that can be translated should provide an implementation of this /// interface for the supported operations. 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. class ConvertToLLVMPatternInterface : public DialectInterface::Base<ConvertToLLVMPatternInterface> { … }; /// Recursively walk the IR and collect all dialects implementing the interface, /// and populate the conversion patterns. void populateConversionTargetFromOperation(Operation *op, ConversionTarget &target, LLVMTypeConverter &typeConverter, RewritePatternSet &patterns); } // namespace mlir #endif // MLIR_CONVERSION_CONVERTTOLLVM_TOLLVMINTERFACE_H