/// <summary> /// Mark this low register as in use by the given original register. /// </summary> public void SetInUseBy(Register originalRegister, RType type) { if (OriginalRegister != null) { throw new InvalidOperationException("Register state is still in use"); } if (type == RType.Wide) { if (next == null) { throw new InvalidOperationException("Register state cannot hold a wide"); } if (next.OriginalRegister != null) { throw new InvalidOperationException("Register state.next is still in use"); } } OriginalRegister = originalRegister; isWide = (type == RType.Wide); this.type = type; if (isWide) { next.isWide = false; next.OriginalRegister = originalRegister; next.type = RType.Wide2; next.wideStart = this; } Mapping = new RegisterSpillingMapping(OriginalRegister, LowRegister); }
/// <summary> /// Mark this low register state as no longer in use. /// </summary> private void Clear() { if (isWide) { next.Clear(); } OriginalRegister = null; SaveToOriginalNeeded = false; isWide = false; type = RType.Value; wideStart = null; Mapping = null; }
/// <summary> /// Add an entry /// </summary> public void Add(RegisterSpillingMapping mapping) { mappings.Add(mapping); }
/// <summary> /// Mark this low register as in use by the given original register. /// </summary> public void SetInUseBy(Register originalRegister, RType type) { if (OriginalRegister != null) throw new InvalidOperationException("Register state is still in use"); if (type == RType.Wide) { if (next == null) throw new InvalidOperationException("Register state cannot hold a wide"); if (next.OriginalRegister != null) throw new InvalidOperationException("Register state.next is still in use"); } OriginalRegister = originalRegister; isWide = (type == RType.Wide); this.type = type; if (isWide) { next.isWide = false; next.OriginalRegister = originalRegister; next.type = RType.Wide2; next.wideStart = this; } Mapping = new RegisterSpillingMapping(OriginalRegister, LowRegister); }
/// <summary> /// Mark this low register state as no longer in use. /// </summary> private void Clear() { if (isWide) next.Clear(); OriginalRegister = null; SaveToOriginalNeeded = false; isWide = false; type = RType.Value; wideStart = null; Mapping = null; }