1 use crate::HashMap; 2 use crate::ir::ValueLabel; 3 use crate::machinst::Reg; 4 use alloc::vec::Vec; 5 6 #[cfg(feature = "enable-serde")] 7 use serde_derive::{Deserialize, Serialize}; 8 9 /// Value location range. 10 #[derive(Debug, Clone, Copy, PartialEq, Eq)] 11 #[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))] 12 pub struct ValueLocRange { 13 /// The ValueLoc containing a ValueLabel during this range. 14 pub loc: LabelValueLoc, 15 /// The start of the range. It is an offset in the generated code. 16 pub start: u32, 17 /// The end of the range. It is an offset in the generated code. 18 pub end: u32, 19 } 20 21 /// The particular location for a value. 22 #[derive(Debug, Clone, Copy, PartialEq, Eq)] 23 #[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))] 24 pub enum LabelValueLoc { 25 /// Register. 26 Reg(Reg), 27 /// Offset from the Canonical Frame Address (aka CFA). 28 CFAOffset(i64), 29 } 30 31 /// Resulting map of Value labels and their ranges/locations. 32 pub type ValueLabelsRanges = HashMap<ValueLabel, Vec<ValueLocRange>>; 33