Mosa.Compiler.Framework.RegisterAllocator.GreedyRegisterAllocator.GetMoveHints C# (CSharp) Method

GetMoveHints() private method

private GetMoveHints ( LiveInterval liveInterval ) : Mosa.Compiler.Framework.RegisterAllocator.MoveHint[]
liveInterval LiveInterval
return Mosa.Compiler.Framework.RegisterAllocator.MoveHint[]
        private MoveHint[] GetMoveHints(LiveInterval liveInterval)
        {
            MoveHint startMoveHint = null;
            MoveHint endMoveHint = null;
            moveHints.TryGetValue(liveInterval.Start, out startMoveHint);

            if (!liveInterval.End.IsBlockStartInstruction)
                moveHints.TryGetValue(liveInterval.End, out endMoveHint);

            int cnt = (startMoveHint == null ? 0 : 1) + (endMoveHint == null ? 0 : 1);

            if (cnt == 0)
                return null;

            var hints = new MoveHint[cnt];

            if (startMoveHint != null && endMoveHint != null)
            {
                // sorted by bonus
                if (startMoveHint.Bonus > endMoveHint.Bonus)
                {
                    hints[0] = startMoveHint;
                    hints[1] = endMoveHint;
                }
                else
                {
                    hints[0] = endMoveHint;
                    hints[1] = startMoveHint;
                }
            }
            else
            {
                if (startMoveHint != null)
                {
                    hints[0] = startMoveHint;
                }
                else
                {
                    hints[0] = endMoveHint;
                }
            }

            return hints;
        }