diff options
author | Jaden Angella <ajaden@google.com> | 2025-06-24 13:07:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-24 13:07:22 -0700 |
commit | e615544e2bd11ceaf10841f8c07e6137d87e9814 (patch) | |
tree | 68f6734a0046db4116b62ee3013220f983c9f06c /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | e1cd450c8f7ca1815364b6b0a275be71eea39860 (diff) | |
download | llvm-e615544e2bd11ceaf10841f8c07e6137d87e9814.zip llvm-e615544e2bd11ceaf10841f8c07e6137d87e9814.tar.gz llvm-e615544e2bd11ceaf10841f8c07e6137d87e9814.tar.bz2 |
[mlir][EmitC] Add pass to wrap a func in class (#141158)
Goal: Enable using C++ classes to AOT compile models for MLGO.
This commit introduces a transformation pass that converts standalone
`emitc.func` operations into `emitc.class `structures to support
class-based C++ code generation for MLGO.
Transformation details:
- Wrap `emitc.func @func_name` into `emitc.class @Myfunc_nameClass`
- Converts function arguments to class fields with preserved attributes
- Transforms function body into an `execute()` method with no arguments
- Replaces argument references with `get_field` operations
Before: emitc.func @Model(%arg0, %arg1, %arg2) with direct argument
access
After: emitc.class with fields and execute() method using get_field
operations
This enables generating C++ classes that can be instantiated and
executed as self-contained model objects for AOT compilation workflows.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions