ToString() public method

public ToString ( ) : string
return string
        private SlotIndex GetLowerOptimalSplitLocation(LiveInterval liveInterval, SlotIndex at)
        {
            if (Trace.Active)
            {
                Trace.Log("--Low Splitting: " + liveInterval.ToString() + " move: " + at.ToString());
            }

            //a = liveInterval.Start.IsOnHalfStep ? liveInterval.Start : liveInterval.Start.HalfStepForward;
            var a = liveInterval.Start;

            var blockStart = GetBlockStart(at);
            var b          = blockStart > liveInterval.Start ? blockStart : null;

            if (Trace.Active)
            {
                Trace.Log("   Block Start : " + (b != null ? b.ToString() : "null"));
            }

            var c = liveInterval.LiveRange.GetPreviousUsePosition(at);

            if (c != null && c.HalfStepForward <= at)
            {
                c = c.HalfStepForward;
            }
            if (Trace.Active)
            {
                Trace.Log("  Previous Use : " + (c != null ? c.ToString() : "null"));
            }

            var d = liveInterval.LiveRange.GetPreviousDefPosition(at);

            if (d != null && d.HalfStepForward <= at)
            {
                d = d.HalfStepForward;
            }
            if (Trace.Active)
            {
                Trace.Log("  Previous Def : " + (d != null ? d.ToString() : "null"));
            }

            var max = GetMaximum(a, b, c, d);

            if (Trace.Active)
            {
                Trace.Log("   Low Optimal : " + max.ToString());
            }

            return(max);
        }
        private SlotIndex GetUpperOptimalSplitLocation(LiveInterval liveInterval, SlotIndex at)
        {
            if (Trace.Active)
            {
                Trace.Log("-High Splitting: " + liveInterval.ToString() + " move: " + at.ToString());
            }

            var a = liveInterval.End;

            var blockEnd = GetBlockEnd(at);
            var b        = blockEnd > liveInterval.End ? blockEnd : null;

            if (Trace.Active)
            {
                Trace.Log("     Block End : " + (b != null ? b.ToString() : "null"));
            }

            var c = liveInterval.LiveRange.GetNextUsePosition(at);

            if (c != null && c.HalfStepBack > at)
            {
                c = c.HalfStepBack;
            }
            if (Trace.Active)
            {
                Trace.Log("      Next Use : " + (c != null ? c.ToString() : "null"));
            }

            var d = liveInterval.LiveRange.GetNextDefPosition(at);

            if (Trace.Active)
            {
                Trace.Log("      Next Def : " + (d != null ? d.ToString() : "null"));
            }

            var min = GetMinimum(a, b, c, d);

            if (Trace.Active)
            {
                Trace.Log("  High Optimal : " + min.ToString());
            }

            return(min);
        }
        private SlotIndex GetLowOptimalSplitLocation(LiveInterval liveInterval, SlotIndex from, bool check)
        {
            Debug.Assert(liveInterval.Start != from);

            if (trace.Active) trace.Log("--Low Splitting: " + liveInterval.ToString() + " move: " + from.ToString());

            if (check)
            {
                if (liveInterval.UsePositions.Contains(from) || liveInterval.DefPositions.Contains(from))
                {
                    if (trace.Active) trace.Log("  No optimal. Split move: " + from.ToString());
                    return from;
                }
            }

            SlotIndex blockStart = GetBlockStart(from);
            if (trace.Active) trace.Log("  Block Start : " + blockStart.ToString());

            SlotIndex lowerBound = blockStart > liveInterval.Start ? blockStart : liveInterval.Start.Next;
            if (trace.Active) trace.Log("  Lower Bound : " + lowerBound.ToString());

            SlotIndex previousUse = liveInterval.GetPreviousDefOrUsePosition(from);
            if (trace.Active) trace.Log("  Previous Use: " + (previousUse != null ? previousUse.ToString() : "null"));

            if (previousUse != null && previousUse >= lowerBound)
            {
                if (trace.Active) trace.Log("  Low Optimal : " + previousUse.Next.ToString());
                return previousUse.Next;
            }

            if (trace.Active) trace.Log("  Low Optimal : " + lowerBound.ToString());
            return lowerBound;
        }
        private SlotIndex GetHighOptimalSplitLocation(LiveInterval liveInterval, SlotIndex after, bool check)
        {
            Debug.Assert(liveInterval.End != after);

            if (trace.Active) trace.Log("--High Splitting: " + liveInterval.ToString() + " move: " + after.ToString());

            SlotIndex blockEnd = GetBlockEnd(after);
            if (trace.Active) trace.Log("  Block End   : " + blockEnd.ToString());

            SlotIndex higherBound = blockEnd < liveInterval.End ? blockEnd : liveInterval.End.Previous;
            if (trace.Active) trace.Log("  Higher Bound: " + higherBound.ToString());

            SlotIndex nextUse = liveInterval.GetNextDefOrUsePosition(after);
            if (trace.Active) trace.Log("  Next Use    : " + (nextUse != null ? nextUse.ToString() : "null"));

            if (nextUse != null && nextUse <= higherBound)
            {
                if (trace.Active) trace.Log("  High Optimal: " + nextUse.Previous.ToString());
                return nextUse;
            }

            if (trace.Active) trace.Log("  High Optimal: " + higherBound.ToString());
            return higherBound;
        }
        private void ProcessLiveInterval(LiveInterval liveInterval)
        {
            if (trace.Active)
            {
                trace.Log("Processing Interval: " + liveInterval.ToString() + " / Length: " + liveInterval.Length.ToString() + " / Spill Cost: " + liveInterval.SpillCost.ToString() + " / Stage: " + liveInterval.Stage.ToString());
                trace.Log("  Defs (" + liveInterval.DefPositions.Count.ToString() + "): " + SlotsToString(liveInterval.DefPositions));
                trace.Log("  Uses (" + liveInterval.UsePositions.Count.ToString() + "): " + SlotsToString(liveInterval.UsePositions));
            }

            if (liveInterval.ForceSpilled)
            {
                if (trace.Active) trace.Log("  Forced spilled interval");

                liveInterval.VirtualRegister.IsSpilled = true;
                spilledIntervals.Add(liveInterval);
                return;
            }

            // For now, empty intervals will stay spilled
            if (liveInterval.IsEmpty)
            {
                if (trace.Active) trace.Log("  Spilled");

                liveInterval.VirtualRegister.IsSpilled = true;
                spilledIntervals.Add(liveInterval);

                return;
            }

            var moveHints = GetMoveHints(liveInterval);

            // Try to place using move hints first
            if (PlaceLiveIntervalOnTrack(liveInterval, moveHints))
            {
                UpdateMoveHints(liveInterval, moveHints);
                return;
            }

            // TODO - try move hints first, allow evictions

            // Find any available track and place interval there
            if (PlaceLiveIntervalOnAnyAvailableTrack(liveInterval))
            {
                UpdateMoveHints(liveInterval, moveHints);
                return;
            }

            if (trace.Active) trace.Log("  No free register available");

            // No place for live interval; find live interval(s) to evict based on spill costs
            if (PlaceLiveIntervalOnTrackAllowEvictions(liveInterval))
            {
                UpdateMoveHints(liveInterval, moveHints);
                return;
            }

            if (trace.Active) trace.Log("  No live intervals to evicts");

            // No live intervals to evict!

            // prepare to split live interval
            if (liveInterval.Stage == LiveInterval.AllocationStage.Initial)
            {
                if (trace.Active) trace.Log("  Re-queued for split level 1 stage");
                liveInterval.Stage = LiveInterval.AllocationStage.SplitLevel1;
                AddPriorityQueue(liveInterval);
                return;
            }

            // split live interval - level 1
            if (liveInterval.Stage == LiveInterval.AllocationStage.SplitLevel1)
            {
                if (trace.Active) trace.Log("  Attempting to split interval - level 1");

                if (TrySplitInterval(liveInterval, 1))
                {
                    return;
                }

                // Move to split level 2 stage
                if (trace.Active) trace.Log("  Re-queued for split interval - level 2");

                liveInterval.Stage = LiveInterval.AllocationStage.SplitLevel2;
                AddPriorityQueue(liveInterval);
                return;
            }

            // split live interval - level 2
            if (liveInterval.Stage == LiveInterval.AllocationStage.SplitLevel2)
            {
                if (trace.Active) trace.Log("  Attempting to split interval - level 2");

                if (TrySplitInterval(liveInterval, 2))
                {
                    return;
                }

                // Move to spill stage
                if (trace.Active) trace.Log("  Re-queued for spillable stage");

                liveInterval.Stage = LiveInterval.AllocationStage.Spillable;
                AddPriorityQueue(liveInterval);
                return;
            }

            // spill interval to stack slot
            if (liveInterval.Stage == LiveInterval.AllocationStage.Spillable)
            {
                if (trace.Active) trace.Log("  Spilled interval");

                //liveInterval.Stage = LiveInterval.AllocationStage.Spilled
                liveInterval.VirtualRegister.IsSpilled = true;
                spilledIntervals.Add(liveInterval);

                return;
            }

            // TODO
            return;
        }
        private SlotIndex GetUpperOptimalSplitLocation(LiveInterval liveInterval, SlotIndex at)
        {
            if (Trace.Active) Trace.Log("--High Splitting: " + liveInterval.ToString() + " move: " + at.ToString());

            var a = liveInterval.End;

            var blockEnd = GetBlockEnd(at);
            var b = blockEnd > liveInterval.End ? blockEnd : null;
            if (Trace.Active) Trace.Log("     Block End : " + (b != null ? b.ToString() : "null"));

            var c = liveInterval.LiveRange.GetNextUsePosition(at);
            if (c != null && c.HalfStepBack > at)
                c = c.HalfStepBack;
            if (Trace.Active) Trace.Log("      Next Use : " + (c != null ? c.ToString() : "null"));

            var d = liveInterval.LiveRange.GetNextDefPosition(at);
            if (Trace.Active) Trace.Log("      Next Def : " + (d != null ? d.ToString() : "null"));

            var min = GetMinimum(a, b, c, d);

            if (Trace.Active) Trace.Log("  High Optimal : " + min.ToString());

            return min;
        }
        private SlotIndex GetLowerOptimalSplitLocation(LiveInterval liveInterval, SlotIndex at)
        {
            if (Trace.Active) Trace.Log("--Low Splitting: " + liveInterval.ToString() + " move: " + at.ToString());

            //a = liveInterval.Start.IsOnHalfStep ? liveInterval.Start : liveInterval.Start.HalfStepForward;
            var a = liveInterval.Start;

            var blockStart = GetBlockStart(at);
            var b = blockStart > liveInterval.Start ? blockStart : null;
            if (Trace.Active) Trace.Log("   Block Start : " + (b != null ? b.ToString() : "null"));

            var c = liveInterval.LiveRange.GetPreviousUsePosition(at);
            if (c != null && c.HalfStepForward <= at)
                c = c.HalfStepForward;
            if (Trace.Active) Trace.Log("  Previous Use : " + (c != null ? c.ToString() : "null"));

            var d = liveInterval.LiveRange.GetPreviousDefPosition(at);
            if (d != null && d.HalfStepForward <= at)
                d = d.HalfStepForward;
            if (Trace.Active) Trace.Log("  Previous Def : " + (d != null ? d.ToString() : "null"));

            var max = GetMaximum(a, b, c, d);

            if (Trace.Active) Trace.Log("   Low Optimal : " + max.ToString());

            return max;
        }