[Mlir-commits] [mlir] [MLIR][LLVMIR] Add module flags support (PR #130679)
Bruno Cardoso Lopes
llvmlistbot at llvm.org
Fri Mar 14 11:40:19 PDT 2025
================
@@ -1267,4 +1267,29 @@ def WorkgroupAttributionAttr
let assemblyFormat = "`<` $num_elements `,` $element_type `>`";
}
+//===----------------------------------------------------------------------===//
+// ModuleFlagAttr
+//===----------------------------------------------------------------------===//
+
+def ModuleFlagAttr
+ : LLVM_Attr<"ModuleFlag", "mlir.module_flag"> {
+ let summary = "LLVM module flag metadata";
+ let description = [{
+ Represents a single entry of llvm.module.flags metadata
+ (llvm::Module::ModuleFlagEntry in LLVM). The first element is a behavior
+ flag described by `ModFlagBehaviorAttr`, the second is a string ID
+ and third is the value of the flag (currently only integer constant
+ supported).
+
+ Example:
+ ```mlir
+ #llvm.mlir.module_flag<error, "wchar_size", 4>
+ ```
+ }];
+ let parameters = (ins "ModFlagBehavior":$behavior,
+ "StringAttr":$key,
+ "uint32_t":$value);
+ let assemblyFormat = "`<` $behavior `,` $key `,` $value `>`";
----------------
bcardosolopes wrote:
It works but it's more verbose, we'd then get:
`#llvm.mlir.module_flag<behavior = error, key = "wchar_size", value = 4>` (with your suggestions) instead of
`#llvm.mlir.module_flag<error, "wchar_size", 4>` (this PR). I'd go for the more terse, but happy to do any.
https://github.com/llvm/llvm-project/pull/130679
More information about the Mlir-commits
mailing list