Beispiel #1
0
        public x86DataList Union(x86DataList With)
        {
            var Ret = Copy();

            Ret.SetUsed(With);
            return(Ret);
        }
Beispiel #2
0
        public void SetUsed(x86DataList List)
        {
            GRegisters.SetUsed(List.GRegisters);
            SSERegisters.SetUsed(List.SSERegisters);

            if (StackOffset < List.StackOffset)
            {
                StackOffset = List.StackOffset;
            }
        }
Beispiel #3
0
        public x86DataList Copy()
        {
            var Ret = new x86DataList(Arch);

            if (GRegisters.Initialized)
            {
                Ret.GRegisters = GRegisters.Copy();
            }
            if (SSERegisters.Initialized)
            {
                Ret.SSERegisters = SSERegisters.Copy();
            }
            Ret.StackOffset = StackOffset;
            return(Ret);
        }
Beispiel #4
0
        public void Reset()
        {
            FPUItemsOnStack      = 0;
            UsedFPUStack         = 0;
            SameAllocationAsType = x86SameAllocationAsType.None;
            Flags             &= x86NodeFlags.LeftByReset;
            DataCalcPos        = x86DataLocationType.None;
            PreferredOutput    = null;
            UsedData           = null;
            UsedDataBySelf     = null;
            TempCantBe         = null;
            PreAllocate        = null;
            Properties         = new x86DataProperties();
            NeededTempByPlugin = new x86NeededTempData();
            Output             = null;

            ParameterBytes    = 0;
            OriginalShiftSize = 0;
        }
Beispiel #5
0
 public void Set(x86DataList DataList)
 {
     GRegisters.Set(DataList.GRegisters);
     SSERegisters.Set(DataList.SSERegisters);
     StackOffset = DataList.StackOffset;
 }
Beispiel #6
0
        private x86DataLocation AllocMultiPos(int Size, int Align, x86DataLocationType DataCalcPos, x86DataList CantBe, int PartSize)
        {
            var Count     = Size / PartSize;
            var Positions = new x86DataLocation[Count];

            for (var i = 0; i < Count; i++)
            {
                Positions[i] = Allocate(Arch.RegSize, Align, DataCalcPos, CantBe);
                if (Positions[i] == null)
                {
                    return(null);
                }
            }

            return(new x86MultiLocation(Arch, Size, Positions));
        }
Beispiel #7
0
        public x86DataLocation Allocate(int Size, int Align, x86DataLocationType DataCalcPos = x86DataLocationType.GRegMem,
                                        x86DataList CantBe = null)
        {
            if ((DataCalcPos & x86DataLocationType.SSEReg) != 0)
            {
                if (Size > Arch.SSERegSize)
                {
                    if (SSERegAvaiable())
                    {
                        var Ret = AllocMultiPos(Size, Align, DataCalcPos, CantBe, 16);
                        if (Ret != null)
                        {
                            return(Ret);
                        }
                    }
                }
                else
                {
                    var SSERegList = CantBe != null ? CantBe.SSERegisters : new x86RegisterList();
                    var Ret        = AllocSSERegister(16, SSERegList);
                    if (Ret != null)
                    {
                        return(Ret);
                    }
                }
            }

            if ((DataCalcPos & x86DataLocationType.General) != 0)
            {
                if (Size > Arch.RegSize)
                {
                    if (RegAvaiable())
                    {
                        var Ret = AllocMultiPos(Size, Align, DataCalcPos, CantBe, Arch.RegSize);
                        if (Ret != null)
                        {
                            return(Ret);
                        }
                    }
                }
                else
                {
                    var GRegList = CantBe != null ? CantBe.GRegisters : new x86GRegisterList();
                    var Ret      = AllocGRegister(Size, (DataCalcPos & x86DataLocationType.OneByte) != 0, GRegList);
                    if (Ret != null)
                    {
                        return(Ret);
                    }
                }
            }

            if ((DataCalcPos & x86DataLocationType.Memory) != 0)
            {
                var Ret = AllocMemory(Size, Align);
                if (Ret != null)
                {
                    return(Ret);
                }
            }

            return(null);
        }
Beispiel #8
0
        public x86DataLocation Allocate(Type T, x86DataLocationType DataCalcPos = x86DataLocationType.None, x86DataList CantBe = null)
        {
            if (DataCalcPos == x86DataLocationType.None)
            {
                DataCalcPos = x86Identifiers.GetPossibleLocations(T);
            }

            return(Allocate(T.Size, T.Align, DataCalcPos, CantBe));
        }
Beispiel #9
0
 public void SetUnused(x86DataList List)
 {
     GRegisters.SetUnused(List.GRegisters);
     SSERegisters.SetUnused(List.SSERegisters);
     StackOffset -= List.StackOffset;
 }