MLIR 22.0.0git
mlir::spirv::detail::StructTypeStorage Struct Reference

Type storage for SPIR-V structure types: More...

Inheritance diagram for mlir::spirv::detail::StructTypeStorage:

Public Types

using KeyTy
 A storage key is divided into 2 parts:

Public Member Functions

 StructTypeStorage (StringRef identifier)
 Construct a storage object for an identified struct type.
 StructTypeStorage (unsigned numMembers, Type const *memberTypes, StructType::OffsetInfo const *layoutInfo, unsigned numMemberDecorations, StructType::MemberDecorationInfo const *memberDecorationsInfo, unsigned numStructDecorations, StructType::StructDecorationInfo const *structDecorationsInfo)
 Construct a storage object for a literal struct type.
bool operator== (const KeyTy &key) const
 For identified structs, return true if the given key contains the same identifier.
ArrayRef< TypegetMemberTypes () const
ArrayRef< StructType::OffsetInfogetOffsetInfo () const
ArrayRef< StructType::MemberDecorationInfogetMemberDecorationsInfo () const
ArrayRef< StructType::StructDecorationInfogetStructDecorationsInfo () const
StringRef getIdentifier () const
bool isIdentified () const
LogicalResult mutate (TypeStorageAllocator &allocator, ArrayRef< Type > structMemberTypes, ArrayRef< StructType::OffsetInfo > structOffsetInfo, ArrayRef< StructType::MemberDecorationInfo > structMemberDecorationInfo, ArrayRef< StructType::StructDecorationInfo > structDecorationInfo)
 Sets the struct type content for identified structs.
Public Member Functions inherited from mlir::TypeStorage
const AbstractTypegetAbstractType ()
 Return the abstract type descriptor for this type.

Static Public Member Functions

static StructTypeStorageconstruct (TypeStorageAllocator &allocator, const KeyTy &key)
 If the given key contains a non-empty identifier, this method constructs an identified struct and leaves the rest of the struct type data to be set through a later call to StructType::trySetBody(...).

Public Attributes

llvm::PointerIntPair< Type const *, 1, boolmemberTypesAndIsBodySet
StructType::OffsetInfo const * offsetInfo
unsigned numMembers
unsigned numMemberDecorations
StructType::MemberDecorationInfo const * memberDecorationsInfo
unsigned numStructDecorations
StructType::StructDecorationInfo const * structDecorationsInfo
StringRef identifier

Additional Inherited Members

Protected Member Functions inherited from mlir::TypeStorage
 TypeStorage ()
 This constructor is used by derived classes as part of the TypeUniquer.
Protected Member Functions inherited from mlir::StorageUniquer::BaseStorage
 BaseStorage ()=default

Detailed Description

Type storage for SPIR-V structure types:

Structures are uniqued using:

  • for identified structs:
    • a string identifier;
  • for literal structs:
    • a list of member types;
    • a list of member offset info;
    • a list of member decoration info;
    • a list of struct decoration info.

Identified structures only have a mutable component consisting of:

  • a list of member types;
  • a list of member offset info;
  • a list of member decoration info;
  • a list of struct decoration info.

Definition at line 804 of file SPIRVTypes.cpp.

Member Typedef Documentation

◆ KeyTy

Initial value:

A storage key is divided into 2 parts:

An identified struct type is uniqued only by the first part (field 0) of the key.

A literal struct type is uniqued only by the second part (fields 1, 2, 3 and 4) of the key. The identifier field (field 0) must be empty.

Definition at line 844 of file SPIRVTypes.cpp.

Constructor & Destructor Documentation

◆ StructTypeStorage() [1/2]

mlir::spirv::detail::StructTypeStorage::StructTypeStorage ( StringRef identifier)
inline

Construct a storage object for an identified struct type.

A struct type associated with such storage must call StructType::trySetBody(...) later in order to mutate the storage object providing the actual content.

Definition at line 808 of file SPIRVTypes.cpp.

References false, identifier, memberDecorationsInfo, memberTypesAndIsBodySet, nullptr, numMemberDecorations, numMembers, numStructDecorations, offsetInfo, and structDecorationsInfo.

Referenced by construct().

◆ StructTypeStorage() [2/2]

mlir::spirv::detail::StructTypeStorage::StructTypeStorage ( unsigned numMembers,
Type const * memberTypes,
StructType::OffsetInfo const * layoutInfo,
unsigned numMemberDecorations,
StructType::MemberDecorationInfo const * memberDecorationsInfo,
unsigned numStructDecorations,
StructType::StructDecorationInfo const * structDecorationsInfo )
inline

Construct a storage object for a literal struct type.

A struct type associated with such storage is immutable.

Definition at line 816 of file SPIRVTypes.cpp.

References false, memberDecorationsInfo, memberTypesAndIsBodySet, numMemberDecorations, numMembers, numStructDecorations, offsetInfo, and structDecorationsInfo.

Member Function Documentation

◆ construct()

StructTypeStorage * mlir::spirv::detail::StructTypeStorage::construct ( TypeStorageAllocator & allocator,
const KeyTy & key )
inlinestatic

If the given key contains a non-empty identifier, this method constructs an identified struct and leaves the rest of the struct type data to be set through a later call to StructType::trySetBody(...).

If, on the other hand, the key contains an empty identifier, a literal struct is constructed using the other fields of the key.

Definition at line 870 of file SPIRVTypes.cpp.

References mlir::StorageUniquer::StorageAllocator::allocate(), mlir::StorageUniquer::StorageAllocator::copyInto(), identifier, numMemberDecorations, numStructDecorations, and StructTypeStorage().

◆ getIdentifier()

StringRef mlir::spirv::detail::StructTypeStorage::getIdentifier ( ) const
inline

Definition at line 947 of file SPIRVTypes.cpp.

References identifier.

Referenced by operator==().

◆ getMemberDecorationsInfo()

ArrayRef< StructType::MemberDecorationInfo > mlir::spirv::detail::StructTypeStorage::getMemberDecorationsInfo ( ) const
inline

Definition at line 932 of file SPIRVTypes.cpp.

References memberDecorationsInfo, and numMemberDecorations.

Referenced by mutate(), and operator==().

◆ getMemberTypes()

ArrayRef< Type > mlir::spirv::detail::StructTypeStorage::getMemberTypes ( ) const
inline

Definition at line 921 of file SPIRVTypes.cpp.

References memberTypesAndIsBodySet, and numMembers.

Referenced by mutate(), and operator==().

◆ getOffsetInfo()

ArrayRef< StructType::OffsetInfo > mlir::spirv::detail::StructTypeStorage::getOffsetInfo ( ) const
inline

Definition at line 925 of file SPIRVTypes.cpp.

References numMembers, and offsetInfo.

Referenced by mutate(), and operator==().

◆ getStructDecorationsInfo()

ArrayRef< StructType::StructDecorationInfo > mlir::spirv::detail::StructTypeStorage::getStructDecorationsInfo ( ) const
inline

Definition at line 940 of file SPIRVTypes.cpp.

References numStructDecorations, and structDecorationsInfo.

Referenced by mutate(), and operator==().

◆ isIdentified()

bool mlir::spirv::detail::StructTypeStorage::isIdentified ( ) const
inline

Definition at line 949 of file SPIRVTypes.cpp.

References identifier.

Referenced by mutate(), and operator==().

◆ mutate()

LogicalResult mlir::spirv::detail::StructTypeStorage::mutate ( TypeStorageAllocator & allocator,
ArrayRef< Type > structMemberTypes,
ArrayRef< StructType::OffsetInfo > structOffsetInfo,
ArrayRef< StructType::MemberDecorationInfo > structMemberDecorationInfo,
ArrayRef< StructType::StructDecorationInfo > structDecorationInfo )
inline

Sets the struct type content for identified structs.

Calling this method is only valid for identified structs.

Fails under the following conditions:

  • If called for a literal struct;
  • If called for an identified struct whose body was set before (through a call to this method) but with different contents from the passed arguments.

Definition at line 960 of file SPIRVTypes.cpp.

References mlir::StorageUniquer::StorageAllocator::copyInto(), getMemberDecorationsInfo(), getMemberTypes(), getOffsetInfo(), getStructDecorationsInfo(), isIdentified(), memberDecorationsInfo, memberTypesAndIsBodySet, numMemberDecorations, numMembers, numStructDecorations, offsetInfo, structDecorationsInfo, and success().

◆ operator==()

bool mlir::spirv::detail::StructTypeStorage::operator== ( const KeyTy & key) const
inline

For identified structs, return true if the given key contains the same identifier.

For literal structs, return true if the given key contains a matching list of member types + offset info + decoration info.

Definition at line 854 of file SPIRVTypes.cpp.

References getIdentifier(), getMemberDecorationsInfo(), getMemberTypes(), getOffsetInfo(), getStructDecorationsInfo(), and isIdentified().

Member Data Documentation

◆ identifier

StringRef mlir::spirv::detail::StructTypeStorage::identifier

Definition at line 1010 of file SPIRVTypes.cpp.

Referenced by construct(), getIdentifier(), isIdentified(), and StructTypeStorage().

◆ memberDecorationsInfo

StructType::MemberDecorationInfo const* mlir::spirv::detail::StructTypeStorage::memberDecorationsInfo

◆ memberTypesAndIsBodySet

llvm::PointerIntPair<Type const *, 1, bool> mlir::spirv::detail::StructTypeStorage::memberTypesAndIsBodySet

Definition at line 1003 of file SPIRVTypes.cpp.

Referenced by getMemberTypes(), mutate(), StructTypeStorage(), and StructTypeStorage().

◆ numMemberDecorations

unsigned mlir::spirv::detail::StructTypeStorage::numMemberDecorations

◆ numMembers

unsigned mlir::spirv::detail::StructTypeStorage::numMembers

◆ numStructDecorations

unsigned mlir::spirv::detail::StructTypeStorage::numStructDecorations

◆ offsetInfo

StructType::OffsetInfo const* mlir::spirv::detail::StructTypeStorage::offsetInfo

Definition at line 1004 of file SPIRVTypes.cpp.

Referenced by getOffsetInfo(), mutate(), StructTypeStorage(), and StructTypeStorage().

◆ structDecorationsInfo

StructType::StructDecorationInfo const* mlir::spirv::detail::StructTypeStorage::structDecorationsInfo

The documentation for this struct was generated from the following file: