aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CommandFlags.cpp
diff options
context:
space:
mode:
authorTomer Solomon <tomsol2009@gmail.com>2025-01-20 10:26:41 +0200
committerGitHub <noreply@github.com>2025-01-20 09:26:41 +0100
commitc0055ec434cbb132d7776f8b4c39e99b69fa97ea (patch)
tree6846b0a651ac10a9b28d1c77e552781cb186e342 /llvm/lib/CodeGen/CommandFlags.cpp
parent7a77f14c0abfbecbfb800ea8d974e66d81ee516a (diff)
downloadllvm-c0055ec434cbb132d7776f8b4c39e99b69fa97ea.zip
llvm-c0055ec434cbb132d7776f8b4c39e99b69fa97ea.tar.gz
llvm-c0055ec434cbb132d7776f8b4c39e99b69fa97ea.tar.bz2
[mlir][EmitC] Add MathToEmitC pass for math function lowering to EmitC (#113799)
This commit introduces a new MathToEmitC conversion pass that lowers selected math operations from the Math dialect to the emitc.call_opaque operation in the EmitC dialect. **Supported Math Operations:** The following operations are converted: - math.floor -> emitc.call_opaque<"floor"> - math.round -> emitc.call_opaque<"round"> - math.exp -> emitc.call_opaque<"exp"> - math.cos -> emitc.call_opaque<"cos"> - math.sin -> emitc.call_opaque<"sin"> - math.acos -> emitc.call_opaque<"acos"> - math.asin -> emitc.call_opaque<"asin"> - math.atan2 -> emitc.call_opaque<"atan2"> - math.ceil -> emitc.call_opaque<"ceil"> - math.absf -> emitc.call_opaque<"fabs"> - math.powf -> emitc.call_opaque<"pow"> **Target Language Standards:** The pass supports targeting different language standards: - C99: Generates calls with suffixes (e.g., floorf, fabsf) for single-precision floats. - CPP11: Prepends std:: to functions (e.g., std::floor, std::fabs). **Design Decisions:** The pass uses emitc.call_opaque instead of emitc.call to better emulate C-style function overloading. emitc.call_opaque does not require a unique type signature, making it more suitable for operations like <math.h> functions that may be overloaded for different types. This design choice ensures compatibility with C/C++ conventions.
Diffstat (limited to 'llvm/lib/CodeGen/CommandFlags.cpp')
0 files changed, 0 insertions, 0 deletions