Talvos
0.1
SPIR-V interpreter and dynamic analysis framework
|
This class represents a SPIR-V type. More...
#include <talvos/Type.h>
Public Types | |
enum | TypeId { VOID, BOOL, INT, FLOAT, VECTOR, MATRIX, IMAGE, SAMPLER, SAMPLED_IMAGE, ARRAY, RUNTIME_ARRAY, STRUCT, POINTER, FUNCTION } |
Identifiers that distinguish between different base types. More... | |
Public Member Functions | |
uint32_t | getBitWidth () const |
Returns the bit-width of this type. More... | |
uint32_t | getDimensionality () const |
Returns the dimensionality of an image type. More... | |
uint32_t | getElementCount () const |
Returns the number of elements in this array, struct, or vector type. More... | |
size_t | getElementOffset (uint64_t Index) const |
Returns the byte offset of the element at Index . More... | |
const Type * | getElementType (uint64_t Index=0) const |
Returns the type of the element at Index . More... | |
const Type * | getScalarType () const |
Returns the element type for vector types, or this for scalar types. More... | |
size_t | getSize () const |
Returns the size of this type in bytes. More... | |
uint32_t | getStorageClass () const |
Returns the storage class of this type. More... | |
const std::map< uint32_t, uint32_t > & | getStructMemberDecorations (uint32_t Index) const |
Returns the decoration map for the structure member at Index . More... | |
TypeId | getTypeId () const |
Returns the type ID of this type. More... | |
bool | isArray () const |
Returns true if this is an array type. More... | |
bool | isArrayedImage () const |
Returns the Arrayed flag of an image type. More... | |
bool | isBool () const |
Returns true if this is a bool type. More... | |
bool | isComposite () const |
Returns true if this is an array, struct, or vector type. More... | |
bool | isFloat () const |
Returns true if this is a floating point type. More... | |
bool | isInt () const |
Returns true if this is an integer type. More... | |
bool | isMatrix () const |
Returns true if this is a matrix type. More... | |
bool | isPointer () const |
Returns true if this is a pointer type. More... | |
bool | isScalar () const |
Returns true if this is a scalar type. More... | |
bool | isStruct () const |
Returns true if this is a struct type. More... | |
bool | isVector () const |
Returns true if this is a vector type. More... | |
Static Public Member Functions | |
static std::unique_ptr< Type > | getArray (const Type *ElemType, uint32_t ElementCount, uint32_t ArrayStride) |
Create an array type. More... | |
static std::unique_ptr< Type > | getBool () |
Create a boolean type. More... | |
static std::unique_ptr< Type > | getFloat (uint32_t Width) |
Create a floating point type. More... | |
static std::unique_ptr< Type > | getInt (uint32_t Width) |
Create an integer type. More... | |
static std::unique_ptr< Type > | getFunction (const Type *ReturnType, const std::vector< const Type * > &ArgTypes) |
Create a function type. More... | |
static std::unique_ptr< Type > | getImage (const Type *SampledType, uint32_t Dim, uint32_t Depth, bool Arrayed, bool MS, uint32_t Sampled, uint32_t Format) |
Create an image type. More... | |
static std::unique_ptr< Type > | getMatrix (const Type *ColumnType, uint32_t NumColumns) |
Create a matrix type. More... | |
static std::unique_ptr< Type > | getPointer (uint32_t StorageClass, const Type *ElemType, uint32_t ArrayStride) |
Create a pointer type. More... | |
static std::unique_ptr< Type > | getRuntimeArray (const Type *ElemType, uint32_t ArrayStride) |
Create a runtime array type. More... | |
static std::unique_ptr< Type > | getSampledImage (const Type *ImageType) |
Create a sampled image type. More... | |
static std::unique_ptr< Type > | getSampler () |
Create a sampler type. More... | |
static std::unique_ptr< Type > | getStruct (const StructElementTypeList &ElemTypes) |
Create a structure type. More... | |
static std::unique_ptr< Type > | getVector (const Type *ElemType, uint32_t ElemCount) |
Create a vector type. More... | |
static std::unique_ptr< Type > | getVoid () |
Create a void type. More... | |
Private Member Functions | |
Type (TypeId Id, size_t ByteSize) | |
Create a new type. More... | |
Private Attributes | |
TypeId | Id |
The ID of this type. More... | |
size_t | ByteSize |
The size of this type in bytes. More... | |
uint32_t | BitWidth |
Valid for integer and floating point types. More... | |
uint32_t | StorageClass |
Valid for pointer types. More... | |
const Type * | ElementType |
Valid for pointer and composite types. More... | |
uint32_t | ElementCount |
Valid for composite types. More... | |
uint32_t | ArrayStride |
Valid for array and pointer types. More... | |
StructElementTypeList | ElementTypes |
Valid for struct types. More... | |
std::vector< size_t > | ElementOffsets |
Valid for struct types. More... | |
const Type * | ReturnType |
Valid for function types. More... | |
std::vector< const Type * > | ArgumentTypes |
Valid for function types. More... | |
uint32_t | Dimensionality |
Valid for image types. More... | |
uint32_t | Depth |
Valid for image types. More... | |
bool | Arrayed |
Valid for image types. More... | |
bool | Multisampled |
Valid for image types. More... | |
uint32_t | Sampled |
Valid for image types. More... | |
uint32_t | Format |
Valid for image types. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &Stream, const Type *Ty) |
Allow a Type to be inserted into an output stream. More... | |
This class represents a SPIR-V type.
Factory methods are provided to create specific type instances. Some methods of this class are only valid for certain types.
enum talvos::Type::TypeId |
|
inlineprivate |
uint32_t talvos::Type::getBitWidth | ( | ) | const |
|
static |
|
inline |
|
inline |
size_t talvos::Type::getElementOffset | ( | uint64_t | Index | ) | const |
const Type * talvos::Type::getElementType | ( | uint64_t | Index = 0 | ) | const |
|
static |
|
static |
|
static |
const Type * talvos::Type::getScalarType | ( | ) | const |
|
inline |
uint32_t talvos::Type::getStorageClass | ( | ) | const |
|
static |
const std::map< uint32_t, uint32_t > & talvos::Type::getStructMemberDecorations | ( | uint32_t | Index | ) | const |
|
inline |
|
static |
|
inline |
|
inline |
|
inline |
bool talvos::Type::isComposite | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
bool talvos::Type::isScalar | ( | ) | const |
|
inline |
|
inline |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |