hanchenye-llvm-project/mlir/examples/standalone
Stella Laurenzo 485cc55edf [mlir] Generare .cpp.inc files for dialects.
* Previously, we were only generating .h.inc files. We foresee the need to also generate implementations and this is a step towards that.
* Discussed in https://llvm.discourse.group/t/generating-cpp-inc-files-for-dialects/3732/2
* Deviates from the discussion above by generating a default constructor in the .cpp.inc file (and adding a tablegen bit that disables this in case if this is user provided).
* Generating the destructor started as a way to flush out the missing includes (produces a link error), but it is a strict improvement on its own that is worth doing (i.e. by emitting key methods in the .cpp file, we root vtables in one translation unit, which is a non-controversial improvement).

Differential Revision: https://reviews.llvm.org/D105070
2021-06-29 20:10:30 +00:00
..
include Change add_mlir_doc CMake macro to take the tablegen command as last argument to allow extra flags 2021-04-15 02:59:40 +00:00
lib [mlir] Generare .cpp.inc files for dialects. 2021-06-29 20:10:30 +00:00
standalone-opt Add a helper function to convert LogicalResult to int for return from main 2021-05-19 00:12:39 +00:00
standalone-translate
test Forward the `LLVM_ENABLE_LIBCXX` CMake parameter to the mlir standalone test 2021-03-08 05:07:26 +00:00
CMakeLists.txt [CMake] Remove dead code setting policies to NEW 2021-01-19 17:19:36 +02:00
README.md

README.md

An out-of-tree MLIR dialect

This is an example of an out-of-tree MLIR dialect along with a standalone opt-like tool to operate on that dialect.

Building

This setup assumes that you have built LLVM and MLIR in $BUILD_DIR and installed them to $PREFIX. To build and launch the tests, run

mkdir build && cd build
cmake -G Ninja .. -DMLIR_DIR=$PREFIX/lib/cmake/mlir -DLLVM_EXTERNAL_LIT=$BUILD_DIR/bin/llvm-lit
cmake --build . --target check-standalone

To build the documentation from the TableGen description of the dialect operations, run

cmake --build . --target mlir-doc

Note: Make sure to pass -DLLVM_INSTALL_UTILS=ON when building LLVM with CMake in order to install FileCheck to the chosen installation prefix.