[Mlir-commits] [mlir] [mlir] Add support for DIGlobalVariable and DIGlobalVariableExpression (PR #73367)

Tobias Gysi llvmlistbot at llvm.org
Thu Nov 30 23:46:54 PST 2023


================
@@ -261,15 +262,35 @@ def LLVM_DITagParameter : LLVM_DIParameter<
   "tag", /*default=*/"", "Tag"
 >;
 
+def LLVM_DIExpressionOpcodeParameter : LLVM_DIParameter<
+  "operation encoding", /*default=*/"", "OperationEncoding"
+>;
+
 //===----------------------------------------------------------------------===//
 // DIExpressionAttr
 //===----------------------------------------------------------------------===//
 
-// TODO: Implement custom printer/parser for elements so that operators are
-// dumped in textual form.
-def LLVM_DIExpressionAttr : ArrayOfAttr<LLVM_Dialect, "DIExpression",
-                                        "di_expr", "uint64_t"> {
-  let assemblyFormat = "`<` `[` (`]` `>`) : ($value^ `]` `>`)?";
+def LLVM_DIExpressionElemAttr : LLVM_Attr<"DIExpressionElem",
+                                          "di_expression_elem"> {
+  let parameters = (ins
+    LLVM_DIExpressionOpcodeParameter:$opcode,
+    OptionalArrayRefParameter<"uint64_t">:$arguments);
+  let assemblyFormat = [{
+    `` $opcode ( `(` custom<ExpressionArg>(ref($opcode), $arguments)^ `)` ) : (``)?
+  }];
+}
+
+def LLVM_DIExpressionAttr : LLVM_Attr<"DIExpression", "di_expression",
+                                      /*traits=*/[], "DINodeAttr"> {
----------------
gysit wrote:

```suggestion
                                      > {
```
If we follow the LLVM class diagram we could skip the base class here?

https://github.com/llvm/llvm-project/pull/73367


More information about the Mlir-commits mailing list