MLIR  20.0.0git
ArmSVEDialect.cpp
Go to the documentation of this file.
1 //===- ArmSVEDialect.cpp - MLIR ArmSVE dialect implementation -------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the ArmSVE dialect and its operations.
10 //
11 //===----------------------------------------------------------------------===//
12 
16 #include "mlir/IR/Builders.h"
19 #include "mlir/IR/TypeUtilities.h"
20 #include "llvm/ADT/TypeSwitch.h"
21 
22 using namespace mlir;
23 using namespace mlir::arm_sve;
24 
25 //===----------------------------------------------------------------------===//
26 // ScalableVector versions of general helpers for comparison ops
27 //===----------------------------------------------------------------------===//
28 
29 /// Return the scalable vector of the same shape and containing i1.
30 static Type getI1SameShape(Type type) {
31  auto i1Type = IntegerType::get(type.getContext(), 1);
32  if (auto sVectorType = llvm::dyn_cast<VectorType>(type))
33  return VectorType::get(sVectorType.getShape(), i1Type,
34  sVectorType.getScalableDims());
35  return nullptr;
36 }
37 
38 //===----------------------------------------------------------------------===//
39 // Tablegen Definitions
40 //===----------------------------------------------------------------------===//
41 
42 #include "mlir/Dialect/ArmSVE/IR/ArmSVEDialect.cpp.inc"
43 
44 #define GET_OP_CLASSES
45 #include "mlir/Dialect/ArmSVE/IR/ArmSVE.cpp.inc"
46 
47 #define GET_TYPEDEF_CLASSES
48 #include "mlir/Dialect/ArmSVE/IR/ArmSVETypes.cpp.inc"
49 
50 void ArmSVEDialect::initialize() {
51  addOperations<
52 #define GET_OP_LIST
53 #include "mlir/Dialect/ArmSVE/IR/ArmSVE.cpp.inc"
54  >();
55 }
static Type getI1SameShape(Type type)
Return the scalable vector of the same shape and containing i1.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition: Types.h:74
MLIRContext * getContext() const
Return the MLIRContext in which this type was uniqued.
Definition: Types.cpp:35
Include the generated interface declarations.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...