1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Target Register and Register Classes Information *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* *|
7\*===----------------------------------------------------------------------===*/
8
9namespace llvm {
10
11extern const MCRegisterClass MSP430MCRegisterClasses[];
12
13static const MVT::SimpleValueType VTLists[] = {
14 /* 0 */ MVT::i8, MVT::Other,
15 /* 2 */ MVT::i16, MVT::Other,
16};
17
18static const char *SubRegIndexNameTable[] = { "subreg_8bit", "" };
19
20static const TargetRegisterInfo::SubRegCoveredBits SubRegIdxRangeTable[] = {
21 { .Offset: 65535, .Size: 65535 },
22 { .Offset: 0, .Size: 8 }, // subreg_8bit
23};
24
25
26static const LaneBitmask SubRegIndexLaneMaskTable[] = {
27 LaneBitmask::getAll(),
28 LaneBitmask(0x0000000000000001), // subreg_8bit
29 };
30
31
32
33static const TargetRegisterInfo::RegClassInfo RegClassInfos[] = {
34 // Mode = 0 (Default)
35 { .RegSize: 8, .SpillSize: 8, .SpillAlignment: 8, /*VTLists+*/.VTListOffset: 0 }, // GR8
36 { .RegSize: 16, .SpillSize: 16, .SpillAlignment: 16, /*VTLists+*/.VTListOffset: 2 }, // GR16
37};
38static const uint32_t GR8SubClassMask[] = {
39 0x00000001,
40 0x00000002, // subreg_8bit
41};
42
43static const uint32_t GR16SubClassMask[] = {
44 0x00000002,
45};
46
47static const uint16_t SuperRegIdxSeqs[] = {
48 /* 0 */ 1, 0,
49};
50
51
52namespace MSP430 { // Register class instances
53 extern const TargetRegisterClass GR8RegClass = {
54 .MC: &MSP430MCRegisterClasses[GR8RegClassID],
55 .SubClassMask: GR8SubClassMask,
56 .SuperRegIndices: SuperRegIdxSeqs + 0,
57 .LaneMask: LaneBitmask(0x0000000000000001),
58 .AllocationPriority: 0,
59 .GlobalPriority: false,
60 .TSFlags: 0x00, /* TSFlags */
61 .HasDisjunctSubRegs: false, /* HasDisjunctSubRegs */
62 .CoveredBySubRegs: false, /* CoveredBySubRegs */
63 .SuperClasses: nullptr, .SuperClassesSize: 0,
64 .OrderFunc: nullptr
65 };
66
67 extern const TargetRegisterClass GR16RegClass = {
68 .MC: &MSP430MCRegisterClasses[GR16RegClassID],
69 .SubClassMask: GR16SubClassMask,
70 .SuperRegIndices: SuperRegIdxSeqs + 1,
71 .LaneMask: LaneBitmask(0x0000000000000001),
72 .AllocationPriority: 0,
73 .GlobalPriority: false,
74 .TSFlags: 0x00, /* TSFlags */
75 .HasDisjunctSubRegs: false, /* HasDisjunctSubRegs */
76 .CoveredBySubRegs: false, /* CoveredBySubRegs */
77 .SuperClasses: nullptr, .SuperClassesSize: 0,
78 .OrderFunc: nullptr
79 };
80
81} // end namespace MSP430
82
83namespace {
84 const TargetRegisterClass *const RegisterClasses[] = {
85 &MSP430::GR8RegClass,
86 &MSP430::GR16RegClass,
87 };
88} // end anonymous namespace
89
90static const uint8_t CostPerUseTable[] = {
910, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
92
93
94static const bool InAllocatableClassTable[] = {
95false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, };
96
97
98static const TargetRegisterInfoDesc MSP430RegInfoDesc = { // Extra Descriptors
99.CostPerUse: CostPerUseTable, .NumCosts: 1, .InAllocatableClass: InAllocatableClassTable};
100
101unsigned MSP430GenRegisterInfo::composeSubRegIndicesImpl(unsigned IdxA, unsigned IdxB) const {
102 static const uint8_t Rows[1][1] = {
103 { 0, },
104 };
105
106 --IdxA; assert(IdxA < 1); (void) IdxA;
107 --IdxB; assert(IdxB < 1);
108 return Rows[0][IdxB];
109}
110
111unsigned MSP430GenRegisterInfo::reverseComposeSubRegIndicesImpl(unsigned IdxA, unsigned IdxB) const {
112 static const uint8_t Table[1][1] = {
113 { 0, },
114 };
115
116 --IdxA; assert(IdxA < 1);
117 --IdxB; assert(IdxB < 1);
118 return Table[IdxA][IdxB];
119 }
120
121 struct MaskRolOp {
122 LaneBitmask Mask;
123 uint8_t RotateLeft;
124 };
125 static const MaskRolOp LaneMaskComposeSequences[] = {
126 { .Mask: LaneBitmask(0xFFFFFFFFFFFFFFFF), .RotateLeft: 0 }, { .Mask: LaneBitmask::getNone(), .RotateLeft: 0 } // Sequence 0
127 };
128 static const uint8_t CompositeSequences[] = {
129 0 // to subreg_8bit
130 };
131
132LaneBitmask MSP430GenRegisterInfo::composeSubRegIndexLaneMaskImpl(unsigned IdxA, LaneBitmask LaneMask) const {
133 --IdxA; assert(IdxA < 1 && "Subregister index out of bounds");
134 LaneBitmask Result;
135 for (const MaskRolOp *Ops =
136 &LaneMaskComposeSequences[CompositeSequences[IdxA]];
137 Ops->Mask.any(); ++Ops) {
138 LaneBitmask::Type M = LaneMask.getAsInteger() & Ops->Mask.getAsInteger();
139 if (unsigned S = Ops->RotateLeft)
140 Result |= LaneBitmask((M << S) | (M >> (LaneBitmask::BitWidth - S)));
141 else
142 Result |= LaneBitmask(M);
143 }
144 return Result;
145}
146
147LaneBitmask MSP430GenRegisterInfo::reverseComposeSubRegIndexLaneMaskImpl(unsigned IdxA, LaneBitmask LaneMask) const {
148 LaneMask &= getSubRegIndexLaneMask(SubIdx: IdxA);
149 --IdxA; assert(IdxA < 1 && "Subregister index out of bounds");
150 LaneBitmask Result;
151 for (const MaskRolOp *Ops =
152 &LaneMaskComposeSequences[CompositeSequences[IdxA]];
153 Ops->Mask.any(); ++Ops) {
154 LaneBitmask::Type M = LaneMask.getAsInteger();
155 if (unsigned S = Ops->RotateLeft)
156 Result |= LaneBitmask((M >> S) | (M << (LaneBitmask::BitWidth - S)));
157 else
158 Result |= LaneBitmask(M);
159 }
160 return Result;
161}
162
163const TargetRegisterClass *MSP430GenRegisterInfo::getSubClassWithSubReg(const TargetRegisterClass *RC, unsigned Idx) const {
164 static const uint8_t Table[2][1] = {
165 { // GR8
166 0, // subreg_8bit
167 },
168 { // GR16
169 2, // subreg_8bit -> GR16
170 },
171 };
172 assert(RC && "Missing regclass");
173 if (!Idx) return RC;
174 --Idx;
175 assert(Idx < 1 && "Bad subreg");
176 unsigned TV = Table[RC->getID()][Idx];
177 return TV ? getRegClass(i: TV - 1) : nullptr;
178}
179
180const TargetRegisterClass *MSP430GenRegisterInfo::getSubRegisterClass(const TargetRegisterClass *RC, unsigned Idx) const {
181 static const uint8_t Table[2][1] = {
182 { // GR8
183 0, // GR8:subreg_8bit
184 },
185 { // GR16
186 1, // GR16:subreg_8bit -> GR8
187 },
188 };
189 assert(RC && "Missing regclass");
190 if (!Idx) return RC;
191 --Idx;
192 assert(Idx < 1 && "Bad subreg");
193 unsigned TV = Table[RC->getID()][Idx];
194 return TV ? getRegClass(i: TV - 1) : nullptr;
195}
196
197/// Get the weight in units of pressure for this register class.
198const RegClassWeight &MSP430GenRegisterInfo::
199getRegClassWeight(const TargetRegisterClass *RC) const {
200 static const RegClassWeight RCWeightTable[] = {
201 {.RegWeight: 1, .WeightLimit: 16}, // GR8
202 {.RegWeight: 1, .WeightLimit: 16}, // GR16
203 };
204 return RCWeightTable[RC->getID()];
205}
206
207/// Get the weight in units of pressure for this register unit.
208unsigned MSP430GenRegisterInfo::
209getRegUnitWeight(MCRegUnit RegUnit) const {
210 assert(static_cast<unsigned>(RegUnit) < 16 && "invalid register unit");
211 // All register units have unit weight.
212 return 1;
213}
214
215
216// Get the number of dimensions of register pressure.
217unsigned MSP430GenRegisterInfo::getNumRegPressureSets() const {
218 return 1;
219}
220
221// Get the name of this register unit pressure set.
222const char *MSP430GenRegisterInfo::
223getRegPressureSetName(unsigned Idx) const {
224 static const char *PressureNameTable[] = {
225 "GR8",
226 };
227 return PressureNameTable[Idx];
228}
229
230// Get the register unit pressure limit for this dimension.
231// This limit must be adjusted dynamically for reserved registers.
232unsigned MSP430GenRegisterInfo::
233getRegPressureSetLimit(const MachineFunction &MF, unsigned Idx) const {
234 static const uint8_t PressureLimitTable[] = {
235 16, // 0: GR8
236 };
237 return PressureLimitTable[Idx];
238}
239
240/// Table of pressure sets per register class or unit.
241static const int RCSetsTable[] = {
242 /* 0 */ 0, -1,
243};
244
245/// Get the dimensions of register pressure impacted by this register class.
246/// Returns a -1 terminated array of pressure set IDs
247const int *MSP430GenRegisterInfo::
248getRegClassPressureSets(const TargetRegisterClass *RC) const {
249 static const uint8_t RCSetStartTable[] = {
250 0,0,};
251 return &RCSetsTable[RCSetStartTable[RC->getID()]];
252}
253
254/// Get the dimensions of register pressure impacted by this register unit.
255/// Returns a -1 terminated array of pressure set IDs
256const int *MSP430GenRegisterInfo::
257getRegUnitPressureSets(MCRegUnit RegUnit) const {
258 assert(static_cast<unsigned>(RegUnit) < 16 && "invalid register unit");
259 static const uint8_t RUSetStartTable[] = {
260 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
261 return &RCSetsTable[RUSetStartTable[static_cast<unsigned>(RegUnit)]];
262}
263
264extern const MCRegisterDesc MSP430RegDesc[];
265extern const int16_t MSP430RegDiffLists[];
266extern const LaneBitmask MSP430LaneMaskLists[];
267extern const char MSP430RegStrings[];
268extern const char MSP430RegClassStrings[];
269extern const MCPhysReg MSP430RegUnitRoots[][2];
270extern const uint16_t MSP430SubRegIdxLists[];
271extern const uint16_t MSP430RegEncodingTable[];
272// MSP430 Dwarf<->LLVM register mappings.
273extern const MCRegisterInfo::DwarfLLVMRegPair MSP430DwarfFlavour0Dwarf2L[];
274extern const unsigned MSP430DwarfFlavour0Dwarf2LSize;
275
276extern const MCRegisterInfo::DwarfLLVMRegPair MSP430EHFlavour0Dwarf2L[];
277extern const unsigned MSP430EHFlavour0Dwarf2LSize;
278
279extern const MCRegisterInfo::DwarfLLVMRegPair MSP430DwarfFlavour0L2Dwarf[];
280extern const unsigned MSP430DwarfFlavour0L2DwarfSize;
281
282extern const MCRegisterInfo::DwarfLLVMRegPair MSP430EHFlavour0L2Dwarf[];
283extern const unsigned MSP430EHFlavour0L2DwarfSize;
284
285MSP430GenRegisterInfo::
286MSP430GenRegisterInfo(unsigned RA, unsigned DwarfFlavour, unsigned EHFlavour,
287 unsigned PC, unsigned HwMode)
288 : TargetRegisterInfo(&MSP430RegInfoDesc, RegisterClasses, RegisterClasses+2,
289 SubRegIndexNameTable, SubRegIdxRangeTable, SubRegIndexLaneMaskTable,
290 LaneBitmask(0xFFFFFFFFFFFFFFFE), RegClassInfos, VTLists, HwMode) {
291 InitMCRegisterInfo(D: MSP430RegDesc, NR: 33, RA, PC,
292 C: MSP430MCRegisterClasses, NC: 2,
293 RURoots: MSP430RegUnitRoots,
294 NRU: 16,
295 DL: MSP430RegDiffLists,
296 RUMS: MSP430LaneMaskLists,
297 Strings: MSP430RegStrings,
298 ClassStrings: MSP430RegClassStrings,
299 SubIndices: MSP430SubRegIdxLists,
300 NumIndices: 2,
301 RET: MSP430RegEncodingTable);
302
303 switch (DwarfFlavour) {
304 default:
305 llvm_unreachable("Unknown DWARF flavour");
306 case 0:
307 mapDwarfRegsToLLVMRegs(Map: MSP430DwarfFlavour0Dwarf2L, Size: MSP430DwarfFlavour0Dwarf2LSize, isEH: false);
308 break;
309 }
310 switch (EHFlavour) {
311 default:
312 llvm_unreachable("Unknown DWARF flavour");
313 case 0:
314 mapDwarfRegsToLLVMRegs(Map: MSP430EHFlavour0Dwarf2L, Size: MSP430EHFlavour0Dwarf2LSize, isEH: true);
315 break;
316 }
317 switch (DwarfFlavour) {
318 default:
319 llvm_unreachable("Unknown DWARF flavour");
320 case 0:
321 mapLLVMRegsToDwarfRegs(Map: MSP430DwarfFlavour0L2Dwarf, Size: MSP430DwarfFlavour0L2DwarfSize, isEH: false);
322 break;
323 }
324 switch (EHFlavour) {
325 default:
326 llvm_unreachable("Unknown DWARF flavour");
327 case 0:
328 mapLLVMRegsToDwarfRegs(Map: MSP430EHFlavour0L2Dwarf, Size: MSP430EHFlavour0L2DwarfSize, isEH: true);
329 break;
330 }
331}
332
333
334
335ArrayRef<const uint32_t *> MSP430GenRegisterInfo::getRegMasks() const {
336 return {};
337}
338
339bool MSP430GenRegisterInfo::
340isGeneralPurposeRegister(const MachineFunction &MF, MCRegister PhysReg) const {
341 return
342 false;
343}
344
345bool MSP430GenRegisterInfo::
346isGeneralPurposeRegisterClass(const TargetRegisterClass *RC) const {
347 return
348 false;
349}
350
351bool MSP430GenRegisterInfo::
352isFixedRegister(const MachineFunction &MF, MCRegister PhysReg) const {
353 return
354 false;
355}
356
357bool MSP430GenRegisterInfo::
358isArgumentRegister(const MachineFunction &MF, MCRegister PhysReg) const {
359 return
360 false;
361}
362
363bool MSP430GenRegisterInfo::
364isConstantPhysReg(MCRegister PhysReg) const {
365 return
366 false;
367}
368
369ArrayRef<const char *> MSP430GenRegisterInfo::getRegMaskNames() const {
370 return {};
371}
372
373const MSP430FrameLowering *
374MSP430GenRegisterInfo::getFrameLowering(const MachineFunction &MF) {
375 return static_cast<const MSP430FrameLowering *>(
376 MF.getSubtarget().getFrameLowering());
377}
378
379} // end namespace llvm
380
381