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