llvm-project/mlir/examples/toy
Alex Zinenko b77bac0572 [mlir] Introduce dialect interfaces for translation to LLVM IR
The existing approach to translation to the LLVM IR relies on a single
translation supporting the base LLVM dialect, extensible through inheritance to
support intrinsic-based dialects also derived from LLVM IR such as NVVM and
AVX512. This approach does not scale well as it requires additional
translations to be created for each new intrinsic-based dialect and does not
allow them to mix in the same module, contrary to the rest of the MLIR
infrastructure. Furthermore, OpenMP translation ingrained itself into the main
translation mechanism.

Start refactoring the translation to LLVM IR to operate using dialect
interfaces. Each dialect that contains ops translatable to LLVM IR can
implement the interface for translating them, and the top-level translation
driver can operate on interfaces without knowing about specific dialects.
Furthermore, the delayed dialect registration mechanism allows one to avoid a
dependency on LLVM IR in the dialect that is translated to it by implementing
the translation as a separate library and only registering it at the client
level.

This change introduces the new mechanism and factors out the translation of the
"main" LLVM dialect. The remaining dialects will follow suit.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D96503
2021-02-12 17:49:44 +01:00
..
Ch1 [MLIR] Discourage people from copying the toy examples 2020-05-13 10:37:06 -07:00
Ch2 [NFC] Fix -Wrange-loop-analysis warnings. 2021-01-05 18:44:17 +00:00
Ch3 [NFC] Fix -Wrange-loop-analysis warnings. 2021-01-05 18:44:17 +00:00
Ch4 [mlir] Add an interface for Cast-Like operations 2021-01-20 16:28:17 -08:00
Ch5 [mlir] Add an interface for Cast-Like operations 2021-01-20 16:28:17 -08:00
Ch6 [mlir] Introduce dialect interfaces for translation to LLVM IR 2021-02-12 17:49:44 +01:00
Ch7 [mlir] Introduce dialect interfaces for translation to LLVM IR 2021-02-12 17:49:44 +01:00
CMakeLists.txt Revert "[RFC] Factor out repetitive cmake patterns for llvm-style projects" 2020-10-04 15:17:34 -07:00
README.md [MLIR] Fix broken link locations after move to monorepo 2020-01-14 07:15:02 +00:00

README.md

Toy Tutorial

This contains sample code to support the tutorial on using MLIR for building a compiler for a simple Toy language.

See docs/Tutorials/Toy at the root of the project for more informations.