Skip to main content

iridia_ir/interface/
facts.rs

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