MLIR  20.0.0git
Macros | Functions
SPIRVDialect.cpp File Reference
#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"
#include "mlir/Dialect/SPIRV/IR/SPIRVOpsDialect.cpp.inc"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.cpp.inc"

Go to the source code of this file.

Macros

#define GET_OP_LIST
 

Functions

static bool containsReturn (Region &region)
 Returns true if the given region contains spirv.Return or spirv.ReturnValue ops. More...
 
template<typename ValTy >
static std::optional< ValTy > parseAndVerify (SPIRVDialect const &dialect, DialectAsmParser &parser)
 
template<>
std::optional< TypeparseAndVerify< 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)
 Parses an optional , stride = N assembly segment. More...
 
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 IntTy >
static std::optional< IntTy > parseAndVerifyInteger (SPIRVDialect const &dialect, DialectAsmParser &parser)
 
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)
 
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)
 
static LogicalResult verifyRegionAttribute (Location loc, Type valueType, NamedAttribute attribute)
 Verifies the given SPIR-V attribute attached to a value of the given valueType is valid. More...
 

Macro Definition Documentation

◆ GET_OP_LIST

#define GET_OP_LIST

Function Documentation

◆ containsReturn()

static bool containsReturn ( Region region)
inlinestatic

Returns true if the given region contains spirv.Return or spirv.ReturnValue ops.

Definition at line 47 of file SPIRVDialect.cpp.

References mlir::Block::getTerminator().

◆ parseAndVerify()

template<typename ValTy >
static std::optional< ValTy > parseAndVerify ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)
static

◆ parseAndVerify< Type >()

template<>
std::optional< Type > parseAndVerify< Type > ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)

Definition at line 456 of file SPIRVDialect.cpp.

◆ parseAndVerify< unsigned >()

template<>
std::optional< unsigned > parseAndVerify< unsigned > ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)

Definition at line 481 of file SPIRVDialect.cpp.

References max(), and mlir::AsmParser::parseInteger().

Referenced by parseOptionalArrayStride().

◆ parseAndVerifyInteger()

template<typename IntTy >
static std::optional<IntTy> parseAndVerifyInteger ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)
static

Definition at line 481 of file SPIRVDialect.cpp.

◆ parseAndVerifyMatrixType()

static Type parseAndVerifyMatrixType ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)
static

◆ parseAndVerifySampledImageType()

static Type parseAndVerifySampledImageType ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)
static

◆ parseAndVerifyType()

static Type parseAndVerifyType ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)
static

◆ parseArrayType()

static Type parseArrayType ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)
static

◆ parseCooperativeMatrixType()

static Type parseCooperativeMatrixType ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)
static

◆ parseImageType()

static Type parseImageType ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)
static

◆ parseMatrixType()

static Type parseMatrixType ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)
static

◆ parseOptionalArrayStride()

static LogicalResult parseOptionalArrayStride ( const SPIRVDialect &  dialect,
DialectAsmParser parser,
unsigned &  stride 
)
static

Parses an optional , stride = N assembly segment.

If no parsing failure occurs, writes N to stride if existing and writes 0 to stride if missing.

Definition at line 261 of file SPIRVDialect.cpp.

References mlir::AsmParser::emitError(), mlir::AsmParser::getCurrentLocation(), parseAndVerify< unsigned >(), mlir::AsmParser::parseEqual(), mlir::AsmParser::parseKeyword(), and mlir::AsmParser::parseOptionalComma().

Referenced by parseArrayType(), and parseRuntimeArrayType().

◆ parsePointerType()

static Type parsePointerType ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)
static

◆ parseRuntimeArrayType()

static Type parseRuntimeArrayType ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)
static

◆ parseSampledImageType()

static Type parseSampledImageType ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)
static

◆ parseStructMemberDecorations()

static ParseResult parseStructMemberDecorations ( SPIRVDialect const &  dialect,
DialectAsmParser parser,
ArrayRef< Type memberTypes,
SmallVectorImpl< StructType::OffsetInfo > &  offsetInfo,
SmallVectorImpl< StructType::MemberDecorationInfo > &  memberDecorationInfo 
)
static

◆ parseStructType()

static Type parseStructType ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)
static

◆ print() [1/8]

static void print ( ArrayType  type,
DialectAsmPrinter os 
)
static

◆ print() [2/8]

static void print ( CooperativeMatrixType  type,
DialectAsmPrinter os 
)
static

◆ print() [3/8]

static void print ( ImageType  type,
DialectAsmPrinter os 
)
static

◆ print() [4/8]

static void print ( MatrixType  type,
DialectAsmPrinter os 
)
static

◆ print() [5/8]

static void print ( PointerType  type,
DialectAsmPrinter os 
)
static

◆ print() [6/8]

static void print ( RuntimeArrayType  type,
DialectAsmPrinter os 
)
static

◆ print() [7/8]

static void print ( SampledImageType  type,
DialectAsmPrinter os 
)
static

Definition at line 797 of file SPIRVDialect.cpp.

References mlir::spirv::SampledImageType::getImageType().

◆ print() [8/8]

static void print ( StructType  type,
DialectAsmPrinter os 
)
static

◆ verifyRegionAttribute()

static LogicalResult verifyRegionAttribute ( Location  loc,
Type  valueType,
NamedAttribute  attribute 
)
static

Verifies the given SPIR-V attribute attached to a value of the given valueType is valid.

Definition at line 908 of file SPIRVDialect.cpp.

References mlir::emitError(), mlir::spirv::getInterfaceVarABIAttrName(), mlir::NamedAttribute::getName(), mlir::NamedAttribute::getValue(), and mlir::Type::isIntOrIndexOrFloat().