MLIR 24.0.0git
SPIRVOps.cpp File Reference
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "SPIRVOpUtils.h"
#include "SPIRVParsingUtils.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVEnums.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOpTraits.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/OpDefinition.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/FunctionImplementation.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/InterleavedRange.h"
#include <cassert>
#include <numeric>
#include <optional>

Go to the source code of this file.

Functions

static ParseResult parseOneResultSameOperandTypeOp (OpAsmParser &parser, OperationState &result)
static void printOneResultOp (Operation *op, OpAsmPrinter &p)
template<typename BlockReadWriteOpTy>
static LogicalResult verifyBlockReadWritePtrAndValTypes (BlockReadWriteOpTy op, Value ptr, Value val)
static Type getElementType (Type type, ArrayRef< int32_t > indices, function_ref< InFlightDiagnostic(StringRef)> emitErrorFn)
 Walks the given type hierarchy with the given indices, potentially down to component granularity, to select an element type.
static Type getElementType (Type type, Attribute indices, function_ref< InFlightDiagnostic(StringRef)> emitErrorFn)
static Type getElementType (Type type, Attribute indices, Location loc)
static Type getElementType (Type type, Attribute indices, OpAsmParser &parser, SMLoc loc)
template<typename ExtendedBinaryOp>
static LogicalResult verifyArithmeticExtendedBinaryOp (ExtendedBinaryOp op)
static ParseResult parseArithmeticExtendedBinaryOp (OpAsmParser &parser, OperationState &result)
static void printArithmeticExtendedBinaryOp (Operation *op, OpAsmPrinter &printer)
static LogicalResult verifyShiftOp (Operation *op)
static LogicalResult verifyConstantType (spirv::ConstantOp op, Attribute value, Type opType)
static Type getValueType (Attribute attr)
static LogicalResult verifyFloatIntegerBuiltin (Operation *op, Type floatType, Type integerType)

Function Documentation

◆ getElementType() [1/4]

Type getElementType ( Type type,
ArrayRef< int32_t > indices,
function_ref< InFlightDiagnostic(StringRef)> emitErrorFn )
static

Walks the given type hierarchy with the given indices, potentially down to component granularity, to select an element type.

Returns null type and emits errors with the given loc on failure.

Definition at line 229 of file SPIRVOps.cpp.

References indices.

Referenced by getElementType(), getElementType(), and getElementType().

◆ getElementType() [2/4]

Type getElementType ( Type type,
Attribute indices,
function_ref< InFlightDiagnostic(StringRef)> emitErrorFn )
static

Definition at line 255 of file SPIRVOps.cpp.

References getElementType(), and indices.

◆ getElementType() [3/4]

Type getElementType ( Type type,
Attribute indices,
Location loc )
static

Definition at line 280 of file SPIRVOps.cpp.

References getElementType(), and indices.

◆ getElementType() [4/4]

Type getElementType ( Type type,
Attribute indices,
OpAsmParser & parser,
SMLoc loc )
static

Definition at line 287 of file SPIRVOps.cpp.

References mlir::AsmParser::emitError(), getElementType(), and indices.

◆ getValueType()

Type getValueType ( Attribute attr)
static

Definition at line 835 of file SPIRVOps.cpp.

References mlir::spirv::ArrayType::get(), and getValueType().

Referenced by getValueType().

◆ parseArithmeticExtendedBinaryOp()

◆ parseOneResultSameOperandTypeOp()

◆ printArithmeticExtendedBinaryOp()

◆ printOneResultOp()

◆ verifyArithmeticExtendedBinaryOp()

template<typename ExtendedBinaryOp>
LogicalResult verifyArithmeticExtendedBinaryOp ( ExtendedBinaryOp op)
static

Definition at line 296 of file SPIRVOps.cpp.

References success().

◆ verifyBlockReadWritePtrAndValTypes()

template<typename BlockReadWriteOpTy>
LogicalResult verifyBlockReadWritePtrAndValTypes ( BlockReadWriteOpTy op,
Value ptr,
Value val )
static

Definition at line 213 of file SPIRVOps.cpp.

References mlir::Value::getType(), and success().

◆ verifyConstantType()

LogicalResult verifyConstantType ( spirv::ConstantOp op,
Attribute value,
Type opType )
static

Definition at line 606 of file SPIRVOps.cpp.

References success(), and verifyConstantType().

Referenced by verifyConstantType().

◆ verifyFloatIntegerBuiltin()

LogicalResult verifyFloatIntegerBuiltin ( Operation * op,
Type floatType,
Type integerType )
static

Definition at line 2220 of file SPIRVOps.cpp.

References mlir::Operation::emitOpError(), getNumElements(), and success().

◆ verifyShiftOp()

LogicalResult verifyShiftOp ( Operation * op)
static