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

Christian Ulmann llvmlistbot at llvm.org
Mon Nov 27 23:03:12 PST 2023


================
@@ -261,15 +262,32 @@ 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"> {
----------------
Dinistro wrote:

Ultra nit: Incorrect indentation. 

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


More information about the Mlir-commits mailing list