[llvm] [mlir] [mlir][EmitC] Add MathToEmitC pass for math function lowering to EmitC (PR #113799)
Simon Camphausen via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 14 06:23:13 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";
+}
----------------
simon-camp wrote:
Does this have to be an attribute right now? As we don't have a dedicated op we could attach this to yet, we could start with a `LanguageTarget` enum somewhere in `Dialect/EmitC/Transforms`. Once we introduce a module like op we can give it an inherent attribute to define the target.
Additionally I would strip the `Math` prefix from the name as I expect this to be used in more places in the future as @aniragil mentioned.
https://github.com/llvm/llvm-project/pull/113799
More information about the llvm-commits
mailing list