wip
[bigint-presentation-code.git] / register_allocator / src / loc_set.rs
index 8b7610a2d214174d80a54a5d9a6443ebabc8e206..a9d85652651a32fad6013bd5d6d072d07ae09bfd 100644 (file)
@@ -10,6 +10,7 @@ use serde::{Deserialize, Serialize};
 use std::{
     borrow::{Borrow, Cow},
     cell::Cell,
+    collections::BTreeMap,
     fmt,
     hash::Hash,
     iter::{FusedIterator, Peekable},
@@ -22,23 +23,21 @@ use std::{
 
 #[derive(Deserialize)]
 struct LocSetSerialized {
-    starts: EnumMap<LocKind, BigUint>,
-    ty: Option<Ty>,
+    reg_len_to_starts_map: BTreeMap<NonZeroU32, EnumMap<LocKind, BigUint>>,
 }
 
 impl TryFrom<LocSetSerialized> for LocSet {
     type Error = Error;
 
     fn try_from(value: LocSetSerialized) -> Result<Self, Self::Error> {
-        Self::from_parts(value.starts, value.ty)
+        Self::from_reg_len_to_starts_map(value.reg_len_to_starts_map)
     }
 }
 
 #[derive(Clone, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
 #[serde(try_from = "LocSetSerialized")]
 pub struct LocSet {
-    starts: EnumMap<LocKind, BigUint>,
-    ty: Option<Ty>,
+    reg_len_to_starts_map: BTreeMap<NonZeroU32, EnumMap<LocKind, BigUint>>,
 }
 
 /// computes same value as `a & !b`, but more efficiently