pub struct Instruction {
pub word: usize,
pub opcode: u16,
pub control: u32,
pub extensions: Vec<u32>,
pub saturate: bool,
pub nonzero: bool,
pub operands: Vec<Operand>,
pub function: Option<u32>,
}Expand description
An instruction as stored.
Fields§
§word: usizeThe instruction’s first word in the token stream.
opcode: u16The opcode token’s low 11 bits (see opcode_name).
control: u32The opcode token’s bits 11 to 23: saturate and the opcode-specific controls (the test of a conditional, a
resinfo return type, the interpolation of a declaration).
extensions: Vec<u32>The opcode’s extended tokens as stored (sample offsets, resource dimension, return type).
saturate: boolThe saturate bit of the opcode token.
nonzero: boolA conditional (if, breakc, continuec) taken when its operand is nonzero (_nz), else when zero (_z).
operands: Vec<Operand>The operands, destination first where the instruction has one.
function: Option<u32>The call site an interface_call stores before its operand (the entry of the interface’s function tables it
calls); None for other instructions.
Implementations§
Source§impl Instruction
impl Instruction
Sourcepub fn precise_mask(&self) -> u8
pub fn precise_mask(&self) -> u8
The components the instruction is marked precise for (control bits 8 to 11, the token’s bits 19 to 22): bit 0 x
to bit 3 w, zero where it is not marked. The compiler marks every instruction of a precise expression.
Sourcepub fn sync_flags(&self) -> Option<SyncFlags>
pub fn sync_flags(&self) -> Option<SyncFlags>
What a sync instruction waits for; None for any other instruction.
Sourcepub fn info_return(&self) -> Option<InfoReturn>
pub fn info_return(&self) -> Option<InfoReturn>
The type a resinfo or sample_info returns; None for any other instruction, and for a return type the
token format does not define.
Source§impl Instruction
impl Instruction
Sourcepub fn sample_offset(&self) -> Option<[i32; 3]>
pub fn sample_offset(&self) -> Option<[i32; 3]>
The sample offsets of the extended token of kind 1 (_aoffimmi), if the instruction has one.
Sourcepub fn resource_dimension(&self) -> Option<(u32, u32)>
pub fn resource_dimension(&self) -> Option<(u32, u32)>
The resource dimension and structured stride of the extended token of kind 2.
Sourcepub fn return_type(&self) -> Option<u32>
pub fn return_type(&self) -> Option<u32>
The return-type token of the extended token of kind 3 (four nibbles).
Sourcepub fn format(&self) -> Option<OperandFormat>
pub fn format(&self) -> Option<OperandFormat>
The opcode’s operand format (see operand_format); decode has checked the operand count against it.
Sourcepub fn destinations_and_sources(&self) -> Option<(&[Operand], &[Operand])>
pub fn destinations_and_sources(&self) -> Option<(&[Operand], &[Operand])>
The destination operands and the source operands, split as the opcode’s format says; None for an opcode
with no format.