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 13 #include "mlir/Dialect/ArmSVE/ArmSVEDialect.h" 14 #include "mlir/Dialect/Vector/VectorOps.h" 15 #include "mlir/IR/Builders.h" 16 #include "mlir/IR/DialectImplementation.h" 17 #include "mlir/IR/OpImplementation.h" 18 #include "mlir/IR/StandardTypes.h" 19 #include "mlir/IR/TypeUtilities.h" 20 #include "llvm/ADT/TypeSwitch.h" 21 22 using namespace mlir; 23 24 void arm_sve::ArmSVEDialect::initialize() { 25 addOperations< 26 #define GET_OP_LIST 27 #include "mlir/Dialect/ArmSVE/ArmSVE.cpp.inc" 28 >(); 29 addTypes< 30 #define GET_TYPEDEF_LIST 31 #include "mlir/Dialect/ArmSVE/ArmSVETypes.cpp.inc" 32 >(); 33 } 34 35 #define GET_OP_CLASSES 36 #include "mlir/Dialect/ArmSVE/ArmSVE.cpp.inc" 37 38 #define GET_TYPEDEF_CLASSES 39 #include "mlir/Dialect/ArmSVE/ArmSVETypes.cpp.inc" 40 41 //===----------------------------------------------------------------------===// 42 // ScalableVectorType 43 //===----------------------------------------------------------------------===// 44 45 Type arm_sve::ArmSVEDialect::parseType(DialectAsmParser &parser) const { 46 llvm::SMLoc typeLoc = parser.getCurrentLocation(); 47 auto genType = generatedTypeParser(getContext(), parser, "vector"); 48 if (genType != Type()) 49 return genType; 50 parser.emitError(typeLoc, "unknown type in ArmSVE dialect"); 51 return Type(); 52 } 53 54 void arm_sve::ArmSVEDialect::printType(Type type, DialectAsmPrinter &os) const { 55 if (failed(generatedTypePrinter(type, os))) 56 llvm_unreachable("unexpected 'arm_sve' type kind"); 57 } 58