llvm-project/mlir/lib
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
..
Analysis [mlir] Use mlir::OpState::operator->() to get to methods of mlir::Operation. 2020-12-13 09:58:16 +01:00
Bindings [mlir] Add Python binding for MLIR Dict Attribute 2020-12-13 04:30:35 +00:00
CAPI [mlir] Remove the MutableDictionaryAttr class 2020-12-17 17:18:42 -08:00
Conversion [ODS] Make the getType() method on a OneResult instruction return a specific type. 2020-12-26 13:52:40 -08:00
Dialect [ODS] Make the getType() method on a OneResult instruction return a specific type. 2020-12-26 13:52:40 -08:00
EDSC [mlir][linalg] Add vectorization for element-wise linalg ops 2020-12-03 15:31:13 -08:00
ExecutionEngine [mlir] Async: lowering async.value to LLVM 2020-12-25 02:23:48 -08:00
IR [mlir] Remove the MutableDictionaryAttr class 2020-12-17 17:18:42 -08:00
Interfaces [mlir][Linalg] Define a linalg.init_tensor operation. 2020-12-17 14:45:51 -08:00
Parser [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
Pass [mlir] Remove the MutableDictionaryAttr class 2020-12-17 17:18:42 -08:00
Reducer [mlir] NFC: fix trivial typos 2020-10-29 04:05:22 +09:00
Rewrite [mlir] Change the internal representation of FrozenRewritePatternList to use shared_ptr 2020-12-14 12:32:44 -08:00
Support Remove unneeded header include (NFC) 2020-12-18 00:10:26 +00:00
TableGen [ODS] Make the getType() method on a OneResult instruction return a specific type. 2020-12-26 13:52:40 -08:00
Target [mlir][spirv] De-template serialization 2020-12-23 14:54:26 -05:00
Transforms [mlir] Remove the MutableDictionaryAttr class 2020-12-17 17:18:42 -08:00
Translation [mlir][BuiltinDialect] Resolve comments from D91571 2020-11-19 11:12:49 -08:00
CMakeLists.txt [mlir][NFC] Move around the code related to PatternRewriting to improve layering 2020-10-26 18:01:06 -07:00