[Mlir-commits] [mlir] [mlir][EmitC]Add a Reflection Map to a Class (PR #150572)

Jaden Angella llvmlistbot at llvm.org
Mon Jul 28 20:05:59 PDT 2025


================
@@ -58,4 +58,51 @@ def WrapFuncInClassPass : Pass<"wrap-emitc-func-in-class"> {
       "dictionary attributes">];
 }
 
+def AddReflectionMapPass : Pass<"add-reflection-map", "ModuleOp"> {
+  let summary =
+      "Add a reflection map function to EmitC classes for runtime field lookup";
+  let description = [{
+        This pass adds a `getBufferForName` function to EmitC classes that enables 
+        runtime lookup of field buffers by their string names. 
+        This would require that the class has fields with attributes and a function named `execute`.
----------------
Jaddyen wrote:

I insert the new function before the `execute` function.
Ideally, we could have some other insertion point but `execute` func made the most sense since it is always added when we `wrap-emitc-func-in-class`.


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


More information about the Mlir-commits mailing list