[Mlir-commits] [mlir] [MLIR][LLVMIR] Add module flags support (PR #130679)
Tobias Gysi
llvmlistbot at llvm.org
Fri Mar 14 12:06:24 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 `>`";
----------------
gysit wrote:
Ah right. There is precedence for both formats so feel free to go with the short format.
https://github.com/llvm/llvm-project/pull/130679
More information about the Mlir-commits
mailing list