Beispiel #1
0
 internal LocationModel(AssignedLocation entity)
 {
     this.LocationId      = entity.LocationId;
     this.IaId            = entity.IaId;
     this.PiecesAvailable = entity.PiecesAtLocation;
     this.RestockAisleId  = entity.RestockAisleId;
     this.RailCapacity    = entity.RailCapacity;
     this.BuildingId      = entity.BuildingId;
 }
        private RegisterAllocation(CFGNode[] cfgNodes, Dictionary <Variable, IMemory> preallocatedValues)
        {
            CFGNodes = cfgNodes;

            LiveIntervalsByVariable = new Dictionary <Variable, (int First, int Last)>();

            CalculateLiveIntervals();

            LiveIntervals = LiveIntervalsByVariable
                            .Select(x => new LiveInterval(x.Key, x.Value.First, x.Value.Last))
                            .OrderBy(x => x.FirstIndex)
                            .ToList();

            AssignedLocation            = preallocatedValues ?? new Dictionary <Variable, IMemory>();
            FreeGeneralPurposeRegisters = new Stack <Register>(
                Register.All
                .Where(x => x.Size == RegisterSize.Bytes8 && (x.Flags & RegisterFlags.GeneralPurpose) != 0 &&
                       !AssignedLocation.ContainsValue(x)));

            Active = new List <LiveInterval>();

            AllocateRegisters();
            //AssignedLocation = LiveIntervalsByVariable.ToDictionary(x => x.Key, _ => (IMemory)StackAlloc(8));
        }