@@ -1322,7 +1322,7 @@ def LLVM_DereferenceableAttr : LLVM_Attr<"Dereferenceable", "dereferenceable"> {
1322
1322
}
1323
1323
1324
1324
//===----------------------------------------------------------------------===//
1325
- // ModuleFlagAttr
1325
+ // ModuleFlagAttr & related
1326
1326
//===----------------------------------------------------------------------===//
1327
1327
1328
1328
def ModuleFlagAttr
@@ -1332,14 +1332,22 @@ def ModuleFlagAttr
1332
1332
Represents a single entry of llvm.module.flags metadata
1333
1333
(llvm::Module::ModuleFlagEntry in LLVM). The first element is a behavior
1334
1334
flag described by `ModFlagBehaviorAttr`, the second is a string ID
1335
- and third is the value of the flag. Current supported types of values:
1336
- - Integer constants
1337
- - Strings
1335
+ and third is the value of the flag. Supported keys and values include:
1336
+ - Arbitrary `key`s holding integer constants or strings.
1337
+ - Domain specific keys (e.g "CG Profile"), holding lists of supported
1338
+ module flag values (e.g. `llvm.cgprofile_entry`).
1338
1339
1339
1340
Example:
1340
1341
```mlir
1341
- #llvm.mlir.module_flag<error, "wchar_size", 4>
1342
- #llvm.mlir.module_flag<error, "probe-stack", "inline-asm">
1342
+ llvm.module_flags [
1343
+ #llvm.mlir.module_flag<error, "wchar_size", 4>,
1344
+ #llvm.mlir.module_flag<error, "probe-stack", "inline-asm">,
1345
+ #llvm.mlir.module_flag<append, "CG Profile", [
1346
+ #llvm.cgprofile_entry<from = @from, to = @to, count = 222>,
1347
+ #llvm.cgprofile_entry<from = @from, to = @from, count = 222>,
1348
+ #llvm.cgprofile_entry<from = @to, to = @from, count = 222>
1349
+ ]
1350
+ >]
1343
1351
```
1344
1352
}];
1345
1353
let parameters = (ins "ModFlagBehavior":$behavior,
@@ -1349,6 +1357,25 @@ def ModuleFlagAttr
1349
1357
let genVerifyDecl = 1;
1350
1358
}
1351
1359
1360
+ def ModuleFlagCGProfileEntryAttr
1361
+ : LLVM_Attr<"ModuleFlagCGProfileEntry", "cgprofile_entry"> {
1362
+ let summary = "CG profile module flag entry";
1363
+ let description = [{
1364
+ Describes a single entry for a CG profile module flag. Example:
1365
+ ```mlir
1366
+ llvm.module_flags [
1367
+ #llvm.mlir.module_flag<append, "CG Profile",
1368
+ [#llvm.cgprofile_entry<from = @from, to = @to, count = 222>,
1369
+ ...
1370
+ ]>]
1371
+ ```
1372
+ }];
1373
+ let parameters = (ins "FlatSymbolRefAttr":$from,
1374
+ "FlatSymbolRefAttr":$to,
1375
+ "uint64_t":$count);
1376
+ let assemblyFormat = "`<` struct(params) `>`";
1377
+ }
1378
+
1352
1379
//===----------------------------------------------------------------------===//
1353
1380
// LLVM_DependentLibrariesAttr
1354
1381
//===----------------------------------------------------------------------===//
0 commit comments