MLIR
15.0.0git
|
SPIR-V struct type. More...
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
Classes | |
class | ElementTypeRange |
Range class for element types. More... | |
struct | MemberDecorationInfo |
Public Types | |
using | OffsetInfo = uint32_t |
![]() | |
using | Base = StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits... > |
Utility declarations for the concrete attribute class. More... | |
using | ImplType = StorageT |
using | HasTraitFn = bool(*)(TypeID) |
Static Public Member Functions | |
static StructType | get (ArrayRef< Type > memberTypes, ArrayRef< OffsetInfo > offsetInfo={}, ArrayRef< MemberDecorationInfo > memberDecorations={}) |
Construct a literal StructType with at least one member. More... | |
static StructType | getIdentified (MLIRContext *context, StringRef identifier) |
Construct an identified StructType. More... | |
static StructType | getEmpty (MLIRContext *context, StringRef identifier="") |
Construct a (possibly identified) StructType with no members. More... | |
![]() | |
static TypeID | getTypeID () |
Return a unique identifier for the concrete type. More... | |
template<typename T > | |
static bool | classof (T val) |
Provide an implementation of 'classof' that compares the type id of the provided value with that of the concrete type. More... | |
static detail::InterfaceMap | getInterfaceMap () |
Returns an interface map for the interfaces registered to this storage user. More... | |
static HasTraitFn | getHasTraitFn () |
Returns the function that returns true if the given Trait ID matches the IDs of any of the traits defined by the storage user. More... | |
template<typename... IfaceModels> | |
static void | attachInterface (MLIRContext &context) |
Attach the given models as implementations of the corresponding interfaces for the concrete storage user class. More... | |
template<typename... Args> | |
static ConcreteT | get (MLIRContext *ctx, Args... args) |
Get or create a new ConcreteT instance within the ctx. More... | |
template<typename... Args> | |
static ConcreteT | getChecked (const Location &loc, Args... args) |
Get or create a new ConcreteT instance within the ctx, defined at the given, potentially unknown, location. More... | |
template<typename... Args> | |
static ConcreteT | getChecked (function_ref< InFlightDiagnostic()> emitErrorFn, MLIRContext *ctx, Args... args) |
Get or create a new ConcreteT instance within the ctx. More... | |
static ConcreteT | getFromOpaquePointer (const void *ptr) |
Get an instance of the concrete type from a void pointer. More... | |
Additional Inherited Members | |
![]() | |
template<typename... Args> | |
LogicalResult | mutate (Args &&...args) |
Mutate the current storage instance. More... | |
ImplType * | getImpl () const |
Utility for easy access to the storage instance. More... | |
![]() | |
template<typename... Args> | |
static LogicalResult | verify (Args... args) |
Default implementation that just returns success. More... | |
SPIR-V struct type.
Two kinds of struct types are supported:
struct A { A* next; };
would be represented in MLIR as:
!spv.struct<A, (!spv.ptr<!spv.struct, Generic>)>
In the above, expressing recursive struct types is accomplished by giving a recursive struct a unique identified and using that identifier in the struct definition for recursive references.
Definition at line 278 of file SPIRVTypes.h.
using mlir::spirv::StructType::OffsetInfo = uint32_t |
Definition at line 284 of file SPIRVTypes.h.
|
static |
Construct a literal StructType with at least one member.
Definition at line 948 of file SPIRVTypes.cpp.
Referenced by mlir::spirv::Deserializer::collect(), createGlobalVarForEntryPointArgument(), mlir::VulkanLayoutUtils::decorateType(), getPushConstantStorageType(), parseStructType(), and wrapInStructAndGetPointer().
void StructType::getCapabilities | ( | SPIRVType::CapabilityArrayRefVector & | capabilities, |
Optional< StorageClass > | storage = llvm::None |
||
) |
Definition at line 1047 of file SPIRVTypes.cpp.
Definition at line 991 of file SPIRVTypes.cpp.
References getNumElements().
Referenced by mlir::VulkanLayoutUtils::decorateType(), mlir::spirv::CompositeType::getElementType(), getRuntimeArrayElementType(), print(), and verifyCoopMatrixMulAdd().
StructType::ElementTypeRange StructType::getElementTypes | ( | ) | const |
Definition at line 996 of file SPIRVTypes.cpp.
References getNumElements().
Referenced by convertStructTypePacked(), and convertStructTypeWithOffset().
|
static |
Construct a (possibly identified) StructType with no members.
Note: this method might fail in a multi-threaded setup if another thread created an identified struct with the same identifier but with different contents before returning. In which case, an empty (default-constructed) StructType is returned.
Definition at line 971 of file SPIRVTypes.cpp.
References mlir::failed(), isIdentified(), and trySetBody().
Referenced by mlir::spirv::Deserializer::collect(), and parseStructType().
void StructType::getExtensions | ( | SPIRVType::ExtensionArrayRefVector & | extensions, |
Optional< StorageClass > | storage = llvm::None |
||
) |
Definition at line 1041 of file SPIRVTypes.cpp.
|
static |
Construct an identified StructType.
This creates a StructType whose body (member types, offset info, and decorations) is not set yet. A call to StructType::trySetBody(...) must follow when the StructType contents are available (e.g. parsed or deserialized).
Note: If another thread creates (or had already created) a struct with the same identifier, that struct will be returned as a result.
Definition at line 961 of file SPIRVTypes.cpp.
Referenced by mlir::spirv::Deserializer::collect(), parseStructType(), and mlir::spirv::Serializer::processTypeDecoration< spirv::RuntimeArrayType >().
StringRef StructType::getIdentifier | ( | ) | const |
For literal structs, return an empty string.
For identified structs, return the struct's identifier.
Definition at line 985 of file SPIRVTypes.cpp.
Referenced by print(), and mlir::spirv::Serializer::processTypeDecoration< spirv::RuntimeArrayType >().
void StructType::getMemberDecorations | ( | SmallVectorImpl< StructType::MemberDecorationInfo > & | memberDecorations | ) | const |
Definition at line 1008 of file SPIRVTypes.cpp.
Referenced by convertStructType(), mlir::VulkanLayoutUtils::decorateType(), and print().
void StructType::getMemberDecorations | ( | unsigned | i, |
SmallVectorImpl< StructType::MemberDecorationInfo > & | decorationsInfo | ||
) | const |
Definition at line 1017 of file SPIRVTypes.cpp.
References getNumElements().
uint64_t StructType::getMemberOffset | ( | unsigned | index | ) | const |
unsigned StructType::getNumElements | ( | ) | const |
Definition at line 989 of file SPIRVTypes.cpp.
Referenced by mlir::VulkanLayoutUtils::decorateType(), mlir::VulkanLayoutUtils::isLegalType(), print(), and verifyCoopMatrixMulAdd().
bool StructType::hasOffset | ( | ) | const |
Definition at line 1001 of file SPIRVTypes.cpp.
Referenced by convertStructType(), mlir::VulkanLayoutUtils::isLegalType(), and print().
bool StructType::isIdentified | ( | ) | const |
Returns true if the StructType is identified.
Definition at line 987 of file SPIRVTypes.cpp.
Referenced by mlir::VulkanLayoutUtils::decorateType(), getEmpty(), print(), and mlir::spirv::Serializer::processTypeDecoration< spirv::RuntimeArrayType >().
LogicalResult StructType::trySetBody | ( | ArrayRef< Type > | memberTypes, |
ArrayRef< OffsetInfo > | offsetInfo = {} , |
||
ArrayRef< MemberDecorationInfo > | memberDecorations = {} |
||
) |
Sets the contents of an incomplete identified StructType.
This method must be called only for identified StructTypes and it must be called only once per instance. Otherwise, failure() is returned.
Definition at line 1035 of file SPIRVTypes.cpp.
Referenced by getEmpty().