Maybe what I’m about to ask for is completely out of the scope of MLIR, I’m a bit lost about what MLIR should and should not do.
I’ve worked with passes in LLVM and I used to use clang to generate LLVM IR from C/C++ code. Then I used LLVM passes to work with that IR. However, in the case of MLIR, it looks like there is no way in which you can generate MLIR IR from C/C++ code. Maybe this is because MLIR is not focused on that kind of thing, as LLVM is. In the toy example, a new language (called toy) is defined, which is later transformed in the toy IR, so it starts working with MLIR from a custom language, not a standard one like C/C++.
The only way that I can think of to accomplish this is to generate LLVM IR from C/C++ code, and since MLIR has an LLVM dialect, one could work from this starting point to work on successive transformations and lowering. But to me, it looks like this is discouraged because the whole point is to get to LLVM IR by lowering the previous IR so this final LLVM IR can be finally translated into machine code.
Is it possible to use C/C++ as “source language”, or is it needed to define custom language and semantics to work with MLIR?