================
@@ -759,6 +761,84 @@ def BrCondOp : CIR_Op<"brcond",
   }];
 }
 
+//===----------------------------------------------------------------------===//
+// While & DoWhileOp
+//===----------------------------------------------------------------------===//
+
+class WhileOpBase<string mnemonic> : CIR_Op<mnemonic, [
+  LoopOpInterface,
+  NoRegionArguments,
+]> {
+  defvar isWhile = !eq(mnemonic, "while");
+  let summary = "C/C++ " # !if(isWhile, "while", "do-while") # " loop";
+  let builders = [
+    OpBuilder<(ins "llvm::function_ref<void(mlir::OpBuilder &, 
mlir::Location)>":$condBuilder,
----------------
xlauko wrote:

Other option is to add type alias. Something like `BuilderCallbackRef`.

Then you need to define it before `CIROps.h.inc` is included in `CIRDialect.h`:

```
using BuilderCallbackRef =  llvm::function_ref<void(mlir::OpBuilder &, 
mlir::Location)>;
```

This turned out to be useful in vast on multiple places to make builders more 
readable.

https://github.com/llvm/llvm-project/pull/133157
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to