@@ -1322,7 +1322,7 @@ def LLVM_DereferenceableAttr : LLVM_Attr<"Dereferenceable", "dereferenceable"> {
13221322}
13231323
13241324//===----------------------------------------------------------------------===//
1325- // ModuleFlagAttr
1325+ // ModuleFlagAttr & related
13261326//===----------------------------------------------------------------------===//
13271327
13281328def ModuleFlagAttr
@@ -1332,14 +1332,22 @@ def ModuleFlagAttr
13321332 Represents a single entry of llvm.module.flags metadata
13331333 (llvm::Module::ModuleFlagEntry in LLVM). The first element is a behavior
13341334 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`).
13381339
13391340 Example:
13401341 ```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+ >]
13431351 ```
13441352 }];
13451353 let parameters = (ins "ModFlagBehavior":$behavior,
@@ -1349,6 +1357,25 @@ def ModuleFlagAttr
13491357 let genVerifyDecl = 1;
13501358}
13511359
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+
13521379//===----------------------------------------------------------------------===//
13531380// LLVM_DependentLibrariesAttr
13541381//===----------------------------------------------------------------------===//
0 commit comments