iridia_interface/facts.rs
1//! How large a program is, in the unit its reader counts.
2use serde::Serialize;
3
4/// The source's counting unit. DXBC counts decoded instructions including control flow, excluding declarations;
5/// DXIL counts LLVM instructions
6/// in the functions the lifter reads. Neither is an executed instruction count or an IR expression count.
7#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)]
8#[serde(rename_all = "snake_case")]
9pub enum InstructionUnit {
10 /// Instructions of a DXBC shader (Shader Model 4 or 5) as decoded.
11 DxbcInstructions,
12 /// Instructions of a DXIL shader (Shader Model 6) in the functions the lifter reads.
13 DxilInstructions,
14}
15/// How many instructions a program has, in the unit that says how they were counted.
16#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)]
17pub struct InstructionCount {
18 /// The number of instructions counted.
19 pub count: u64,
20 /// What `count` counts; counts of different units are not comparable.
21 pub unit: InstructionUnit,
22}