ToString() public method

public ToString ( ) : string
return string
コード例 #1
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.Append(Slot.ToString());

            sb.Append(" FROM: ");
            if (From.IsPhysicalRegister)
            {
                sb.Append(From.PhysicalRegister.ToString());
            }
            else
            {
                sb.AppendFormat("V_{0}", From.VirtualRegisterOperand.Index);

                if (FromRegister != null)
                {
                    sb.Append(" [");
                    sb.Append(FromRegister.ToString());
                    sb.Append("]");
                }
            }

            sb.Append(" TO: ");
            if (To.IsPhysicalRegister)
            {
                sb.Append(To.PhysicalRegister.ToString());
            }
            else
            {
                sb.AppendFormat("V_{0}", To.VirtualRegisterOperand.Index);

                if (ToRegister != null)
                {
                    sb.Append(" [");
                    sb.Append(ToRegister.ToString());
                    sb.Append("]");
                }
            }

            return(sb.ToString());
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        private bool TrySimplePartialFreeIntervalSplit(LiveInterval liveInterval)
        {
            SlotIndex furthestUsed = null;

            foreach (var track in LiveIntervalTracks)
            {
                if (track.IsReserved)
                {
                    continue;
                }

                if (track.IsFloatingPoint != liveInterval.VirtualRegister.IsFloatingPoint)
                {
                    continue;
                }

                var next = track.GetNextLiveRange(liveInterval.Start);

                if (next == null)
                {
                    continue;
                }

                Debug.Assert(next > liveInterval.Start);

                if (Trace.Active)
                {
                    Trace.Log("  Register " + track.ToString() + " free up to " + next.ToString());
                }

                if (furthestUsed == null || furthestUsed < next)
                {
                    furthestUsed = next;
                }
            }

            if (furthestUsed == null)
            {
                if (Trace.Active)
                {
                    Trace.Log("  No partial free space available");
                }
                return(false);
            }

            if (furthestUsed < liveInterval.Minimum)
            {
                if (Trace.Active)
                {
                    Trace.Log("  No partial free space available");
                }
                return(false);
            }

            if (furthestUsed.IsBlockStartInstruction)
            {
                return(false);
            }

            if (furthestUsed <= liveInterval.Start)
            {
                if (Trace.Active)
                {
                    Trace.Log("  No partial free space available");
                }
                return(false);
            }

            if (Trace.Active)
            {
                Trace.Log("  Partial free up destination: " + furthestUsed.ToString());
            }

            if (liveInterval.UsePositions.Contains(furthestUsed) && liveInterval.Contains(furthestUsed.HalfStepBack))
            {
                furthestUsed = furthestUsed.HalfStepBack;
            }

            return(PreferBlockBoundaryIntervalSplit(liveInterval, furthestUsed, true));
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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;
        }
コード例 #8
0
        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;
        }