diff options
author | River Riddle <riddleriver@gmail.com> | 2020-02-18 15:56:33 -0800 |
---|---|---|
committer | River Riddle <riddleriver@gmail.com> | 2020-02-18 16:17:48 -0800 |
commit | 0d7ff220ed0eeffda3839546ac1f30e98f60128e (patch) | |
tree | fba3621bd5e1f71c002cf5a2eb4b07a37a069e7d /llvm/lib/CodeGen/MachineFunction.cpp | |
parent | 24ad121582454e625bdad125c90d9ac0dae948c8 (diff) | |
download | llvm-0d7ff220ed0eeffda3839546ac1f30e98f60128e.zip llvm-0d7ff220ed0eeffda3839546ac1f30e98f60128e.tar.gz llvm-0d7ff220ed0eeffda3839546ac1f30e98f60128e.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
0 files changed, 0 insertions, 0 deletions