[Mlir-commits] [mlir] [mlir][emitc] Add increment and decrement ops (PR #208648)

Jianjian Guan llvmlistbot at llvm.org
Mon Jul 13 19:10:36 PDT 2026


================
@@ -65,6 +65,39 @@ class EmitC_BinaryOp<string mnemonic, list<Trait> traits = []> :
   }];
 }
 
+// Base class for increment and decrement operations.
+class EmitC_IncDecOp<string mnemonic, string summaryStr>
+    : EmitC_Op<mnemonic, [
+        CExpressionInterface,
+        TypesMatchWith<"input and result reference the same type",
+                       "operand", "result",
+                       "::llvm::cast<emitc::LValueType>($_self).getValueType()">
+      ]> {
+  let summary = summaryStr;
+  let description = [{
+    This operation models a C/C++ increment or decrement operator on an lvalue.
+
+    Example:
+
+    ```mlir
+    %0 = emitc.pre_increment %arg0 : !emitc.lvalue<i32>
----------------
jacquesguan wrote:

Addressed.

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


More information about the Mlir-commits mailing list