1 //===- AMDGPUGenRegisterBankInfo.def -----------------------------*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 /// This file defines all the static objects used by AMDGPURegisterBankInfo.
11 /// \todo This should be generated by TableGen.
12 //===----------------------------------------------------------------------===//
17 enum PartialMappingIdx {
37 const RegisterBankInfo::PartialMapping PartMappings[] {
38 // StartIdx, Length, RegBank
43 {0, 128, SGPRRegBank},
44 {0, 256, SGPRRegBank},
45 {0, 512, SGPRRegBank},
50 {0, 128, VGPRRegBank},
51 {0, 256, VGPRRegBank},
52 {0, 512, VGPRRegBank},
57 const RegisterBankInfo::ValueMapping ValMappings[] {
58 {&PartMappings[0], 1},
62 {&PartMappings[1], 1},
63 {&PartMappings[2], 1},
64 {&PartMappings[3], 1},
65 {&PartMappings[4], 1},
66 {&PartMappings[5], 1},
67 {&PartMappings[6], 1},
68 {&PartMappings[7], 1},
72 {&PartMappings[8], 1},
73 {&PartMappings[9], 1},
74 {&PartMappings[10], 1},
75 {&PartMappings[11], 1},
76 {&PartMappings[12], 1},
77 {&PartMappings[13], 1},
78 {&PartMappings[14], 1},
79 {&PartMappings[15], 1}
82 enum ValueMappingIdx {
87 const RegisterBankInfo::ValueMapping *getValueMapping(unsigned BankID,
92 Idx = BankID == AMDGPU::SCCRegBankID ? PM_SGPR1 : PM_VGPR1;
95 Idx = BankID == AMDGPU::SGPRRegBankID ? PM_SGPR96 : PM_VGPR96;
98 Idx = BankID == AMDGPU::VGPRRegBankID ? VGPRStartIdx : SGPRStartIdx;
99 Idx += Log2_32_Ceil(Size);
102 return &ValMappings[Idx];
105 } // End AMDGPU namespace.
106 } // End llvm namespace.