1 // RUN: llvm-tblgen -gen-register-info -I %p/../../include -I %p/Common %s | FileCheck %s
3 // Checks two CostPerUse values for the registers.
4 include "llvm/Target/Target.td"
6 let Namespace = "MyTarget" in {
7 foreach Index = 0-3 in {
8 // Adding two cost values per register.
9 let CostPerUse = [1, Index] in {
10 def S#Index : Register <"s"#Index>;
14 // CostPerUse by default to 0.
15 def D0 : Register<"d0">;
16 def D1 : Register<"d1">;
18 } // Namespace = "MyTarget"
20 def SRegs : RegisterClass<"MyTarget", [i32], 32, (sequence "S%u", 0, 3)>;
21 def DRegs : RegisterClass<"MyTarget", [i32], 32, (sequence "D%u", 0, 1)>;
23 def MyTarget : Target;
25 // CHECK: static const uint8_t CostPerUseTable[] = {
26 // CHECK-NEXT: 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 2, 3, };
28 // CHECK: static const bool InAllocatableClassTable[] = {
29 // CHECK-NEXT: false, true, true, true, true, true, true, };
31 // CHECK: static const TargetRegisterInfoDesc MyTargetRegInfoDesc = { // Extra Descriptors
32 // CHECK-NEXT: CostPerUseTable, 2, InAllocatableClassTable};
34 // CHECK: TargetRegisterInfo(&MyTargetRegInfoDesc, RegisterClasses, RegisterClasses+2,