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

Gil Rapaport llvmlistbot at llvm.org
Fri Jan 17 10:31:32 PST 2025


aniragil wrote:

> > Quick question before having a change to take a deeper look. Would it make sense to introduce an `emitc.module` instead of an `emitc.tu`? Only referring to the naming here.
> 
> I don't mind the naming. In practice, we use a structure like
> 
> ```
> module {
>   emitc.tu {
>    func ...
>   }
>   emitc.tu {
>    func ...
>   }
> }
> ```
> 
> and I liked that the `emitc.tu` was visually different from the enclosing `module`. But both is fine for me.

At least in C99, "translation unit" seems to refer to the output of the preprocessor, i.e. the source file after all preprocessing directives have been expanded. As emitc supports emitting preprocessing directives, notably `#include` statements, using this term might be misleading. The standard's term for the file keeping the user's source code seems to be "source file" / "preprocessing file", so `emitc.source_file` / `emitc.source` might be more accurate.

As C++20 defined a C++ `module` construct, `emitc.module` may be conflicting / misleading as well.


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


More information about the Mlir-commits mailing list