@@ -1438,61 +1438,73 @@ def LLVM_GlobalOp : LLVM_Op<"mlir.global",
14381438
14391439def LLVM_GlobalCtorsOp : LLVM_Op<"mlir.global_ctors", [
14401440 DeclareOpInterfaceMethods<SymbolUserOpInterface>]> {
1441- let arguments = (ins FlatSymbolRefArrayAttr
1442- : $ctors, I32ArrayAttr
1443- : $priorities );
1441+ let arguments = (ins FlatSymbolRefArrayAttr:$ctors,
1442+ I32ArrayAttr:$priorities,
1443+ ArrayAttr:$data );
14441444 let summary = "LLVM dialect global_ctors.";
14451445 let description = [{
1446- Specifies a list of constructor functions and priorities. The functions
1447- referenced by this array will be called in ascending order of priority (i.e.
1448- lowest first) when the module is loaded. The order of functions with the
1449- same priority is not defined. This operation is translated to LLVM's
1450- global_ctors global variable. The initializer functions are run at load
1451- time. The `data` field present in LLVM's global_ctors variable is not
1452- modeled here .
1446+ Specifies a list of constructor functions, priorities, and associated data.
1447+ The functions referenced by this array will be called in ascending order
1448+ of priority (i.e. lowest first) when the module is loaded. The order of
1449+ functions with the same priority is not defined. This operation is
1450+ translated to LLVM's global_ctors global variable. The initializer
1451+ functions are run at load time. However, if the associated data is not
1452+ `#llvm.zero`, functions only run if the data is not discarded .
14531453
14541454 Examples:
14551455
14561456 ```mlir
1457- llvm.mlir.global_ctors {@ctor}
1458-
14591457 llvm.func @ctor() {
14601458 ...
14611459 llvm.return
14621460 }
1461+ llvm.mlir.global_ctors ctors = [@ctor], priorities = [0],
1462+ data = [#llvm.zero]
14631463 ```
14641464
14651465 }];
1466- let assemblyFormat = "attr-dict";
1466+ let assemblyFormat = [{
1467+ `ctors` `=` $ctors
1468+ `,` `priorities` `=` $priorities
1469+ `,` `data` `=` $data
1470+ attr-dict
1471+ }];
14671472 let hasVerifier = 1;
14681473}
14691474
14701475def LLVM_GlobalDtorsOp : LLVM_Op<"mlir.global_dtors", [
14711476 DeclareOpInterfaceMethods<SymbolUserOpInterface>]> {
14721477 let arguments = (ins
14731478 FlatSymbolRefArrayAttr:$dtors,
1474- I32ArrayAttr:$priorities
1479+ I32ArrayAttr:$priorities,
1480+ ArrayAttr:$data
14751481 );
14761482 let summary = "LLVM dialect global_dtors.";
14771483 let description = [{
14781484 Specifies a list of destructor functions and priorities. The functions
1479- referenced by this array will be called in descending order of priority (i.e.
1480- highest first) when the module is unloaded. The order of functions with the
1481- same priority is not defined. This operation is translated to LLVM's
1482- global_dtors global variable. The `data` field present in LLVM's
1483- global_dtors variable is not modeled here.
1485+ referenced by this array will be called in descending order of priority
1486+ (i.e. highest first) when the module is unloaded. The order of functions
1487+ with the same priority is not defined. This operation is translated to
1488+ LLVM's global_dtors global variable. The destruction functions are run at
1489+ load time. However, if the associated data is not `#llvm.zero`, functions
1490+ only run if the data is not discarded.
14841491
14851492 Examples:
14861493
14871494 ```mlir
14881495 llvm.func @dtor() {
14891496 llvm.return
14901497 }
1491- llvm.mlir.global_dtors {@dtor}
1498+ llvm.mlir.global_dtors dtors = [@dtor], priorities = [0],
1499+ data = [#llvm.zero]
14921500 ```
1493-
14941501 }];
1495- let assemblyFormat = "attr-dict";
1502+ let assemblyFormat = [{
1503+ `dtors` `=` $dtors
1504+ `,` `priorities` `=` $priorities
1505+ `,` `data` `=` $data
1506+ attr-dict
1507+ }];
14961508 let hasVerifier = 1;
14971509}
14981510
0 commit comments