The EmitC dialect allows to convert operations from other MLIR dialects to EmitC ops. Those can be translated to C/C++ via the Cpp emitter.
The following convention is followed:
emitc.calloperation, C++ is generated.
emitc.calloperation, C++11 is required.
emitc.calloperation, C++20 is required.
These restrictions are neither inherent to the EmitC dialect itself nor to the Cpp emitter and therefore need to be considered while implementing conversions.
After the conversion, C/C++ code can be emitted with
mlir-translate. The tool supports translating MLIR to C/C++ by passing
-mlir-to-cpp. Furthermore, code with variables declared at top can be generated by passing the additional argument
Besides operations part of the EmitC dialect, the Cpp targets supports translating the following operations: