aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/CodeGen/RegisterAllocators/LiveRange.cs
blob: b5faeffd59365a6a48238affc30a54f9be1dca93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;

namespace ARMeilleure.CodeGen.RegisterAllocators
{
    struct LiveRange : IComparable<LiveRange>
    {
        public int Start { get; }
        public int End   { get; }

        public LiveRange(int start, int end)
        {
            Start = start;
            End   = end;
        }

        public int CompareTo(LiveRange other)
        {
            if (Start < other.End && other.Start < End)
            {
                return 0;
            }

            return Start.CompareTo(other.Start);
        }

        public override string ToString()
        {
            return $"[{Start}, {End}[";
        }
    }
}