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

Tomer Solomon llvmlistbot at llvm.org
Tue Nov 5 23:41:31 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";
+}
----------------
recursion-man wrote:

@marbre, thanks for the input.
I noticed that **ConvertSPIRVToLLVMPass** relies on a custom Option for **ClientAPI** defined in **SPIRVBase.td**, which is similar to what I’m aiming for here. Additionally, **include/mlir/Dialect/ArmSME/Transforms/Passes.td** defines attributes directly in its passes file but includes **mlir/IR/EnumAttr.td**, going beyond the usual **Conversion/Passes.td** convention to include only **mlir/Pass/PassBase.td**.

At this point, defining the attribute in **EmitCBase.td** or **EmitCAttributes.td** seems like the only alternative I can think of. What are your thoughts?

I also agree with your point on keeping this PR focused without adding too much at once. Further ideas we discussed can be part of future work.

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


More information about the Mlir-commits mailing list