#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "SPIRVParsingUtils.h"
#include "mlir/Dialect/GPU/IR/CompilationInterfaces.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
#include "mlir/Dialect/SPIRV/IR/TargetAndABI.h"
#include "mlir/Dialect/UB/IR/UBOps.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/Parser/Parser.h"
#include "mlir/Transforms/InliningUtils.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/raw_ostream.h"
usingnamespacemlir;
usingnamespacemlir::spirv;
#include "mlir/Dialect/SPIRV/IR/SPIRVOpsDialect.cpp.inc"
static inline bool containsReturn(Region ®ion) { … }
namespace {
struct SPIRVInlinerInterface : public DialectInlinerInterface { … };
}
void SPIRVDialect::initialize() { … }
std::string SPIRVDialect::getAttributeName(Decoration decoration) { … }
template <typename ValTy>
static std::optional<ValTy> parseAndVerify(SPIRVDialect const &dialect,
DialectAsmParser &parser);
template <>
std::optional<Type> parseAndVerify<Type>(SPIRVDialect const &dialect,
DialectAsmParser &parser);
template <>
std::optional<unsigned> parseAndVerify<unsigned>(SPIRVDialect const &dialect,
DialectAsmParser &parser);
static Type parseAndVerifyType(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
static Type parseAndVerifyMatrixType(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
static Type parseAndVerifySampledImageType(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
static LogicalResult parseOptionalArrayStride(const SPIRVDialect &dialect,
DialectAsmParser &parser,
unsigned &stride) { … }
static Type parseArrayType(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
static Type parseCooperativeMatrixType(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
static Type parsePointerType(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
static Type parseRuntimeArrayType(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
static Type parseMatrixType(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
template <typename ValTy>
static std::optional<ValTy> parseAndVerify(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
template <>
std::optional<Type> parseAndVerify<Type>(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
template <typename IntTy>
static std::optional<IntTy> parseAndVerifyInteger(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
template <>
std::optional<unsigned> parseAndVerify<unsigned>(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
namespace {
template <typename ParseType, typename... Args>
struct ParseCommaSeparatedList { … };
ParseCommaSeparatedList<ParseType>;
}
static Type parseImageType(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
static Type parseSampledImageType(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
static ParseResult parseStructMemberDecorations(
SPIRVDialect const &dialect, DialectAsmParser &parser,
ArrayRef<Type> memberTypes,
SmallVectorImpl<StructType::OffsetInfo> &offsetInfo,
SmallVectorImpl<StructType::MemberDecorationInfo> &memberDecorationInfo) { … }
static Type parseStructType(SPIRVDialect const &dialect,
DialectAsmParser &parser) { … }
Type SPIRVDialect::parseType(DialectAsmParser &parser) const { … }
static void print(ArrayType type, DialectAsmPrinter &os) { … }
static void print(RuntimeArrayType type, DialectAsmPrinter &os) { … }
static void print(PointerType type, DialectAsmPrinter &os) { … }
static void print(ImageType type, DialectAsmPrinter &os) { … }
static void print(SampledImageType type, DialectAsmPrinter &os) { … }
static void print(StructType type, DialectAsmPrinter &os) { … }
static void print(CooperativeMatrixType type, DialectAsmPrinter &os) { … }
static void print(MatrixType type, DialectAsmPrinter &os) { … }
void SPIRVDialect::printType(Type type, DialectAsmPrinter &os) const { … }
Operation *SPIRVDialect::materializeConstant(OpBuilder &builder,
Attribute value, Type type,
Location loc) { … }
LogicalResult SPIRVDialect::verifyOperationAttribute(Operation *op,
NamedAttribute attribute) { … }
static LogicalResult verifyRegionAttribute(Location loc, Type valueType,
NamedAttribute attribute) { … }
LogicalResult SPIRVDialect::verifyRegionArgAttribute(Operation *op,
unsigned regionIndex,
unsigned argIndex,
NamedAttribute attribute) { … }
LogicalResult SPIRVDialect::verifyRegionResultAttribute(
Operation *op, unsigned , unsigned ,
NamedAttribute attribute) { … }