Exemple #1
0
        public x86RegisterList Union(x86RegisterList Other)
        {
            if (!Initialized)
            {
                return(Other);
            }
            if (!Other.Initialized)
            {
                return(this);
            }

            var MaxSize = Math.Max(Size, Other.Size);
            var Ret     = new x86RegisterList(MaxSize);

            for (var i = 0; i < MaxSize; i++)
            {
                if (i < Size && this[i])
                {
                    Ret[i] = true;
                }
                else if (i < Other.Size && Other[i])
                {
                    Ret[i] = true;
                }
            }

            return(Ret);
        }
Exemple #2
0
 public void SetUsed(x86RegisterList List, x86RegisterMask Mask)
 {
     for (var i = 0; i < List.Size; i++)
     {
         if (List[i])
         {
             SetUsed(i, Mask);
         }
     }
 }
Exemple #3
0
        public x86DataList(x86Architecture Arch, bool Alloc = true)
        {
            this.Arch = Arch;

            if (Alloc)
            {
                GRegisters   = new x86GRegisterList(Arch.RegCount);
                SSERegisters = new x86RegisterList(Arch.RegCount);
            }
        }
Exemple #4
0
 public void SetUnused(x86RegisterList List)
 {
     for (var i = 0; i < List.Size; i++)
     {
         if (List[i])
         {
             UsedRegs[i] = false;
         }
     }
 }
Exemple #5
0
 public void SetUsed(x86RegisterList Lst)
 {
     for (var i = 0; i < Lst.Size; i++)
     {
         if (Lst[i])
         {
             UsedRegs[i] = true;
         }
     }
 }
Exemple #6
0
        public x86SSERegLocation AllocSSERegister(int Size, x86RegisterList CantBe = new x86RegisterList())
        {
            var Ret = AllocSSERegHelper(Size, CantBe);

            if (Ret != null)
            {
                return(Ret);
            }

            return(AllocSSERegHelper(Size, CantBe, true));
        }
Exemple #7
0
        public void Set(x86RegisterList List)
        {
            if (List.Size != Size)
            {
                throw new ApplicationException();
            }

            for (var i = 0; i < Size; i++)
            {
                UsedRegs[i] = List[i];
            }
        }
Exemple #8
0
        public x86RegisterList Inverse()
        {
            var Ret = new x86RegisterList(Size);

            for (var i = 0; i < Size; i++)
            {
                if (!UsedRegs[i])
                {
                    Ret[i] = true;
                }
            }

            return(Ret);
        }
Exemple #9
0
        public x86RegisterList Copy()
        {
            if (Initialized)
            {
                var Ret = new x86RegisterList(Size);
                for (var i = 0; i < Size; i++)
                {
                    Ret[i] = this[i];
                }

                return(Ret);
            }

            return(new x86RegisterList());
        }
Exemple #10
0
        public x86SSERegLocation AllocSSERegHelper(int Size, x86RegisterList CantBe = new x86RegisterList(), bool EnableParamLocs = false)
        {
            var Sequence = x86CallConv.AllocationSequence.SSERegisters;

            for (var i = 0; i < Sequence.Length; i++)
            {
                var Reg = Sequence[i];
                if (IsSSERegisterFree(Reg) && (!CantBe.Initialized || !CantBe[Reg]))
                {
                    SSERegisters[Reg] = true;
                    return(new x86SSERegLocation(Arch, Reg, Size));
                }
            }

            return(null);
        }
Exemple #11
0
        public x86RegisterList Intersect(x86RegisterList Other)
        {
            if (!Initialized)
            {
                return(Other);
            }
            if (!Other.Initialized)
            {
                return(this);
            }

            var MinSize = Math.Min(Size, Other.Size);
            var Ret     = new x86RegisterList(MinSize);

            for (var i = 0; i < MinSize; i++)
            {
                if (this[i] && Other[i])
                {
                    Ret[i] = true;
                }
            }

            return(Ret);
        }