[Mlir-commits] [mlir] [mlir][emitc] make CExpression trait into interface (PR #142771)

Simon Camphausen llvmlistbot at llvm.org
Mon Jun 16 03:41:23 PDT 2025


================
@@ -103,7 +113,7 @@ def EmitC_FileOp
   let skipDefaultBuilders = 1;
 }
 
-def EmitC_AddOp : EmitC_BinaryOp<"add", [CExpression]> {
+def EmitC_AddOp : EmitC_BinaryOp<"add", [CExpressionInterface]> {
----------------
simon-camp wrote:

I would append the interface to the trait list in EmitC_BinaryOp/EmitC_UnaryOp with something like
```
class EmitC_BinaryOp<string mnemonic, list<Trait> traits = []> :
    EmitC_Op<mnemonic, !listconcat(traits, [CExpressionInterface]> {
```

and remove it here, so that the interface declaration and implementation are at the same place in the tablegen file.


```suggestion
def EmitC_AddOp : EmitC_BinaryOp<"add", []> {
```

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


More information about the Mlir-commits mailing list