[flang-commits] [flang] [mlir] [mlir] share argument attributes interface between calls and callables (PR #123176)

Tobias Gysi via flang-commits flang-commits at lists.llvm.org
Sun Jan 26 23:17:38 PST 2025


================
@@ -17,6 +17,48 @@
 
 include "mlir/IR/OpBase.td"
 
+
+/// Interface for operations with arguments attributes (both call-like
+/// and callable operations).
+def ArgumentAttributesMethods {
+  list<InterfaceMethod> methods = [
+    InterfaceMethod<[{
+        Get the array of argument attribute dictionaries. The method should
+        return an array attribute containing only dictionary attributes equal in
+        number to the number of arguments. Alternatively, the method can
+        return null to indicate that the region has no argument attributes.
+      }],
+      "::mlir::ArrayAttr", "getArgAttrsAttr">,
+    InterfaceMethod<[{
+        Get the array of result attribute dictionaries. The method should return
+        an array attribute containing only dictionary attributes equal in number
+        to the number of results. Alternatively, the method can return
+        null to indicate that the region has no result attributes.
----------------
gysit wrote:

```suggestion
        return null to indicate that there are no argument attributes.
      }],
      "::mlir::ArrayAttr", "getArgAttrsAttr">,
    InterfaceMethod<[{
        Get the array of result attribute dictionaries. The method should return
        an array attribute containing only dictionary attributes equal in number
        to the number of results. Alternatively, the method can return
        null to indicate that there are no result attributes.
```
ultra nit: I would probably not mention the region since in case of the call there is none?

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


More information about the flang-commits mailing list