[Mlir-commits] [mlir] [mlir][emitc] Add a structured for operation (PR #68206)
Simon Camphausen
llvmlistbot at llvm.org
Wed Oct 25 07:01:42 PDT 2023
================
@@ -246,6 +246,67 @@ def EmitC_DivOp : EmitC_BinaryOp<"div", []> {
let results = (outs FloatIntegerIndexOrOpaqueType);
}
+def EmitC_ForOp : EmitC_Op<"for",
+ [AllTypesMatch<["lowerBound", "upperBound", "step"]>,
+ SingleBlockImplicitTerminator<"emitc::YieldOp">,
+ RecursiveMemoryEffects]> {
+ let summary = "for operation";
+ let description = [{
+ The `emitc.for` operation represents a C loop of the following form:
+
+ ```c++
+ for (size_t i = lb; i < ub; i += step) { /* ... */ }
----------------
simon-camp wrote:
nit: This is not always a size_t
```suggestion
for (T i = lb; i < ub; i += step) { /* ... */ } // where T is typeof(lb)
```
https://github.com/llvm/llvm-project/pull/68206
More information about the Mlir-commits
mailing list