From 0a129ae7e45114a08f281e50632b9f967fae8396 Mon Sep 17 00:00:00 2001 From: William Moses Date: Thu, 7 Mar 2024 12:27:46 -0800 Subject: [PATCH] MLIR add postop tablegen helper (#1783) --- enzyme/Enzyme/MLIR/Implementations/Common.td | 3 ++- enzyme/tools/enzyme-tblgen/enzyme-tblgen.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/enzyme/Enzyme/MLIR/Implementations/Common.td b/enzyme/Enzyme/MLIR/Implementations/Common.td index 099e614b8bcd..34f44944af40 100644 --- a/enzyme/Enzyme/MLIR/Implementations/Common.td +++ b/enzyme/Enzyme/MLIR/Implementations/Common.td @@ -80,9 +80,10 @@ class GlobalExpr : Operation : Operation { +class Inst : Operation { string name = mnemonic; string dialect = dialect_; + string postop = postop_; } def Op { diff --git a/enzyme/tools/enzyme-tblgen/enzyme-tblgen.cpp b/enzyme/tools/enzyme-tblgen/enzyme-tblgen.cpp index 485af7868a70..fc47183b548f 100644 --- a/enzyme/tools/enzyme-tblgen/enzyme-tblgen.cpp +++ b/enzyme/tools/enzyme-tblgen/enzyme-tblgen.cpp @@ -922,6 +922,10 @@ bool handle(const Twine &curIndent, const Twine &argPattern, raw_ostream &os, if (isCall || isIntr) os << "})"; os << ")"; + if (intrinsic == MLIRDerivatives) { + auto postop = Def->getValueAsString("postop"); + os << postop; + } if (isCall) { os << ")"; }