llvm-project/mlir/examples/toy/Ch6
Tobias Gysi f809eb4db2 [mlir] Argument and result attribute handling during inlining.
The revision adds the handleArgument and handleResult handlers that
allow users of the inlining interface to implement argument and result
conversions that take argument and result attributes into account. The
motivating use cases for this revision are taken from the LLVM dialect
inliner, which has to copy arguments that are marked as byval and that
also has to consider zeroext / signext when converting integers.

All type conversions are currently handled by the
materializeCallConversion hook. It runs before isLegalToInline and
supports only the introduction of a single cast operation since it may
have to rollback. The new handlers run shortly before and after
inlining and cannot fail. As a result, they can introduce more complex
ir such as copying a struct argument. At the moment, the new hooks
cannot be used to perform type conversions since all type conversions
have to be done using the materializeCallConversion. A follow up
revision will either relax this constraint or drop
materializeCallConversion in favor of the new and more flexible
handlers.

The revision also extends the CallableOpInterface to provide access
to the argument and result attributes if available.

Reviewed By: rriddle, Dinistro

Differential Revision: https://reviews.llvm.org/D145582
2023-03-22 09:02:15 +01:00
..
include [mlir] Switch default Fold API to using FoldAdaptors 2023-02-07 16:48:58 +01:00
mlir [mlir] Argument and result attribute handling during inlining. 2023-03-22 09:02:15 +01:00
parser
CMakeLists.txt [mlir] Support lowering of dialect attributes attached to top-level modules 2023-03-21 12:54:26 +00:00
toyc.cpp [mlir] Support lowering of dialect attributes attached to top-level modules 2023-03-21 12:54:26 +00:00