[all-commits] [llvm/llvm-project] 4cc7d6: [MLIR] emitc: Add emitc.file op (#123298)

Matthias Gehre via All-commits all-commits at lists.llvm.org
Tue Feb 18 06:21:41 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4cc7d60fe3e060e33cb01f054e2d26870d6256b7
      https://github.com/llvm/llvm-project/commit/4cc7d60fe3e060e33cb01f054e2d26870d6256b7
  Author: Matthias Gehre <matthias.gehre at amd.com>
  Date:   2025-02-18 (Tue, 18 Feb 2025)

  Changed paths:
    M mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
    M mlir/include/mlir/Target/Cpp/CppEmitter.h
    M mlir/lib/Dialect/EmitC/IR/EmitC.cpp
    M mlir/lib/Target/Cpp/TranslateRegistration.cpp
    M mlir/lib/Target/Cpp/TranslateToCpp.cpp
    A mlir/test/Target/Cpp/file.mlir

  Log Message:
  -----------
  [MLIR] emitc: Add emitc.file op (#123298)

A `emitc.file` represents a file that can be emitted
into a single C++ file.

This allows to manage multiple source files within the same MLIR module,
but emit them into separate files.

This feature is opt-in.
By default, `mlir-translate` emits all ops outside of `emitc.file`
and ignores all `emitc.file` ops and their bodies.

When specifying the `-file-id=id` flag,
`mlir-translate` emits all ops outside of `emitc.file` and
the ops within the `emitc.file` with matching `id`.

Example:

```mlir
emitc.file "main" {
  func @func_one() {
    return
  }
}
emitc.file "test" {
  func @func_two() {
   return
  }
}
```

`mlir-translate -file-id=main` will emit `func_one` and
`mlir-translate -file-id=test` will emit `func_two`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list