Talvos
0.1
SPIR-V interpreter and dynamic analysis framework
|
This class represents an instruction result. More...
#include <talvos/Object.h>
Public Member Functions | |
Object () | |
Create an empty, uninitialized object. More... | |
Object (const Type *Ty, const uint8_t *Data=nullptr) | |
Allocate an object with type Ty . More... | |
template<typename T > | |
Object (const Type *Ty, T Value) | |
Allocate an object with type Ty , initializing it with Value . More... | |
~Object () | |
Destroy this object. More... | |
Object (const Object &Src) | |
Copy-construct a new object, cloning the data from Src . More... | |
Object & | operator= (const Object &Src) |
Copy-assign to this object, cloning the data from Src . More... | |
Object (Object &&Src) noexcept | |
Move-construct an object, taking the data from Src . More... | |
Object | extract (const std::vector< uint32_t > &Indices) const |
Extract an element from a composite object. More... | |
template<typename T > | |
T | get (uint32_t Element=0) const |
Get the value of this object as a scalar of type T . More... | |
uint8_t * | getData () |
Returns a mutable pointer to the raw data backing this object. More... | |
const uint8_t * | getData () const |
Returns an immutable pointer to the raw data backing this object. More... | |
const DescriptorElement * | getDescriptorElements () const |
Returns the descriptor array element information. More... | |
const PtrMatrixLayout & | getMatrixLayout () const |
Get the matrix layout for this object. More... | |
const Type * | getType () const |
Returns the type of this object. More... | |
void | insert (const std::vector< uint32_t > &Indices, const Object &Element) |
Insert the value of Element into a composite object. More... | |
operator bool () const | |
Returns true if this object has been allocated. More... | |
template<typename T > | |
void | set (T Value, uint32_t Element=0) |
Set the value of this object to a scalar of type T . More... | |
void | setDescriptorElements (const DescriptorElement *DAE) |
Set the descriptor array elements for this object. More... | |
void | setMatrixLayout (const PtrMatrixLayout &ML) |
Set the matrix layout for this object. More... | |
void | store (Memory &Mem, uint64_t Address) const |
Store the value of this object to memory at Address . More... | |
void | store (Memory &Mem, const Object &Pointer) const |
Store the value of this object to memory at the address in Pointer . More... | |
void | zero () |
Set all of the value bits in this object to zero. More... | |
Static Public Member Functions | |
static Object | load (const Type *Ty, const Memory &Mem, uint64_t Address) |
Create an object of type Ty from the data at Address . More... | |
static Object | load (const Type *Ty, const Memory &Mem, const Object &Pointer) |
Create an object of type Ty from the data at the address in Pointer . More... | |
Private Attributes | |
const Type * | Ty |
The type of this object. More... | |
uint8_t * | Data |
The raw data backing this object. More... | |
PtrMatrixLayout | MatrixLayout |
The memory layout of a matrix that this object points to. More... | |
const DescriptorElement * | DescriptorElements = nullptr |
Descriptor array element information. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &Stream, const Object &O) |
Allow an Object to be inserted into an output stream. More... | |
This class represents an instruction result.
Instances of this class have a Type and a backing data store.
|
inline |
talvos::Object::Object | ( | const Type * | Ty, |
const uint8_t * | Data = nullptr |
||
) |
Allocate an object with type Ty
.
If Data
is nullptr, the object data will be left uninitialized. Otherwise, the object data will be copied from Data
.
Definition at line 22 of file Object.cpp.
talvos::Object::Object | ( | const Type * | Ty, |
T | Value | ||
) |
Allocate an object with type Ty
, initializing it with Value
.
Ty
must be a scalar type, and its size must match sizeof(T)
.
Definition at line 31 of file Object.cpp.
talvos::Object::~Object | ( | ) |
Destroy this object.
Definition at line 38 of file Object.cpp.
talvos::Object::Object | ( | const Object & | Src | ) |
Copy-construct a new object, cloning the data from Src
.
Definition at line 40 of file Object.cpp.
|
noexcept |
Move-construct an object, taking the data from Src
.
Definition at line 66 of file Object.cpp.
Object talvos::Object::extract | ( | const std::vector< uint32_t > & | Indices | ) | const |
Extract an element from a composite object.
Definition at line 75 of file Object.cpp.
T talvos::Object::get | ( | uint32_t | Element = 0 | ) | const |
Get the value of this object as a scalar of type T
.
The type of this object must be either a scalar or a vector, and the size of the scalar type must match sizeof(T)
.
Definition at line 97 of file Object.cpp.
|
inline |
|
inline |
const DescriptorElement * talvos::Object::getDescriptorElements | ( | ) | const |
Returns the descriptor array element information.
Definition at line 106 of file Object.cpp.
const PtrMatrixLayout & talvos::Object::getMatrixLayout | ( | ) | const |
Get the matrix layout for this object.
Only valid for objects that are pointers to matrix or vector types.
Definition at line 111 of file Object.cpp.
|
inline |
void talvos::Object::insert | ( | const std::vector< uint32_t > & | Indices, |
const Object & | Element | ||
) |
Insert the value of Element
into a composite object.
Definition at line 118 of file Object.cpp.
Create an object of type Ty
from the data at Address
.
Definition at line 137 of file Object.cpp.
Create an object of type Ty
from the data at the address in Pointer
.
Definition at line 146 of file Object.cpp.
|
inline |
Copy-assign to this object, cloning the data from Src
.
Definition at line 53 of file Object.cpp.
void talvos::Object::set | ( | T | Value, |
uint32_t | Element = 0 |
||
) |
Set the value of this object to a scalar of type T
.
The type of this object must be either a scalar or a vector, and the size of the scalar type must match sizeof(T)
.
Definition at line 295 of file Object.cpp.
void talvos::Object::setDescriptorElements | ( | const DescriptorElement * | DAE | ) |
Set the descriptor array elements for this object.
Only valid for objects that are pointers to arrays.
Definition at line 304 of file Object.cpp.
void talvos::Object::setMatrixLayout | ( | const PtrMatrixLayout & | ML | ) |
Set the matrix layout for this object.
Only valid for objects that are pointers to matrix or vector types.
Definition at line 310 of file Object.cpp.
void talvos::Object::store | ( | Memory & | Mem, |
uint64_t | Address | ||
) | const |
Store the value of this object to memory at Address
.
Definition at line 317 of file Object.cpp.
Store the value of this object to memory at the address in Pointer
.
Definition at line 323 of file Object.cpp.
void talvos::Object::zero | ( | ) |
Set all of the value bits in this object to zero.
Definition at line 367 of file Object.cpp.
|
friend |
Allow an Object to be inserted into an output stream.
Converts the value of this object to a human readable format.
Definition at line 283 of file Object.cpp.
|
private |
|
private |
|
private |