File: bare-minimum-psets.td

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (67 lines) | stat: -rw-r--r-- 2,091 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// RUN: llvm-tblgen -gen-register-info -I %p/../../include -I %p/Common %s | FileCheck %s

// Test to check the bare minimum pressure sets.
// At least one register pressure set is required for the target.
// Allowed the pset only for D_32 regclass and ignored it for all
// other classes including the tuples.
include "llvm/Target/Target.td"

class MyClass<int size, list<ValueType> types, dag registers>
  : RegisterClass<"MyTarget", types, size, registers> {
  let Size = size;
}

def sub0 : SubRegIndex<32>;
def sub1 : SubRegIndex<32, 32>;

let Namespace = "MyTarget" in {
  def D : Register<"d">;
  foreach Index = 0-7 in {
    def S#Index : Register <"s"#Index>;
  }
}

// Should generate psets for D_32
def D_32 : MyClass<32,  [i32], (add D)>;

let GeneratePressureSet = 0 in {
  def S_32 : MyClass<32,  [i32], (sequence "S%u", 0, 7)>;
  def SD_32 : MyClass<32,  [i32], (add S_32, D_32)>;
}

def S_64 : RegisterTuples<[sub0, sub1],
                           [(decimate (shl S_32, 0), 1),
                            (decimate (shl S_32, 1), 1)
                           ]>;

def SReg_64 : MyClass<64, [i64], (add S_64)> {
  let GeneratePressureSet = 0;
}

def MyTarget : Target;

// CHECK-LABEL:    // Register pressure sets enum.
// CHECK-NEXT: namespace MyTarget {
// CHECK-NEXT: enum RegisterPressureSets {
// CHECK-NEXT: D_32 = 0,
// CHECK-NEXT:  };
// NAMESPACE-NEXT: } // end namespace TestNamespace

// CHECK-LABEL: getRegPressureSetName(unsigned Idx) const {
// CHECK-NEXT:    static const char *const PressureNameTable[] = {
// CHECK-NEXT:      "D_32",
// CHECK-NEXT:    };
// CHECK-NEXT:    return PressureNameTable[Idx];
// CHECK-NEXT:  }

// CHECK:      unsigned MyTargetGenRegisterInfo::
// CHECK-NEXT: getRegPressureSetLimit(const MachineFunction &MF, unsigned Idx) const {
// CHECK-NEXT:  static const uint8_t PressureLimitTable[] = {
// CHECK-NEXT:    {{[0-9]+}},        // 0: D_32
// CHECK-NEXT:  };
// CHECK-NEXT:  return PressureLimitTable[Idx];
// CHECK-NEXT:}

// CHECK:      static const int RCSetsTable[] = {
// CHECK-NEXT:   /* 0 */ 0, -1,
// CHECK-NEXT: };