[Mlir-commits] [llvm] [mlir] [mlir][emitc] Add a ConvertToEmitCPatternInterface for the math dialect (PR #223666)
Jeremy Kun
llvmlistbot at llvm.org
Tue Sep 15 08:57:14 PDT 2026
================
@@ -8,13 +8,30 @@
#include "mlir/Conversion/MathToEmitC/MathToEmitC.h"
+#include "mlir/Conversion/ConvertToEmitC/ToEmitCInterface.h"
#include "mlir/Dialect/EmitC/IR/EmitC.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Transforms/DialectConversion.h"
using namespace mlir;
namespace {
+/// Implement the interface to convert Math to EmitC.
+struct MathToEmitCDialectInterface : public ConvertToEmitCPatternInterface {
+ MathToEmitCDialectInterface(Dialect *dialect)
+ : ConvertToEmitCPatternInterface(dialect) {}
+
+ /// Hook for derived dialect interface to provide conversion patterns
+ /// and mark dialect legal for the conversion target.
----------------
j2kun wrote:
Nit: the comment says "mark dialect legal for the conversion target" (as it does in most of the implementations of this interface) but this operand is unused here and in other interface implementations.
I'd say remove that part of the comment since it doesn't accurately describe what's happening. (If anything, it seems like these methods should mark the dialect _illegal_) Maybe someone more familiar with this interface can comment on the intended behavior.
https://github.com/llvm/llvm-project/pull/223666
More information about the Mlir-commits
mailing list