pub struct Instruction {
pub op: Op,
pub result: Option<(ValueId, TypeId)>,
pub block: usize,
pub at: usize,
pub flags: u64,
pub precise: bool,
pub attachments: Vec<Attachment>,
}Expand description
An instruction of a function body.
Fields§
§op: OpWhat it does.
result: Option<(ValueId, TypeId)>The result’s value id and type, when the instruction produces one.
block: usizeThe basic block it belongs to.
at: usizeBit offset of its record.
flags: u64The optimisation flags its record states (0 for none): for an integer add, sub, mul or shl bit 0 is
nuw and bit 1 nsw; for udiv, sdiv, lshr and ashr bit 0 is exact; for a float operation or
comparison they are the fast-math flags (bit 0 fast, then nnan, ninf, nsz and arcp).
precise: boolThe instruction carries the dx.precise attachment, which the compiler writes for HLSL’s precise: the value
is not to be fused or reassociated. In skate.’s stock programs it is on calls only: 88,541 tertiary (mad),
13,005 loadInput, 3,546 unary, 1,421 dot3, 331 legacyF16ToF32, 307 binary, 213 dot4 and 105 dot2,
in vertex programs (107,109 instructions in 3,185 of 3,341) and compute programs (360 in 12), in no pixel
program; none of Elden Ring’s has it.
attachments: Vec<Attachment>The metadata attached to the instruction, in the order the file stores the pairs (dx.precise among them).