[llvm] [mlir] [mlir][EmitC] Add MathToEmitC pass for math function lowering to EmitC (PR #113799)

Marius Brehler via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 01:57:08 PST 2024


================
@@ -62,4 +62,13 @@ def EmitC_OpaqueAttr : EmitC_Attr<"Opaque", "opaque"> {
 
 def EmitC_OpaqueOrTypedAttr : AnyAttrOf<[EmitC_OpaqueAttr, TypedAttrInterface]>;
 
+def MathToEmitCLanguageTarget : I32EnumAttr<"MathToEmitCLanguageTarget",
+  "Specifies the language target for generating callees.", [
+    I32EnumAttrCase<"C", 0, "Use C-style function names">,
+    I32EnumAttrCase<"CPP", 1, "Use C++-style function names">
+  ]> {
+  let cppNamespace = "::mlir::emitc";
+}
----------------
marbre wrote:

I don't think this should be placed in `EmitCAttributes.td` as it is not strictly belongs to the dialect itself. Scanning over upstream quickly it seems that `ConvertSPIRVToLLVMPass` relies on an Option which uses a custom attribute and not one of the standard types. As another example, `include/mlir/Dialect/ArmSME/Transforms/Passes.td` defines attributes in the passes file itself. I don't know the best solution for this but as mentioned `EmitCAttributes.td`  feels like the wrong place.

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


More information about the llvm-commits mailing list