llvm-project/mlir/tools
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
..
mlir-cpu-runner [mlir] Make mlir-cpu-runner depend on native instead of X86 2020-11-30 15:11:34 +00:00
mlir-cuda-runner [mlir] Lower gpu.memcpy to GPU runtime calls. 2020-12-22 22:49:19 +01:00
mlir-linalg-ods-gen [mlir][Linalg] Revisit the Linalg on tensors abstraction 2020-12-21 12:29:10 -08:00
mlir-opt [MLIR][SPIRV] Add rewrite pattern to convert select+cmp into GLSL clamp. 2020-12-23 15:47:19 +01:00
mlir-reduce [mlir] Fix missing namespaces in OpBuildGen.cpp 2020-11-05 18:11:01 +01:00
mlir-rocm-runner [mlir] Lower gpu.memcpy to GPU runtime calls. 2020-12-22 22:49:19 +01:00
mlir-shlib [MLIR] Reapply: Adjust libMLIR building to more closely follow libClang 2020-05-04 20:47:57 -07:00
mlir-spirv-cpu-runner [mlir][spirv] NFC: rename SPIR-V conversion files for consistency 2020-12-23 14:36:46 -05:00
mlir-tblgen [ODS] Make the getType() method on a OneResult instruction return a specific type. 2020-12-26 13:52:40 -08:00
mlir-translate Revert "[RFC] Factor out repetitive cmake patterns for llvm-style projects" 2020-10-04 15:17:34 -07:00
mlir-vulkan-runner [mlir][spirv] NFC: rename SPIR-V conversion files for consistency 2020-12-23 14:36:46 -05:00
CMakeLists.txt [MLIR][mlir-spirv-cpu-runner] A SPIR-V cpu runner prototype 2020-10-26 09:09:29 -04:00