Coverage Report

Created: 2024-01-17 10:31

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