Hello
I’m new to both MLIR & LLVM, and I am interested in learning MLIR.
When I was going through the MLIR Toy tutorial, from Chapter 2, I am quoting a paragraph which explains what kind of issue is MLIR addressing in compiler world
Other compilers, like LLVM (see the Kaleidoscope tutorial), offer a fixed set of predefined types and (usually low-level / RISC-like) instructions. It is up to the frontend for a given language to perform any language-specific type-checking, analysis, or transformation before emitting LLVM IR. For example, Clang will use its AST to perform not only static analysis but also transformations, such as C++ template instantiation through AST cloning and rewrite. Finally, languages with construction at a higher-level than C/C++ may require non-trivial lowering from their AST to generate LLVM IR.
As a consequence, multiple frontends end up reimplementing significant pieces of infrastructure to support the need for these analyses and transformation. MLIR addresses this issue by being designed for extensibility. As such, there are few pre-defined instructions (operations in MLIR terminology) or types.
Which makes me wonder, how multiple frontends end up reimplementing significant pieces of infrastructure to support the need for these analyses and transformation.
My questions:
-
What it actually meant by multiple frontend? I have a blurry idea about this issue. What I understood, this issue means, implementing similar kind of analysis and transformation again and again. For example I have a C code. Now if I employ both
clang
andllvm
on same src code, is that actually multiple frontend? -
How actually MLIR is addressing the issue of multiple frontend?
I would be really grateful if some explains me this paragraph in bit more easier way. Better with an simple example.
Thanks in advance!