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

PreferBlockBoundaryIntervalSplit() private method

private PreferBlockBoundaryIntervalSplit ( LiveInterval liveInterval, SlotIndex at, bool addToQueue ) : bool
liveInterval LiveInterval
at SlotIndex
addToQueue bool
return bool
        private bool PreferBlockBoundaryIntervalSplit(LiveInterval liveInterval, SlotIndex at, bool addToQueue)
        {
            var low = GetLowerOptimalSplitLocation(liveInterval, at);
            var high = GetUpperOptimalSplitLocation(liveInterval, at);

            IList<LiveInterval> intervals;

            if (liveInterval.Start == low)
            {
                if (!liveInterval.LiveRange.CanSplitAt(high))
                    return false;

                intervals = liveInterval.SplitAt(high);
            }
            else if (high == liveInterval.End)
            {
                if (!liveInterval.LiveRange.CanSplitAt(low))
                    return false;

                intervals = liveInterval.SplitAt(low);
            }
            else
            {
                if (!liveInterval.LiveRange.CanSplitAt(low, high))
                {
                    return false;
                }

                intervals = liveInterval.SplitAt(low, high);
            }

            ReplaceIntervals(liveInterval, intervals, addToQueue);

            return true;
        }