[Mlir-commits] [mlir] [mlir] Add UnitParameter to indicate the presence of a flag (PR #65438)
John Demme
llvmlistbot at llvm.org
Tue Sep 5 21:43:28 PDT 2023
https://github.com/teqdruid created https://github.com/llvm/llvm-project/pull/65438:
A type or attribute parameter which wraps UnitAttr with no printing. Helpful in conjunction with the declarative assembly format's optional parens.
Differential Revision: https://reviews.llvm.org/D159461
>From e162dfbe14a0ffa6550a3bdfcc1a0ca2a0b3c926 Mon Sep 17 00:00:00 2001
From: John Demme <john.demme at microsoft.com>
Date: Wed, 6 Sep 2023 04:31:58 +0000
Subject: [PATCH] [mlir] Add UnitParameter to indicate the presence of a flag
A type or attribute parameter which wraps UnitAttr with no printing. Helpful in
conjunction with the declarative assembly format's optional parens.
Differential Revision: https://reviews.llvm.org/D159461
---
mlir/include/mlir/IR/AttrTypeBase.td | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/mlir/include/mlir/IR/AttrTypeBase.td b/mlir/include/mlir/IR/AttrTypeBase.td
index 3e356373cbd7353..5dff90c7333ffb1 100644
--- a/mlir/include/mlir/IR/AttrTypeBase.td
+++ b/mlir/include/mlir/IR/AttrTypeBase.td
@@ -424,6 +424,14 @@ class AttributeSelfTypeParameter<string desc,
"::mlir::NoneType::get($_ctxt)", typeBuilder);
}
+// Used to indicate the presence of a keyword in asm. Should be used within
+// optional parens in the declarative assembly format.
+def UnitParameter : AttrOrTypeParameter<"::mlir::UnitAttr", "boolean flag"> {
+ let printer = "";
+ let parser = "::mlir::UnitAttr::get($_parser.getContext())";
+ let defaultValue = "::mlir::UnitAttr()";
+}
+
//===----------------------------------------------------------------------===//
// ArrayOfAttr
//===----------------------------------------------------------------------===//
More information about the Mlir-commits
mailing list