MLIR  16.0.0git
Macros | Functions
SPIRVDialect.cpp File Reference
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/ParserUtils.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
#include "mlir/Dialect/SPIRV/IR/TargetAndABI.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"
+ Include dependency graph for SPIRVDialect.cpp:

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 Optional< ValTy > parseAndVerify (SPIRVDialect const &dialect, DialectAsmParser &parser)
 
template<>
Optional< TypeparseAndVerify< Type > (SPIRVDialect const &dialect, DialectAsmParser &parser)
 
template<>
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 parseJointMatrixType (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 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 (CooperativeMatrixNVType type, DialectAsmPrinter &os)
 
static void print (JointMatrixINTELType 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 43 of file SPIRVDialect.cpp.

References mlir::Block::getTerminator().

◆ parseAndVerify()

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

◆ parseAndVerify< Type >()

template<>
Optional< Type > parseAndVerify< Type > ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)

Definition at line 477 of file SPIRVDialect.cpp.

◆ parseAndVerify< unsigned >()

template<>
Optional< unsigned > parseAndVerify< unsigned > ( SPIRVDialect const &  dialect,
DialectAsmParser parser 
)

Definition at line 502 of file SPIRVDialect.cpp.

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

Referenced by parseOptionalArrayStride().

◆ parseAndVerifyInteger()

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

Definition at line 502 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

◆ parseJointMatrixType()

static Type parseJointMatrixType ( 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 255 of file SPIRVDialect.cpp.

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

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/9]

static void print ( ArrayType  type,
DialectAsmPrinter os 
)
static

◆ print() [2/9]

static void print ( CooperativeMatrixNVType  type,
DialectAsmPrinter os 
)
static

◆ print() [3/9]

static void print ( ImageType  type,
DialectAsmPrinter os 
)
static

◆ print() [4/9]

static void print ( JointMatrixINTELType  type,
DialectAsmPrinter os 
)
static

◆ print() [5/9]

static void print ( MatrixType  type,
DialectAsmPrinter os 
)
static

◆ print() [6/9]

static void print ( PointerType  type,
DialectAsmPrinter os 
)
static

◆ print() [7/9]

static void print ( RuntimeArrayType  type,
DialectAsmPrinter os 
)
static

◆ print() [8/9]

static void print ( SampledImageType  type,
DialectAsmPrinter os 
)
static

Definition at line 841 of file SPIRVDialect.cpp.

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

◆ print() [9/9]

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 959 of file SPIRVDialect.cpp.

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