Example #1
0
 public MoveHint(SlotIndex slot, VirtualRegister from, VirtualRegister to, int bonus)
 {
     Slot  = slot;
     From  = from;
     To    = to;
     Bonus = bonus;
 }
Example #2
0
 public MoveHint(SlotIndex slot, VirtualRegister from, VirtualRegister to, int bonus)
 {
     Slot = slot;
     From = from;
     To = to;
     Bonus = bonus;
 }
Example #3
0
        private LiveInterval(VirtualRegister virtualRegister, SlotIndex start, SlotIndex end, IList<SlotIndex> uses, IList<SlotIndex> defs)
        {
            LiveRange = new LiveRange(start, end, uses, defs);

            VirtualRegister = virtualRegister;
            SpillValue = 0;
            Stage = AllocationStage.Initial;
            ForceSpilled = false;
            NeverSpill = false;
        }
Example #4
0
        private LiveInterval(VirtualRegister virtualRegister, SlotIndex start, SlotIndex end, IList <SlotIndex> uses, IList <SlotIndex> defs)
        {
            this.LiveRange = new LiveRange(start, end, uses, defs);

            this.VirtualRegister = virtualRegister;
            this.SpillValue      = 0;
            this.Stage           = AllocationStage.Initial;
            this.ForceSpilled    = false;
            this.NeverSpill      = false;
        }
Example #5
0
        private LiveInterval(VirtualRegister virtualRegister, SlotIndex start, SlotIndex end, IList <SlotIndex> uses, IList <SlotIndex> defs)
        {
            LiveRange = new LiveRange(start, end, uses, defs);

            VirtualRegister = virtualRegister;
            SpillValue      = 0;
            Stage           = AllocationStage.Initial;
            ForceSpilled    = false;
            NeverSpill      = false;

            TooSmallToSplit = IsTooSmallToSplit();
        }
Example #6
0
        public LiveInterval(VirtualRegister virtualRegister, SlotIndex start, SlotIndex end)
        {
            VirtualRegister = virtualRegister;
            Start           = start;
            End             = end;

            LiveRange = new LiveRange(start, end, virtualRegister);

            SpillValue   = 0;
            Stage        = AllocationStage.Initial;
            ForceSpilled = false;
            NeverSpill   = false;

            TooSmallToSplit = IsTooSmallToSplit();
        }
Example #7
0
        private LiveInterval(VirtualRegister virtualRegister, SlotIndex start, SlotIndex end, IList<SlotIndex> uses, IList<SlotIndex> defs)
            : base(start, end)
        {
            this.VirtualRegister = virtualRegister;
            this.SpillValue = 0;
            this.Stage = AllocationStage.Initial;
            this.ForceSpilled = false;
            this.NeverSpill = false;

            SlotIndex max = null;
            SlotIndex min = null;

            foreach (var use in uses)
            {
                if (Contains(use))
                {
                    usePositions.Add(use, use);

                    if (max == null || use > max)
                        max = use;
                    if (min == null || use < min)
                        min = use;
                }
            }

            foreach (var def in defs)
            {
                if (Contains(def))
                {
                    defPositions.Add(def, def);

                    if (max == null || def > max)
                        max = def;
                    if (min == null || def < min)
                        min = def;
                }
            }

            this.Minimum = min;
            this.Maximum = max;
        }
Example #8
0
 public LiveInterval(VirtualRegister virtualRegister, SlotIndex start, SlotIndex end)
     : this(virtualRegister, start, end, virtualRegister.UsePositions, virtualRegister.DefPositions)
 {
 }
Example #9
0
        public LiveRange(SlotIndex start, SlotIndex end, VirtualRegister virtualRegister, int startIndex = 0, int endIndex = Int32.MaxValue)
        {
            VirtualRegister = virtualRegister;
            Start           = start;
            End             = end;

            if (virtualRegister.IsPhysicalRegister)
            {
                return;
            }

            int lastUseIndex  = -1;
            int firstUseIndex = -1;
            int lastDefIndex  = -1;
            int firstDefIndex = -1;
            int useCount      = 0;
            int defCount      = 0;

            for (int i = startIndex; i < virtualRegister.UsePositions.Count && i <= endIndex; i++)
            {
                var use = virtualRegister.UsePositions[i];

                if (use > end)
                {
                    break;
                }

                if (use > start)                 // && (use <= end)
                {
                    if (firstUseIndex < 0)
                    {
                        firstUseIndex = i;
                    }
                    useCount++;
                    lastUseIndex = i;
                }
            }

            for (int i = startIndex; i < virtualRegister.DefPositions.Count && i <= endIndex; i++)
            {
                var def = virtualRegister.DefPositions[i];

                if (def >= end)
                {
                    break;
                }

                if (def >= start)                 // && (def < end)
                {
                    if (firstDefIndex < 0)
                    {
                        firstDefIndex = i;
                    }
                    defCount++;
                    lastDefIndex = i;
                }
            }

            StartIndex = LowestGreaterThanZero(firstUseIndex, firstDefIndex);
            EndIndex   = Math.Max(lastUseIndex, lastDefIndex);

            FirstUseIndex = firstUseIndex;
            LastUseIndex  = lastUseIndex;

            FirstDefIndex = firstDefIndex;
            LastDefIndex  = lastDefIndex;

            UseCount = useCount;
            DefCount = defCount;

            IsEmpty = useCount + defCount == 0;

            FirstUse = useCount == 0 ? SlotIndex.NullSlot : VirtualRegister.UsePositions[firstUseIndex];
            FirstDef = defCount == 0 ? SlotIndex.NullSlot : VirtualRegister.DefPositions[firstDefIndex];
            LastUse  = useCount == 0 ? SlotIndex.NullSlot : VirtualRegister.UsePositions[lastUseIndex];
            LastDef  = defCount == 0 ? SlotIndex.NullSlot : VirtualRegister.DefPositions[lastDefIndex];

            First = (useCount == 0 || firstDefIndex < firstUseIndex) ? FirstDef : FirstUse;
            Last  = (useCount == 0 || lastDefIndex > lastUseIndex) ? LastDef : LastUse;

            IsDefFirst = defCount != 0 && (useCount == 0 || FirstDefIndex < FirstUseIndex);

            //Debug.Assert(InternalValidation());
        }
Example #10
0
 public override string ToString()
 {
     return(VirtualRegister.ToString() + " between " + LiveRange.ToString());
 }
Example #11
0
 public LiveInterval(VirtualRegister virtualRegister, SlotIndex start, SlotIndex end)
     : this(virtualRegister, start, end, virtualRegister.UsePositions, virtualRegister.DefPositions)
 {
 }