[Mlir-commits] [mlir] [MLIR] emitc: Add emitc.file op (PR #123298)

Marius Brehler llvmlistbot at llvm.org
Tue Feb 4 02:09:55 PST 2025


================
@@ -56,6 +57,51 @@ def IntegerIndexOrOpaqueType : Type<CPred<"emitc::isIntegerIndexOrOpaqueType($_s
 "integer, index or opaque type supported by EmitC">;
 def FloatIntegerIndexOrOpaqueType : AnyTypeOf<[EmitCFloatType, IntegerIndexOrOpaqueType]>;
 
+def EmitC_FileOp
+    : EmitC_Op<"file", [IsolatedFromAbove, NoRegionArguments, SymbolTable,
+                        OpAsmOpInterface]#GraphRegionNoTerminator.traits> {
+  let summary = "A file container operation";
+  let description = [{
+    A `file` represents a single C/C++ file.
+
+    `mlir-translate` emits only the file selected via
+    the `-translation-unit-id=id` flag. By default, no file is emitted.
----------------
marbre wrote:

```suggestion
    Everything scoped in an `emitc.file` op is only emitted by `mlir-translate`
    if selected via the `-file-id=id` flag.
```
Thanks for clarifying. Maybe we should rephrase to the suggestion above? I think it might be confusing to a user as one might ask "What happens if I don't specify an emitc.file at all? Is something emitted?" Anyway, `-translation-unit` must be `-file-id` so at least on of the suggestions should be applied.


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


More information about the Mlir-commits mailing list