static Registers() { var factory = new StorageFactory(); GpRegisters = factory.RangeOfReg32(8, "er{0}"); GpRegisters[7] = new RegisterStorage("sp", 7, 0, PrimitiveType.Ptr32); RRegisters = GpRegisters.Select((r, i) => new RegisterStorage($"r{i}", r.Number, 0, PrimitiveType.Word16)).ToArray(); ERegisters = GpRegisters.Select((r, i) => new RegisterStorage($"e{i}", r.Number, 16, PrimitiveType.Word16)).ToArray(); RlRegisters = GpRegisters.Select((r, i) => new RegisterStorage($"r{i}l", r.Number, 0, PrimitiveType.Byte)).ToArray(); RhRegisters = GpRegisters.Select((r, i) => new RegisterStorage($"r{i}h", r.Number, 8, PrimitiveType.Byte)).ToArray(); Gp16Registers = RRegisters.Concat(ERegisters).ToArray(); Gp8Registers = RhRegisters.Concat(RlRegisters).ToArray(); PcRegister = factory.Reg32("pc"); CcRegister = factory.Reg("ccr", PrimitiveType.Byte); ByName = GpRegisters .Concat(Gp16Registers) .Concat(Gp8Registers) .Concat(new[] { PcRegister, CcRegister }) .ToDictionary(r => r.Name); }
static Registers() { var factory = new StorageFactory(); GpRegisters = factory.RangeOfReg64(127, "r{0}"); PredicateRegisters = factory.RangeOfReg(64, n => $"p{n:00}", PrimitiveType.Bool); RegistersByName = GpRegisters .Concat(PredicateRegisters) .ToDictionary(r => r.Name); }