|
Talvos
0.1
SPIR-V interpreter and dynamic analysis framework
|
This class represents a SPIR-V instruction. More...
#include <talvos/Instruction.h>
Public Member Functions | |
| Instruction (uint16_t Opcode, uint16_t NumOperands, const uint32_t *Operands, const Type *ResultType) | |
| Create a new instruction. More... | |
| ~Instruction () | |
| Destroy this instruction. More... | |
| uint16_t | getNumOperands () const |
| Returns the number of operands this instruction has. More... | |
| uint16_t | getOpcode () const |
| Returns the opcode. More... | |
| uint32_t | getOperand (unsigned i) const |
Returns the operand at index i;. More... | |
| const uint32_t * | getOperands () const |
| Returns the operands. More... | |
| const Type * | getResultType () const |
Returns the result type of this instruction, or nullptr if it does not produce a result. More... | |
| void | insertAfter (Instruction *I) |
Insert this instruction into a sequence, immediately following I. More... | |
| const Instruction * | next () const |
| Get the next instruction in the containing block. More... | |
| const Instruction * | previous () const |
| Get the previous instruction in the containing block. More... | |
| void | print (std::ostream &O, bool Align=true) const |
Print a human-readable form of this instruction to O. More... | |
| Instruction (const Instruction &)=delete | |
| const Instruction & | operator= (const Instruction &)=delete |
Static Public Member Functions | |
| static const char * | opcodeToString (uint16_t Opcode) |
| Return the string representation of an instruction opcode. More... | |
Private Attributes | |
| const Type * | ResultType |
| The type of the instruction result. More... | |
| uint16_t | Opcode |
| The instruction opcode. More... | |
| uint16_t | NumOperands |
| The number of operands in this instruction. More... | |
| uint32_t * | Operands |
| The operand values. More... | |
| std::unique_ptr< Instruction > | Next |
| The next instruction in the block. More... | |
| const Instruction * | Previous |
| The previous instruction in the block. More... | |
This class represents a SPIR-V instruction.
An instance of this class has an opcode, a set of operands, and possibly a return type. It is also a node in a linked list of instructions, forming a sequence that represents the instructions within a block. After creation, an Instruction should be inserted into a instruction sequence or the beginning of a block.
Definition at line 27 of file Instruction.h.
| talvos::Instruction::Instruction | ( | uint16_t | Opcode, |
| uint16_t | NumOperands, | ||
| const uint32_t * | Operands, | ||
| const Type * | ResultType | ||
| ) |
Create a new instruction.
Definition at line 19 of file Instruction.cpp.
|
inline |
Destroy this instruction.
If the instruction has been inserted into a sequence, this will also destroy any instructions that follow it.
Definition at line 37 of file Instruction.h.
|
delete |
|
inline |
Returns the number of operands this instruction has.
Definition at line 46 of file Instruction.h.
|
inline |
Returns the opcode.
Definition at line 49 of file Instruction.h.
|
inline |
Returns the operand at index i;.
Definition at line 52 of file Instruction.h.
|
inline |
Returns the operands.
Definition at line 55 of file Instruction.h.
|
inline |
Returns the result type of this instruction, or nullptr if it does not produce a result.
Definition at line 59 of file Instruction.h.
| void talvos::Instruction::insertAfter | ( | Instruction * | I | ) |
Insert this instruction into a sequence, immediately following I.
This transfers ownership of this instruction to the containing block.
Definition at line 32 of file Instruction.cpp.
|
inline |
Get the next instruction in the containing block.
Definition at line 68 of file Instruction.h.
|
static |
Return the string representation of an instruction opcode.
Definition at line 72 of file Instruction.cpp.
|
delete |
|
inline |
Get the previous instruction in the containing block.
Definition at line 73 of file Instruction.h.
| void talvos::Instruction::print | ( | std::ostream & | O, |
| bool | Align = true |
||
| ) | const |
Print a human-readable form of this instruction to O.
If Align is true then whitespace will be added to align output with any other instructions printed using this method.
Definition at line 43 of file Instruction.cpp.
|
private |
The next instruction in the block.
Definition at line 89 of file Instruction.h.
|
private |
The number of operands in this instruction.
Definition at line 86 of file Instruction.h.
|
private |
The instruction opcode.
Definition at line 85 of file Instruction.h.
|
private |
The operand values.
Definition at line 87 of file Instruction.h.
|
private |
The previous instruction in the block.
Definition at line 91 of file Instruction.h.
|
private |
The type of the instruction result.
Definition at line 84 of file Instruction.h.
1.8.6