[Mlir-commits] [mlir] [mlir] Enable setting alias on AsmState. (PR #153776)

Jacques Pienaar llvmlistbot at llvm.org
Tue Aug 19 04:19:06 PDT 2025


================
@@ -560,6 +560,15 @@ class AsmState {
            FallbackAsmResourceMap *map = nullptr);
   ~AsmState();
 
+  /// Add an alias for the given attribute. The alias will be used as a
+  /// suggestion when printing. The final alias may be modified to resolve
+  /// conflicts.
+  void addAlias(Attribute attr, StringRef alias);
+
+  /// Add an alias for the given type. The alias will be used as a suggestion
+  /// when printing. The final alias may be modified to resolve conflicts.
+  void addAlias(Type type, StringRef alias);
+
----------------
jpienaar wrote:

Correct. Now I can make it so :) (which would remove it from API here). And that is by way of adding something like a alias attribute to the top level op - which is just a dictionary attribute of name & attribute. So the printer can query if attribute on op being printed and then populate as here. This would most likely be a discardable attribute though and (downside) would fix a naming convention. E.g., if op has certain named attribute ("attribute_type_alias_map" ? something not likely to be in use already and self-documenting) of dictionary attr kind, then use it. Probably nicer, more composable but at cost of convention.

https://github.com/llvm/llvm-project/pull/153776


More information about the Mlir-commits mailing list