llvm-project/mlir
Chris Lattner 9eb3e564d3 [ODS] Make the getType() method on a OneResult instruction return a specific type.
Implement Bug 46698, making ODS synthesize a getType() method that returns a
specific C++ class for OneResult methods where we know that class.  This eliminates
a common source of casts in things like:

   myOp.getType().cast<FIRRTLType>().getPassive()

because we know that myOp always returns a FIRRTLType.  This also encourages
op authors to type their results more tightly (which is also good for
verification).

I chose to implement this by splitting the OneResult trait into itself plus a
OneTypedResult trait, given that many things are using `hasTrait<OneResult>`
to conditionalize various logic.

While this changes makes many many ops get more specific getType() results, it
is generally drop-in compatible with the previous behavior because 'x.cast<T>()'
is allowed when x is already known to be a T.  The one exception to this is that
we need declarations of the types used by ops, which is why a couple headers
needed additional #includes.

I updated a few things in tree to remove the now-redundant `.cast<>`'s, but there
are probably many more than can be removed.

Differential Revision: https://reviews.llvm.org/D93790
2020-12-26 13:52:40 -08:00
..
cmake/modules [mlir] use STATUS instead of CHECK_* in MLIRDetectPythonEnv.cmake 2020-11-25 00:09:33 +01:00
docs [ODS] Make the getType() method on a OneResult instruction return a specific type. 2020-12-26 13:52:40 -08:00
examples [ODS] Make the getType() method on a OneResult instruction return a specific type. 2020-12-26 13:52:40 -08:00
include [ODS] Make the getType() method on a OneResult instruction return a specific type. 2020-12-26 13:52:40 -08:00
integration_test [mlir][Linalg] Revisit the Linalg on tensors abstraction 2020-12-21 12:29:10 -08:00
lib [ODS] Make the getType() method on a OneResult instruction return a specific type. 2020-12-26 13:52:40 -08:00
test [mlir] Async: add support for lowering async value operands to LLVM 2020-12-25 02:25:20 -08:00
tools [ODS] Make the getType() method on a OneResult instruction return a specific type. 2020-12-26 13:52:40 -08:00
unittests [mlir][IR][NFC] Move context/location parameters of builtin Type::get methods to the start of the parameter list 2020-12-17 13:01:36 -08:00
utils [mlir] Move `std.tensor_cast` -> `tensor.cast`. 2020-12-17 16:06:56 -08:00
.clang-format
.clang-tidy Fix MLIR clang-tidy: when tweaking it does not inherit from the parent 2020-03-07 17:44:21 +00:00
CMakeLists.txt [mlir][Python] Check numpy in Python bindings configuration. 2020-12-02 09:29:20 +08:00
LICENSE.TXT
README.md

README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.