[Mlir-commits] [mlir] [mlir][Interfaces][NFC] LoopLikeOpInterface: Consistent TD formatting (PR #66097)

Matthias Springer llvmlistbot at llvm.org
Tue Sep 12 08:11:56 PDT 2023


https://github.com/matthias-springer created https://github.com/llvm/llvm-project/pull/66097:

Format the interface methods consistently in the TableGen file.

>From 0e10302ac2e4cca1b93002f85da85c92fc7dfdfe Mon Sep 17 00:00:00 2001
From: Matthias Springer <me at m-sp.org>
Date: Tue, 12 Sep 2023 17:11:15 +0200
Subject: [PATCH] [mlir][Interfaces][NFC] LoopLikeOpInterface: Consistent TD
 formatting

Format the interface methods consistently in the TableGen file.
---
 .../mlir/Interfaces/LoopLikeInterface.td      | 23 ++++++++++++-------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/mlir/include/mlir/Interfaces/LoopLikeInterface.td b/mlir/include/mlir/Interfaces/LoopLikeInterface.td
index a88d7e45e5d67f0..9ccc97251e7e669 100644
--- a/mlir/include/mlir/Interfaces/LoopLikeInterface.td
+++ b/mlir/include/mlir/Interfaces/LoopLikeInterface.td
@@ -17,8 +17,9 @@ include "mlir/IR/OpBase.td"
 
 def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
   let description = [{
-    Encodes properties of a loop. Operations that implement this interface will
-    be considered by loop-invariant code motion.
+    Contains helper functions to query properties and perform transformations
+    of a loop. Operations that implement this interface will be considered by
+    loop-invariant code motion.
   }];
   let cppNamespace = "::mlir";
 
@@ -30,7 +31,11 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
         explicit capture of dependencies, an implementation could check whether
         the value corresponds to a captured dependency.
       }],
-      "bool", "isDefinedOutsideOfLoop", (ins "::mlir::Value ":$value), [{}], [{
+      /*retTy=*/"bool",
+      /*methodName=*/"isDefinedOutsideOfLoop",
+      /*args=*/(ins "::mlir::Value ":$value),
+      /*methodBody=*/"",
+      /*defaultImplementation=*/[{
         return value.getParentRegion()->isProperAncestor(&$_op.getLoopBody());
       }]
     >,
@@ -38,15 +43,17 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
         Returns the region that makes up the body of the loop and should be
         inspected for loop-invariant operations.
       }],
-      "::mlir::Region &", "getLoopBody"
+      /*retTy=*/"::mlir::Region &",
+      /*methodName=*/"getLoopBody"
     >,
     InterfaceMethod<[{
         Moves the given loop-invariant operation out of the loop.
       }],
-      "void", "moveOutOfLoop",
-      (ins "::mlir::Operation *":$op), [{}], [{
-        op->moveBefore($_op);
-      }]
+      /*retTy=*/"void",
+      /*methodName=*/"moveOutOfLoop",
+      /*args=*/(ins "::mlir::Operation *":$op),
+      /*methodBody=*/"",
+      /*defaultImplementation=*/"op->moveBefore($_op);"
     >,
     InterfaceMethod<[{
         Promotes the loop body to its containing block if the loop is known to



More information about the Mlir-commits mailing list