MLIR  16.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
mlir::spirv::detail::StructTypeStorage Struct Reference

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

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

Public Types

using KeyTy = std::tuple< StringRef, ArrayRef< Type >, ArrayRef< StructType::OffsetInfo >, ArrayRef< StructType::MemberDecorationInfo > >
 A storage key is divided into 2 parts: More...
 

Public Member Functions

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

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(...). More...
 

Public Attributes

llvm::PointerIntPair< Type const *, 1, bool > memberTypesAndIsBodySet
 
StructType::OffsetInfo const * offsetInfo
 
unsigned numMembers
 
unsigned numMemberDecorations
 
StructType::MemberDecorationInfo const * memberDecorationsInfo
 
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. More...
 
- Protected Member Functions inherited from mlir::StorageUniquer::BaseStorage
 BaseStorage ()=default
 

Detailed Description

Type storage for SPIR-V structure types:

Structures are uniqued using:

Identified structures only have a mutable component consisting of:

Definition at line 783 of file SPIRVTypes.cpp.

Member Typedef Documentation

◆ KeyTy

A storage key is divided into 2 parts:

  • for identified structs:
    • a StringRef representing the struct identifier;
  • for literal structs:
    • an ArrayRef<Type> for member types;
    • an ArrayRef<StructType::OffsetInfo> for member offset info;
    • an ArrayRef<StructType::MemberDecorationInfo> for member decoration info.

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, and 3) of the key. The identifier field (field 0) must be empty.

Definition at line 818 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 787 of file SPIRVTypes.cpp.

◆ StructTypeStorage() [2/2]

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

Construct a storage object for a literal struct type.

A struct type associated with such storage is immutable.

Definition at line 794 of file SPIRVTypes.cpp.

Member Function Documentation

◆ construct()

static 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 841 of file SPIRVTypes.cpp.

References mlir::StorageUniquer::StorageAllocator::allocate(), and mlir::StorageUniquer::StorageAllocator::copyInto().

◆ getIdentifier()

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

Definition at line 903 of file SPIRVTypes.cpp.

◆ getMemberDecorationsInfo()

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

Definition at line 895 of file SPIRVTypes.cpp.

◆ getMemberTypes()

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

Definition at line 884 of file SPIRVTypes.cpp.

◆ getOffsetInfo()

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

Definition at line 888 of file SPIRVTypes.cpp.

◆ isIdentified()

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

Definition at line 905 of file SPIRVTypes.cpp.

◆ mutate()

LogicalResult mlir::spirv::detail::StructTypeStorage::mutate ( TypeStorageAllocator allocator,
ArrayRef< Type structMemberTypes,
ArrayRef< StructType::OffsetInfo structOffsetInfo,
ArrayRef< StructType::MemberDecorationInfo structMemberDecorationInfo 
)
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 915 of file SPIRVTypes.cpp.

References mlir::StorageUniquer::StorageAllocator::copyInto(), mlir::failure(), and mlir::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 825 of file SPIRVTypes.cpp.

Member Data Documentation

◆ identifier

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

Definition at line 957 of file SPIRVTypes.cpp.

◆ memberDecorationsInfo

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

Definition at line 956 of file SPIRVTypes.cpp.

◆ memberTypesAndIsBodySet

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

Definition at line 952 of file SPIRVTypes.cpp.

◆ numMemberDecorations

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

Definition at line 955 of file SPIRVTypes.cpp.

◆ numMembers

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

Definition at line 954 of file SPIRVTypes.cpp.

◆ offsetInfo

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

Definition at line 953 of file SPIRVTypes.cpp.


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