Coverage Report

Created: 2024-01-17 10:31

/src/build/lib/Target/MSP430/MSP430GenRegisterInfo.inc
Line
Count
Source (jump to first uncovered line)
1
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2
|*                                                                            *|
3
|* Target Register Enum Values                                                *|
4
|*                                                                            *|
5
|* Automatically generated file, do not edit!                                 *|
6
|*                                                                            *|
7
\*===----------------------------------------------------------------------===*/
8
9
10
#ifdef GET_REGINFO_ENUM
11
#undef GET_REGINFO_ENUM
12
13
namespace llvm {
14
15
class MCRegisterClass;
16
extern const MCRegisterClass MSP430MCRegisterClasses[];
17
18
namespace MSP430 {
19
enum {
20
  NoRegister,
21
  CG = 1,
22
  CGB = 2,
23
  PC = 3,
24
  PCB = 4,
25
  SP = 5,
26
  SPB = 6,
27
  SR = 7,
28
  SRB = 8,
29
  R4 = 9,
30
  R5 = 10,
31
  R6 = 11,
32
  R7 = 12,
33
  R8 = 13,
34
  R9 = 14,
35
  R10 = 15,
36
  R11 = 16,
37
  R12 = 17,
38
  R13 = 18,
39
  R14 = 19,
40
  R15 = 20,
41
  R4B = 21,
42
  R5B = 22,
43
  R6B = 23,
44
  R7B = 24,
45
  R8B = 25,
46
  R9B = 26,
47
  R10B = 27,
48
  R11B = 28,
49
  R12B = 29,
50
  R13B = 30,
51
  R14B = 31,
52
  R15B = 32,
53
  NUM_TARGET_REGS // 33
54
};
55
} // end namespace MSP430
56
57
// Register classes
58
59
namespace MSP430 {
60
enum {
61
  GR8RegClassID = 0,
62
  GR16RegClassID = 1,
63
64
};
65
} // end namespace MSP430
66
67
68
// Subregister indices
69
70
namespace MSP430 {
71
enum : uint16_t {
72
  NoSubRegister,
73
  subreg_8bit,  // 1
74
  NUM_TARGET_SUBREGS
75
};
76
} // end namespace MSP430
77
78
// Register pressure sets enum.
79
namespace MSP430 {
80
enum RegisterPressureSets {
81
  GR8 = 0,
82
};
83
} // end namespace MSP430
84
85
} // end namespace llvm
86
87
#endif // GET_REGINFO_ENUM
88
89
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
90
|*                                                                            *|
91
|* MC Register Information                                                    *|
92
|*                                                                            *|
93
|* Automatically generated file, do not edit!                                 *|
94
|*                                                                            *|
95
\*===----------------------------------------------------------------------===*/
96
97
98
#ifdef GET_REGINFO_MC_DESC
99
#undef GET_REGINFO_MC_DESC
100
101
namespace llvm {
102
103
extern const int16_t MSP430RegDiffLists[] = {
104
  /* 0 */ -12, 0,
105
  /* 2 */ -1, 0,
106
  /* 4 */ 1, 0,
107
  /* 6 */ 12, 0,
108
};
109
110
extern const LaneBitmask MSP430LaneMaskLists[] = {
111
  /* 0 */ LaneBitmask(0x0000000000000001), LaneBitmask::getAll(),
112
  /* 2 */ LaneBitmask(0xFFFFFFFFFFFFFFFF), LaneBitmask::getAll(),
113
};
114
115
extern const uint16_t MSP430SubRegIdxLists[] = {
116
  /* 0 */ 1, 0,
117
};
118
119
extern const MCRegisterInfo::SubRegCoveredBits MSP430SubRegIdxRanges[] = {
120
  { 65535, 65535 },
121
  { 0, 8 }, // subreg_8bit
122
};
123
124
125
#ifdef __GNUC__
126
#pragma GCC diagnostic push
127
#pragma GCC diagnostic ignored "-Woverlength-strings"
128
#endif
129
extern const char MSP430RegStrings[] = {
130
  /* 0 */ "R10\0"
131
  /* 4 */ "R11\0"
132
  /* 8 */ "R12\0"
133
  /* 12 */ "R13\0"
134
  /* 16 */ "R14\0"
135
  /* 20 */ "R4\0"
136
  /* 23 */ "R15\0"
137
  /* 27 */ "R5\0"
138
  /* 30 */ "R6\0"
139
  /* 33 */ "R7\0"
140
  /* 36 */ "R8\0"
141
  /* 39 */ "R9\0"
142
  /* 42 */ "R10B\0"
143
  /* 47 */ "R11B\0"
144
  /* 52 */ "R12B\0"
145
  /* 57 */ "R13B\0"
146
  /* 62 */ "R14B\0"
147
  /* 67 */ "R4B\0"
148
  /* 71 */ "R15B\0"
149
  /* 76 */ "R5B\0"
150
  /* 80 */ "R6B\0"
151
  /* 84 */ "R7B\0"
152
  /* 88 */ "R8B\0"
153
  /* 92 */ "R9B\0"
154
  /* 96 */ "PCB\0"
155
  /* 100 */ "CGB\0"
156
  /* 104 */ "SPB\0"
157
  /* 108 */ "SRB\0"
158
  /* 112 */ "PC\0"
159
  /* 115 */ "CG\0"
160
  /* 118 */ "SP\0"
161
  /* 121 */ "SR\0"
162
};
163
#ifdef __GNUC__
164
#pragma GCC diagnostic pop
165
#endif
166
167
extern const MCRegisterDesc MSP430RegDesc[] = { // Descriptors
168
  { 3, 0, 0, 0, 0, 0 },
169
  { 115, 4, 1, 0, 4096, 0 },
170
  { 100, 1, 2, 1, 4096, 2 },
171
  { 112, 4, 1, 0, 4097, 0 },
172
  { 96, 1, 2, 1, 4097, 2 },
173
  { 118, 4, 1, 0, 4098, 0 },
174
  { 104, 1, 2, 1, 4098, 2 },
175
  { 121, 4, 1, 0, 4099, 0 },
176
  { 108, 1, 2, 1, 4099, 2 },
177
  { 20, 6, 1, 0, 4100, 0 },
178
  { 27, 6, 1, 0, 4101, 0 },
179
  { 30, 6, 1, 0, 4102, 0 },
180
  { 33, 6, 1, 0, 4103, 0 },
181
  { 36, 6, 1, 0, 4104, 0 },
182
  { 39, 6, 1, 0, 4105, 0 },
183
  { 0, 6, 1, 0, 4106, 0 },
184
  { 4, 6, 1, 0, 4107, 0 },
185
  { 8, 6, 1, 0, 4108, 0 },
186
  { 12, 6, 1, 0, 4109, 0 },
187
  { 16, 6, 1, 0, 4110, 0 },
188
  { 23, 6, 1, 0, 4111, 0 },
189
  { 67, 1, 0, 1, 4100, 2 },
190
  { 76, 1, 0, 1, 4101, 2 },
191
  { 80, 1, 0, 1, 4102, 2 },
192
  { 84, 1, 0, 1, 4103, 2 },
193
  { 88, 1, 0, 1, 4104, 2 },
194
  { 92, 1, 0, 1, 4105, 2 },
195
  { 42, 1, 0, 1, 4106, 2 },
196
  { 47, 1, 0, 1, 4107, 2 },
197
  { 52, 1, 0, 1, 4108, 2 },
198
  { 57, 1, 0, 1, 4109, 2 },
199
  { 62, 1, 0, 1, 4110, 2 },
200
  { 71, 1, 0, 1, 4111, 2 },
201
};
202
203
extern const MCPhysReg MSP430RegUnitRoots[][2] = {
204
  { MSP430::CGB },
205
  { MSP430::PCB },
206
  { MSP430::SPB },
207
  { MSP430::SRB },
208
  { MSP430::R4B },
209
  { MSP430::R5B },
210
  { MSP430::R6B },
211
  { MSP430::R7B },
212
  { MSP430::R8B },
213
  { MSP430::R9B },
214
  { MSP430::R10B },
215
  { MSP430::R11B },
216
  { MSP430::R12B },
217
  { MSP430::R13B },
218
  { MSP430::R14B },
219
  { MSP430::R15B },
220
};
221
222
namespace {     // Register classes...
223
  // GR8 Register Class...
224
  const MCPhysReg GR8[] = {
225
    MSP430::R12B, MSP430::R13B, MSP430::R14B, MSP430::R15B, MSP430::R11B, MSP430::R10B, MSP430::R9B, MSP430::R8B, MSP430::R7B, MSP430::R6B, MSP430::R5B, MSP430::R4B, MSP430::PCB, MSP430::SPB, MSP430::SRB, MSP430::CGB, 
226
  };
227
228
  // GR8 Bit set.
229
  const uint8_t GR8Bits[] = {
230
    0x54, 0x01, 0xe0, 0xff, 0x01, 
231
  };
232
233
  // GR16 Register Class...
234
  const MCPhysReg GR16[] = {
235
    MSP430::R12, MSP430::R13, MSP430::R14, MSP430::R15, MSP430::R11, MSP430::R10, MSP430::R9, MSP430::R8, MSP430::R7, MSP430::R6, MSP430::R5, MSP430::R4, MSP430::PC, MSP430::SP, MSP430::SR, MSP430::CG, 
236
  };
237
238
  // GR16 Bit set.
239
  const uint8_t GR16Bits[] = {
240
    0xaa, 0xfe, 0x1f, 
241
  };
242
243
} // end anonymous namespace
244
245
246
#ifdef __GNUC__
247
#pragma GCC diagnostic push
248
#pragma GCC diagnostic ignored "-Woverlength-strings"
249
#endif
250
extern const char MSP430RegClassStrings[] = {
251
  /* 0 */ "GR16\0"
252
  /* 5 */ "GR8\0"
253
};
254
#ifdef __GNUC__
255
#pragma GCC diagnostic pop
256
#endif
257
258
extern const MCRegisterClass MSP430MCRegisterClasses[] = {
259
  { GR8, GR8Bits, 5, 16, sizeof(GR8Bits), MSP430::GR8RegClassID, 8, 1, true },
260
  { GR16, GR16Bits, 0, 16, sizeof(GR16Bits), MSP430::GR16RegClassID, 16, 1, true },
261
};
262
263
// MSP430 Dwarf<->LLVM register mappings.
264
extern const MCRegisterInfo::DwarfLLVMRegPair MSP430DwarfFlavour0Dwarf2L[] = {
265
  { 0U, MSP430::PC },
266
  { 1U, MSP430::SP },
267
  { 2U, MSP430::SR },
268
  { 3U, MSP430::CG },
269
  { 4U, MSP430::R4 },
270
  { 5U, MSP430::R5 },
271
  { 6U, MSP430::R6 },
272
  { 7U, MSP430::R7 },
273
  { 8U, MSP430::R8 },
274
  { 9U, MSP430::R9 },
275
  { 10U, MSP430::R10 },
276
  { 11U, MSP430::R11 },
277
  { 12U, MSP430::R12 },
278
  { 13U, MSP430::R13 },
279
  { 14U, MSP430::R14 },
280
  { 15U, MSP430::R15 },
281
  { 16U, MSP430::PCB },
282
  { 17U, MSP430::SPB },
283
  { 18U, MSP430::SRB },
284
  { 19U, MSP430::CGB },
285
  { 20U, MSP430::R4B },
286
  { 21U, MSP430::R5B },
287
  { 22U, MSP430::R6B },
288
  { 23U, MSP430::R7B },
289
  { 24U, MSP430::R8B },
290
  { 25U, MSP430::R9B },
291
  { 26U, MSP430::R10B },
292
  { 27U, MSP430::R11B },
293
  { 28U, MSP430::R12B },
294
  { 29U, MSP430::R13B },
295
  { 30U, MSP430::R14B },
296
  { 31U, MSP430::R15B },
297
};
298
extern const unsigned MSP430DwarfFlavour0Dwarf2LSize = std::size(MSP430DwarfFlavour0Dwarf2L);
299
300
extern const MCRegisterInfo::DwarfLLVMRegPair MSP430EHFlavour0Dwarf2L[] = {
301
  { 0U, MSP430::PC },
302
  { 1U, MSP430::SP },
303
  { 2U, MSP430::SR },
304
  { 3U, MSP430::CG },
305
  { 4U, MSP430::R4 },
306
  { 5U, MSP430::R5 },
307
  { 6U, MSP430::R6 },
308
  { 7U, MSP430::R7 },
309
  { 8U, MSP430::R8 },
310
  { 9U, MSP430::R9 },
311
  { 10U, MSP430::R10 },
312
  { 11U, MSP430::R11 },
313
  { 12U, MSP430::R12 },
314
  { 13U, MSP430::R13 },
315
  { 14U, MSP430::R14 },
316
  { 15U, MSP430::R15 },
317
  { 16U, MSP430::PCB },
318
  { 17U, MSP430::SPB },
319
  { 18U, MSP430::SRB },
320
  { 19U, MSP430::CGB },
321
  { 20U, MSP430::R4B },
322
  { 21U, MSP430::R5B },
323
  { 22U, MSP430::R6B },
324
  { 23U, MSP430::R7B },
325
  { 24U, MSP430::R8B },
326
  { 25U, MSP430::R9B },
327
  { 26U, MSP430::R10B },
328
  { 27U, MSP430::R11B },
329
  { 28U, MSP430::R12B },
330
  { 29U, MSP430::R13B },
331
  { 30U, MSP430::R14B },
332
  { 31U, MSP430::R15B },
333
};
334
extern const unsigned MSP430EHFlavour0Dwarf2LSize = std::size(MSP430EHFlavour0Dwarf2L);
335
336
extern const MCRegisterInfo::DwarfLLVMRegPair MSP430DwarfFlavour0L2Dwarf[] = {
337
  { MSP430::CG, 3U },
338
  { MSP430::CGB, 19U },
339
  { MSP430::PC, 0U },
340
  { MSP430::PCB, 16U },
341
  { MSP430::SP, 1U },
342
  { MSP430::SPB, 17U },
343
  { MSP430::SR, 2U },
344
  { MSP430::SRB, 18U },
345
  { MSP430::R4, 4U },
346
  { MSP430::R5, 5U },
347
  { MSP430::R6, 6U },
348
  { MSP430::R7, 7U },
349
  { MSP430::R8, 8U },
350
  { MSP430::R9, 9U },
351
  { MSP430::R10, 10U },
352
  { MSP430::R11, 11U },
353
  { MSP430::R12, 12U },
354
  { MSP430::R13, 13U },
355
  { MSP430::R14, 14U },
356
  { MSP430::R15, 15U },
357
  { MSP430::R4B, 20U },
358
  { MSP430::R5B, 21U },
359
  { MSP430::R6B, 22U },
360
  { MSP430::R7B, 23U },
361
  { MSP430::R8B, 24U },
362
  { MSP430::R9B, 25U },
363
  { MSP430::R10B, 26U },
364
  { MSP430::R11B, 27U },
365
  { MSP430::R12B, 28U },
366
  { MSP430::R13B, 29U },
367
  { MSP430::R14B, 30U },
368
  { MSP430::R15B, 31U },
369
};
370
extern const unsigned MSP430DwarfFlavour0L2DwarfSize = std::size(MSP430DwarfFlavour0L2Dwarf);
371
372
extern const MCRegisterInfo::DwarfLLVMRegPair MSP430EHFlavour0L2Dwarf[] = {
373
  { MSP430::CG, 3U },
374
  { MSP430::CGB, 19U },
375
  { MSP430::PC, 0U },
376
  { MSP430::PCB, 16U },
377
  { MSP430::SP, 1U },
378
  { MSP430::SPB, 17U },
379
  { MSP430::SR, 2U },
380
  { MSP430::SRB, 18U },
381
  { MSP430::R4, 4U },
382
  { MSP430::R5, 5U },
383
  { MSP430::R6, 6U },
384
  { MSP430::R7, 7U },
385
  { MSP430::R8, 8U },
386
  { MSP430::R9, 9U },
387
  { MSP430::R10, 10U },
388
  { MSP430::R11, 11U },
389
  { MSP430::R12, 12U },
390
  { MSP430::R13, 13U },
391
  { MSP430::R14, 14U },
392
  { MSP430::R15, 15U },
393
  { MSP430::R4B, 20U },
394
  { MSP430::R5B, 21U },
395
  { MSP430::R6B, 22U },
396
  { MSP430::R7B, 23U },
397
  { MSP430::R8B, 24U },
398
  { MSP430::R9B, 25U },
399
  { MSP430::R10B, 26U },
400
  { MSP430::R11B, 27U },
401
  { MSP430::R12B, 28U },
402
  { MSP430::R13B, 29U },
403
  { MSP430::R14B, 30U },
404
  { MSP430::R15B, 31U },
405
};
406
extern const unsigned MSP430EHFlavour0L2DwarfSize = std::size(MSP430EHFlavour0L2Dwarf);
407
408
extern const uint16_t MSP430RegEncodingTable[] = {
409
  0,
410
  3,
411
  3,
412
  0,
413
  0,
414
  1,
415
  1,
416
  2,
417
  2,
418
  4,
419
  5,
420
  6,
421
  7,
422
  8,
423
  9,
424
  10,
425
  11,
426
  12,
427
  13,
428
  14,
429
  15,
430
  4,
431
  5,
432
  6,
433
  7,
434
  8,
435
  9,
436
  10,
437
  11,
438
  12,
439
  13,
440
  14,
441
  15,
442
};
443
0
static inline void InitMSP430MCRegisterInfo(MCRegisterInfo *RI, unsigned RA, unsigned DwarfFlavour = 0, unsigned EHFlavour = 0, unsigned PC = 0) {
444
0
  RI->InitMCRegisterInfo(MSP430RegDesc, 33, RA, PC, MSP430MCRegisterClasses, 2, MSP430RegUnitRoots, 16, MSP430RegDiffLists, MSP430LaneMaskLists, MSP430RegStrings, MSP430RegClassStrings, MSP430SubRegIdxLists, 2,
445
0
MSP430SubRegIdxRanges, MSP430RegEncodingTable);
446
447
0
  switch (DwarfFlavour) {
448
0
  default:
449
0
    llvm_unreachable("Unknown DWARF flavour");
450
0
  case 0:
451
0
    RI->mapDwarfRegsToLLVMRegs(MSP430DwarfFlavour0Dwarf2L, MSP430DwarfFlavour0Dwarf2LSize, false);
452
0
    break;
453
0
  }
454
0
  switch (EHFlavour) {
455
0
  default:
456
0
    llvm_unreachable("Unknown DWARF flavour");
457
0
  case 0:
458
0
    RI->mapDwarfRegsToLLVMRegs(MSP430EHFlavour0Dwarf2L, MSP430EHFlavour0Dwarf2LSize, true);
459
0
    break;
460
0
  }
461
0
  switch (DwarfFlavour) {
462
0
  default:
463
0
    llvm_unreachable("Unknown DWARF flavour");
464
0
  case 0:
465
0
    RI->mapLLVMRegsToDwarfRegs(MSP430DwarfFlavour0L2Dwarf, MSP430DwarfFlavour0L2DwarfSize, false);
466
0
    break;
467
0
  }
468
0
  switch (EHFlavour) {
469
0
  default:
470
0
    llvm_unreachable("Unknown DWARF flavour");
471
0
  case 0:
472
0
    RI->mapLLVMRegsToDwarfRegs(MSP430EHFlavour0L2Dwarf, MSP430EHFlavour0L2DwarfSize, true);
473
0
    break;
474
0
  }
475
0
}
476
477
} // end namespace llvm
478
479
#endif // GET_REGINFO_MC_DESC
480
481
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
482
|*                                                                            *|
483
|* Register Information Header Fragment                                       *|
484
|*                                                                            *|
485
|* Automatically generated file, do not edit!                                 *|
486
|*                                                                            *|
487
\*===----------------------------------------------------------------------===*/
488
489
490
#ifdef GET_REGINFO_HEADER
491
#undef GET_REGINFO_HEADER
492
493
#include "llvm/CodeGen/TargetRegisterInfo.h"
494
495
namespace llvm {
496
497
class MSP430FrameLowering;
498
499
struct MSP430GenRegisterInfo : public TargetRegisterInfo {
500
  explicit MSP430GenRegisterInfo(unsigned RA, unsigned D = 0, unsigned E = 0,
501
      unsigned PC = 0, unsigned HwMode = 0);
502
  unsigned composeSubRegIndicesImpl(unsigned, unsigned) const override;
503
  LaneBitmask composeSubRegIndexLaneMaskImpl(unsigned, LaneBitmask) const override;
504
  LaneBitmask reverseComposeSubRegIndexLaneMaskImpl(unsigned, LaneBitmask) const override;
505
  const TargetRegisterClass *getSubClassWithSubReg(const TargetRegisterClass *, unsigned) const override;
506
  const TargetRegisterClass *getSubRegisterClass(const TargetRegisterClass *, unsigned) const override;
507
  const RegClassWeight &getRegClassWeight(const TargetRegisterClass *RC) const override;
508
  unsigned getRegUnitWeight(unsigned RegUnit) const override;
509
  unsigned getNumRegPressureSets() const override;
510
  const char *getRegPressureSetName(unsigned Idx) const override;
511
  unsigned getRegPressureSetLimit(const MachineFunction &MF, unsigned Idx) const override;
512
  const int *getRegClassPressureSets(const TargetRegisterClass *RC) const override;
513
  const int *getRegUnitPressureSets(unsigned RegUnit) const override;
514
  ArrayRef<const char *> getRegMaskNames() const override;
515
  ArrayRef<const uint32_t *> getRegMasks() const override;
516
  bool isGeneralPurposeRegister(const MachineFunction &, MCRegister) const override;
517
  bool isFixedRegister(const MachineFunction &, MCRegister) const override;
518
  bool isArgumentRegister(const MachineFunction &, MCRegister) const override;
519
  bool isConstantPhysReg(MCRegister PhysReg) const override final;
520
  /// Devirtualized TargetFrameLowering.
521
  static const MSP430FrameLowering *getFrameLowering(
522
      const MachineFunction &MF);
523
};
524
525
namespace MSP430 { // Register classes
526
  extern const TargetRegisterClass GR8RegClass;
527
  extern const TargetRegisterClass GR16RegClass;
528
} // end namespace MSP430
529
530
} // end namespace llvm
531
532
#endif // GET_REGINFO_HEADER
533
534
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
535
|*                                                                            *|
536
|* Target Register and Register Classes Information                           *|
537
|*                                                                            *|
538
|* Automatically generated file, do not edit!                                 *|
539
|*                                                                            *|
540
\*===----------------------------------------------------------------------===*/
541
542
543
#ifdef GET_REGINFO_TARGET_DESC
544
#undef GET_REGINFO_TARGET_DESC
545
546
namespace llvm {
547
548
extern const MCRegisterClass MSP430MCRegisterClasses[];
549
550
static const MVT::SimpleValueType VTLists[] = {
551
  /* 0 */ MVT::i8, MVT::Other,
552
  /* 2 */ MVT::i16, MVT::Other,
553
};
554
555
static const char *SubRegIndexNameTable[] = { "subreg_8bit", "" };
556
557
558
static const LaneBitmask SubRegIndexLaneMaskTable[] = {
559
  LaneBitmask::getAll(),
560
  LaneBitmask(0x0000000000000001), // subreg_8bit
561
 };
562
563
564
565
static const TargetRegisterInfo::RegClassInfo RegClassInfos[] = {
566
  // Mode = 0 (Default)
567
  { 8, 8, 8, /*VTLists+*/0 },    // GR8
568
  { 16, 16, 16, /*VTLists+*/2 },    // GR16
569
};
570
571
static const TargetRegisterClass *const NullRegClasses[] = { nullptr };
572
573
static const uint32_t GR8SubClassMask[] = {
574
  0x00000001, 
575
  0x00000002, // subreg_8bit
576
};
577
578
static const uint32_t GR16SubClassMask[] = {
579
  0x00000002, 
580
};
581
582
static const uint16_t SuperRegIdxSeqs[] = {
583
  /* 0 */ 1, 0,
584
};
585
586
587
namespace MSP430 {   // Register class instances
588
  extern const TargetRegisterClass GR8RegClass = {
589
    &MSP430MCRegisterClasses[GR8RegClassID],
590
    GR8SubClassMask,
591
    SuperRegIdxSeqs + 0,
592
    LaneBitmask(0x0000000000000001),
593
    0,
594
    false,
595
    0x00, /* TSFlags */
596
    false, /* HasDisjunctSubRegs */
597
    false, /* CoveredBySubRegs */
598
    NullRegClasses,
599
    nullptr
600
  };
601
602
  extern const TargetRegisterClass GR16RegClass = {
603
    &MSP430MCRegisterClasses[GR16RegClassID],
604
    GR16SubClassMask,
605
    SuperRegIdxSeqs + 1,
606
    LaneBitmask(0x0000000000000001),
607
    0,
608
    false,
609
    0x00, /* TSFlags */
610
    false, /* HasDisjunctSubRegs */
611
    false, /* CoveredBySubRegs */
612
    NullRegClasses,
613
    nullptr
614
  };
615
616
} // end namespace MSP430
617
618
namespace {
619
  const TargetRegisterClass *const RegisterClasses[] = {
620
    &MSP430::GR8RegClass,
621
    &MSP430::GR16RegClass,
622
  };
623
} // end anonymous namespace
624
625
static const uint8_t CostPerUseTable[] = { 
626
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, 0, };
627
628
629
static const bool InAllocatableClassTable[] = { 
630
false, 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, };
631
632
633
static const TargetRegisterInfoDesc MSP430RegInfoDesc = { // Extra Descriptors
634
CostPerUseTable, 1, InAllocatableClassTable};
635
636
0
unsigned MSP430GenRegisterInfo::composeSubRegIndicesImpl(unsigned IdxA, unsigned IdxB) const {
637
0
  static const uint8_t Rows[1][1] = {
638
0
    { 0, },
639
0
  };
640
641
0
  --IdxA; assert(IdxA < 1); (void) IdxA;
642
0
  --IdxB; assert(IdxB < 1);
643
0
  return Rows[0][IdxB];
644
0
}
645
646
  struct MaskRolOp {
647
    LaneBitmask Mask;
648
    uint8_t  RotateLeft;
649
  };
650
  static const MaskRolOp LaneMaskComposeSequences[] = {
651
    { LaneBitmask(0xFFFFFFFFFFFFFFFF),  0 }, { LaneBitmask::getNone(), 0 }  // Sequence 0
652
  };
653
  static const uint8_t CompositeSequences[] = {
654
    0 // to subreg_8bit
655
  };
656
657
0
LaneBitmask MSP430GenRegisterInfo::composeSubRegIndexLaneMaskImpl(unsigned IdxA, LaneBitmask LaneMask) const {
658
0
  --IdxA; assert(IdxA < 1 && "Subregister index out of bounds");
659
0
  LaneBitmask Result;
660
0
  for (const MaskRolOp *Ops =
661
0
       &LaneMaskComposeSequences[CompositeSequences[IdxA]];
662
0
       Ops->Mask.any(); ++Ops) {
663
0
    LaneBitmask::Type M = LaneMask.getAsInteger() & Ops->Mask.getAsInteger();
664
0
    if (unsigned S = Ops->RotateLeft)
665
0
      Result |= LaneBitmask((M << S) | (M >> (LaneBitmask::BitWidth - S)));
666
0
    else
667
0
      Result |= LaneBitmask(M);
668
0
  }
669
0
  return Result;
670
0
}
671
672
0
LaneBitmask MSP430GenRegisterInfo::reverseComposeSubRegIndexLaneMaskImpl(unsigned IdxA,  LaneBitmask LaneMask) const {
673
0
  LaneMask &= getSubRegIndexLaneMask(IdxA);
674
0
  --IdxA; assert(IdxA < 1 && "Subregister index out of bounds");
675
0
  LaneBitmask Result;
676
0
  for (const MaskRolOp *Ops =
677
0
       &LaneMaskComposeSequences[CompositeSequences[IdxA]];
678
0
       Ops->Mask.any(); ++Ops) {
679
0
    LaneBitmask::Type M = LaneMask.getAsInteger();
680
0
    if (unsigned S = Ops->RotateLeft)
681
0
      Result |= LaneBitmask((M >> S) | (M << (LaneBitmask::BitWidth - S)));
682
0
    else
683
0
      Result |= LaneBitmask(M);
684
0
  }
685
0
  return Result;
686
0
}
687
688
0
const TargetRegisterClass *MSP430GenRegisterInfo::getSubClassWithSubReg(const TargetRegisterClass *RC, unsigned Idx) const {
689
0
  static const uint8_t Table[2][1] = {
690
0
    { // GR8
691
0
      0,  // subreg_8bit
692
0
    },
693
0
    { // GR16
694
0
      2,  // subreg_8bit -> GR16
695
0
    },
696
0
  };
697
0
  assert(RC && "Missing regclass");
698
0
  if (!Idx) return RC;
699
0
  --Idx;
700
0
  assert(Idx < 1 && "Bad subreg");
701
0
  unsigned TV = Table[RC->getID()][Idx];
702
0
  return TV ? getRegClass(TV - 1) : nullptr;
703
0
}
704
705
0
const TargetRegisterClass *MSP430GenRegisterInfo::getSubRegisterClass(const TargetRegisterClass *RC, unsigned Idx) const {
706
0
  static const uint8_t Table[2][1] = {
707
0
    { // GR8
708
0
      0,  // GR8:subreg_8bit
709
0
    },
710
0
    { // GR16
711
0
      1,  // GR16:subreg_8bit -> GR8
712
0
    },
713
0
  };
714
0
  assert(RC && "Missing regclass");
715
0
  if (!Idx) return RC;
716
0
  --Idx;
717
0
  assert(Idx < 1 && "Bad subreg");
718
0
  unsigned TV = Table[RC->getID()][Idx];
719
0
  return TV ? getRegClass(TV - 1) : nullptr;
720
0
}
721
722
/// Get the weight in units of pressure for this register class.
723
const RegClassWeight &MSP430GenRegisterInfo::
724
0
getRegClassWeight(const TargetRegisterClass *RC) const {
725
0
  static const RegClassWeight RCWeightTable[] = {
726
0
    {1, 16},    // GR8
727
0
    {1, 16},    // GR16
728
0
  };
729
0
  return RCWeightTable[RC->getID()];
730
0
}
731
732
/// Get the weight in units of pressure for this register unit.
733
unsigned MSP430GenRegisterInfo::
734
0
getRegUnitWeight(unsigned RegUnit) const {
735
0
  assert(RegUnit < 16 && "invalid register unit");
736
  // All register units have unit weight.
737
0
  return 1;
738
0
}
739
740
741
// Get the number of dimensions of register pressure.
742
0
unsigned MSP430GenRegisterInfo::getNumRegPressureSets() const {
743
0
  return 1;
744
0
}
745
746
// Get the name of this register unit pressure set.
747
const char *MSP430GenRegisterInfo::
748
0
getRegPressureSetName(unsigned Idx) const {
749
0
  static const char *PressureNameTable[] = {
750
0
    "GR8",
751
0
  };
752
0
  return PressureNameTable[Idx];
753
0
}
754
755
// Get the register unit pressure limit for this dimension.
756
// This limit must be adjusted dynamically for reserved registers.
757
unsigned MSP430GenRegisterInfo::
758
0
getRegPressureSetLimit(const MachineFunction &MF, unsigned Idx) const {
759
0
  static const uint8_t PressureLimitTable[] = {
760
0
    16,   // 0: GR8
761
0
  };
762
0
  return PressureLimitTable[Idx];
763
0
}
764
765
/// Table of pressure sets per register class or unit.
766
static const int RCSetsTable[] = {
767
  /* 0 */ 0, -1,
768
};
769
770
/// Get the dimensions of register pressure impacted by this register class.
771
/// Returns a -1 terminated array of pressure set IDs
772
const int *MSP430GenRegisterInfo::
773
0
getRegClassPressureSets(const TargetRegisterClass *RC) const {
774
0
  static const uint8_t RCSetStartTable[] = {
775
0
    0,0,};
776
0
  return &RCSetsTable[RCSetStartTable[RC->getID()]];
777
0
}
778
779
/// Get the dimensions of register pressure impacted by this register unit.
780
/// Returns a -1 terminated array of pressure set IDs
781
const int *MSP430GenRegisterInfo::
782
0
getRegUnitPressureSets(unsigned RegUnit) const {
783
0
  assert(RegUnit < 16 && "invalid register unit");
784
0
  static const uint8_t RUSetStartTable[] = {
785
0
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
786
0
  return &RCSetsTable[RUSetStartTable[RegUnit]];
787
0
}
788
789
extern const MCRegisterDesc MSP430RegDesc[];
790
extern const int16_t MSP430RegDiffLists[];
791
extern const LaneBitmask MSP430LaneMaskLists[];
792
extern const char MSP430RegStrings[];
793
extern const char MSP430RegClassStrings[];
794
extern const MCPhysReg MSP430RegUnitRoots[][2];
795
extern const uint16_t MSP430SubRegIdxLists[];
796
extern const MCRegisterInfo::SubRegCoveredBits MSP430SubRegIdxRanges[];
797
extern const uint16_t MSP430RegEncodingTable[];
798
// MSP430 Dwarf<->LLVM register mappings.
799
extern const MCRegisterInfo::DwarfLLVMRegPair MSP430DwarfFlavour0Dwarf2L[];
800
extern const unsigned MSP430DwarfFlavour0Dwarf2LSize;
801
802
extern const MCRegisterInfo::DwarfLLVMRegPair MSP430EHFlavour0Dwarf2L[];
803
extern const unsigned MSP430EHFlavour0Dwarf2LSize;
804
805
extern const MCRegisterInfo::DwarfLLVMRegPair MSP430DwarfFlavour0L2Dwarf[];
806
extern const unsigned MSP430DwarfFlavour0L2DwarfSize;
807
808
extern const MCRegisterInfo::DwarfLLVMRegPair MSP430EHFlavour0L2Dwarf[];
809
extern const unsigned MSP430EHFlavour0L2DwarfSize;
810
811
MSP430GenRegisterInfo::
812
MSP430GenRegisterInfo(unsigned RA, unsigned DwarfFlavour, unsigned EHFlavour,
813
      unsigned PC, unsigned HwMode)
814
  : TargetRegisterInfo(&MSP430RegInfoDesc, RegisterClasses, RegisterClasses+2,
815
             SubRegIndexNameTable, SubRegIndexLaneMaskTable,
816
0
             LaneBitmask(0xFFFFFFFFFFFFFFFE), RegClassInfos, VTLists, HwMode) {
817
0
  InitMCRegisterInfo(MSP430RegDesc, 33, RA, PC,
818
0
                     MSP430MCRegisterClasses, 2,
819
0
                     MSP430RegUnitRoots,
820
0
                     16,
821
0
                     MSP430RegDiffLists,
822
0
                     MSP430LaneMaskLists,
823
0
                     MSP430RegStrings,
824
0
                     MSP430RegClassStrings,
825
0
                     MSP430SubRegIdxLists,
826
0
                     2,
827
0
                     MSP430SubRegIdxRanges,
828
0
                     MSP430RegEncodingTable);
829
830
0
  switch (DwarfFlavour) {
831
0
  default:
832
0
    llvm_unreachable("Unknown DWARF flavour");
833
0
  case 0:
834
0
    mapDwarfRegsToLLVMRegs(MSP430DwarfFlavour0Dwarf2L, MSP430DwarfFlavour0Dwarf2LSize, false);
835
0
    break;
836
0
  }
837
0
  switch (EHFlavour) {
838
0
  default:
839
0
    llvm_unreachable("Unknown DWARF flavour");
840
0
  case 0:
841
0
    mapDwarfRegsToLLVMRegs(MSP430EHFlavour0Dwarf2L, MSP430EHFlavour0Dwarf2LSize, true);
842
0
    break;
843
0
  }
844
0
  switch (DwarfFlavour) {
845
0
  default:
846
0
    llvm_unreachable("Unknown DWARF flavour");
847
0
  case 0:
848
0
    mapLLVMRegsToDwarfRegs(MSP430DwarfFlavour0L2Dwarf, MSP430DwarfFlavour0L2DwarfSize, false);
849
0
    break;
850
0
  }
851
0
  switch (EHFlavour) {
852
0
  default:
853
0
    llvm_unreachable("Unknown DWARF flavour");
854
0
  case 0:
855
0
    mapLLVMRegsToDwarfRegs(MSP430EHFlavour0L2Dwarf, MSP430EHFlavour0L2DwarfSize, true);
856
0
    break;
857
0
  }
858
0
}
859
860
861
862
0
ArrayRef<const uint32_t *> MSP430GenRegisterInfo::getRegMasks() const {
863
0
  return std::nullopt;
864
0
}
865
866
bool MSP430GenRegisterInfo::
867
0
isGeneralPurposeRegister(const MachineFunction &MF, MCRegister PhysReg) const {
868
0
  return
869
0
      false;
870
0
}
871
872
bool MSP430GenRegisterInfo::
873
0
isFixedRegister(const MachineFunction &MF, MCRegister PhysReg) const {
874
0
  return
875
0
      false;
876
0
}
877
878
bool MSP430GenRegisterInfo::
879
0
isArgumentRegister(const MachineFunction &MF, MCRegister PhysReg) const {
880
0
  return
881
0
      false;
882
0
}
883
884
bool MSP430GenRegisterInfo::
885
0
isConstantPhysReg(MCRegister PhysReg) const {
886
0
  return
887
0
      false;
888
0
}
889
890
0
ArrayRef<const char *> MSP430GenRegisterInfo::getRegMaskNames() const {
891
0
  return std::nullopt;
892
0
}
893
894
const MSP430FrameLowering *
895
0
MSP430GenRegisterInfo::getFrameLowering(const MachineFunction &MF) {
896
0
  return static_cast<const MSP430FrameLowering *>(
897
0
      MF.getSubtarget().getFrameLowering());
898
0
}
899
900
} // end namespace llvm
901
902
#endif // GET_REGINFO_TARGET_DESC
903