llvm-project/mlir/test/lib/TestDialect
River Riddle 0d7ff220ed [mlir] Refactor TypeConverter to add conversions without inheritance
Summary:
This revision refactors the TypeConverter class to not use inheritance to add type conversions. It instead moves to a registration based system, where conversion callbacks are added to the converter with `addConversion`. This method takes a conversion callback, which must be convertible to any of the following forms(where `T` is a class derived from `Type`:
* Optional<Type> (T type)
   - This form represents a 1-1 type conversion. It should return nullptr
     or `llvm::None` to signify failure. If `llvm::None` is returned, the
     converter is allowed to try another conversion function to perform
     the conversion.
* Optional<LogicalResult>(T type, SmallVectorImpl<Type> &results)
   - This form represents a 1-N type conversion. It should return
     `failure` or `llvm::None` to signify a failed conversion. If the new
     set of types is empty, the type is removed and any usages of the
     existing value are expected to be removed during conversion. If
     `llvm::None` is returned, the converter is allowed to try another
     conversion function to perform the conversion.

When attempting to convert a type, the TypeConverter walks each of the registered converters starting with the one registered most recently.

Differential Revision: https://reviews.llvm.org/D74584
2020-02-18 16:17:48 -08:00
..
CMakeLists.txt [MLIR] Fixes for shared library dependencies. 2020-02-04 08:56:37 -08:00
TestDialect.cpp NFC: add indexing operator for ArrayAttr 2020-02-14 22:54:37 -08:00
TestDialect.h Mass update the MLIR license header to mention "Part of the LLVM project" 2020-01-26 03:58:30 +00:00
TestOps.td NFC: add indexing operator for ArrayAttr 2020-02-14 22:54:37 -08:00
TestPatterns.cpp [mlir] Refactor TypeConverter to add conversions without inheritance 2020-02-18 16:17:48 -08:00
lit.local.cfg Split test-specific passes out of mlir-opt 2019-06-24 17:47:12 -07:00