[all-commits] [llvm/llvm-project] e61554: [mlir][EmitC] Add pass to wrap a func in class (#1...
Jaden Angella via All-commits
all-commits at lists.llvm.org
Tue Jun 24 13:07:43 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e615544e2bd11ceaf10841f8c07e6137d87e9814
https://github.com/llvm/llvm-project/commit/e615544e2bd11ceaf10841f8c07e6137d87e9814
Author: Jaden Angella <ajaden at google.com>
Date: 2025-06-24 (Tue, 24 Jun 2025)
Changed paths:
M mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
M mlir/include/mlir/Dialect/EmitC/Transforms/Passes.h
M mlir/include/mlir/Dialect/EmitC/Transforms/Passes.td
M mlir/include/mlir/Dialect/EmitC/Transforms/Transforms.h
M mlir/lib/Dialect/EmitC/IR/EmitC.cpp
M mlir/lib/Dialect/EmitC/Transforms/CMakeLists.txt
A mlir/lib/Dialect/EmitC/Transforms/WrapFuncInClass.cpp
A mlir/test/Dialect/EmitC/wrap_emitc_func_in_class.mlir
A mlir/test/Dialect/EmitC/wrap_emitc_func_in_class_noAttr.mlir
Log Message:
-----------
[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.
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