1//===-- SparcRegisterInfo.td - Sparc Register defs ---------*- tablegen -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10//===----------------------------------------------------------------------===// 11// Declarations that describe the Sparc register file 12//===----------------------------------------------------------------------===// 13 14class SparcReg<string n> : Register<n> { 15 field bits<5> Num; 16 let Namespace = "SP"; 17} 18 19class SparcCtrlReg<string n>: Register<n> { 20 let Namespace = "SP"; 21} 22 23let Namespace = "SP" in { 24def sub_even : SubRegIndex; 25def sub_odd : SubRegIndex; 26} 27 28// Registers are identified with 5-bit ID numbers. 29// Ri - 32-bit integer registers 30class Ri<bits<5> num, string n> : SparcReg<n> { 31 let Num = num; 32} 33// Rf - 32-bit floating-point registers 34class Rf<bits<5> num, string n> : SparcReg<n> { 35 let Num = num; 36} 37// Rd - Slots in the FP register file for 64-bit floating-point values. 38class Rd<bits<5> num, string n, list<Register> subregs> : SparcReg<n> { 39 let Num = num; 40 let SubRegs = subregs; 41 let SubRegIndices = [sub_even, sub_odd]; 42 let CoveredBySubRegs = 1; 43} 44 45// Control Registers 46def ICC : SparcCtrlReg<"ICC">; 47def FCC : SparcCtrlReg<"FCC">; 48 49// Y register 50def Y : SparcCtrlReg<"Y">; 51 52// Integer registers 53def G0 : Ri< 0, "G0">, DwarfRegNum<[0]>; 54def G1 : Ri< 1, "G1">, DwarfRegNum<[1]>; 55def G2 : Ri< 2, "G2">, DwarfRegNum<[2]>; 56def G3 : Ri< 3, "G3">, DwarfRegNum<[3]>; 57def G4 : Ri< 4, "G4">, DwarfRegNum<[4]>; 58def G5 : Ri< 5, "G5">, DwarfRegNum<[5]>; 59def G6 : Ri< 6, "G6">, DwarfRegNum<[6]>; 60def G7 : Ri< 7, "G7">, DwarfRegNum<[7]>; 61def O0 : Ri< 8, "O0">, DwarfRegNum<[8]>; 62def O1 : Ri< 9, "O1">, DwarfRegNum<[9]>; 63def O2 : Ri<10, "O2">, DwarfRegNum<[10]>; 64def O3 : Ri<11, "O3">, DwarfRegNum<[11]>; 65def O4 : Ri<12, "O4">, DwarfRegNum<[12]>; 66def O5 : Ri<13, "O5">, DwarfRegNum<[13]>; 67def O6 : Ri<14, "SP">, DwarfRegNum<[14]>; 68def O7 : Ri<15, "O7">, DwarfRegNum<[15]>; 69def L0 : Ri<16, "L0">, DwarfRegNum<[16]>; 70def L1 : Ri<17, "L1">, DwarfRegNum<[17]>; 71def L2 : Ri<18, "L2">, DwarfRegNum<[18]>; 72def L3 : Ri<19, "L3">, DwarfRegNum<[19]>; 73def L4 : Ri<20, "L4">, DwarfRegNum<[20]>; 74def L5 : Ri<21, "L5">, DwarfRegNum<[21]>; 75def L6 : Ri<22, "L6">, DwarfRegNum<[22]>; 76def L7 : Ri<23, "L7">, DwarfRegNum<[23]>; 77def I0 : Ri<24, "I0">, DwarfRegNum<[24]>; 78def I1 : Ri<25, "I1">, DwarfRegNum<[25]>; 79def I2 : Ri<26, "I2">, DwarfRegNum<[26]>; 80def I3 : Ri<27, "I3">, DwarfRegNum<[27]>; 81def I4 : Ri<28, "I4">, DwarfRegNum<[28]>; 82def I5 : Ri<29, "I5">, DwarfRegNum<[29]>; 83def I6 : Ri<30, "FP">, DwarfRegNum<[30]>; 84def I7 : Ri<31, "I7">, DwarfRegNum<[31]>; 85 86// Floating-point registers 87def F0 : Rf< 0, "F0">, DwarfRegNum<[32]>; 88def F1 : Rf< 1, "F1">, DwarfRegNum<[33]>; 89def F2 : Rf< 2, "F2">, DwarfRegNum<[34]>; 90def F3 : Rf< 3, "F3">, DwarfRegNum<[35]>; 91def F4 : Rf< 4, "F4">, DwarfRegNum<[36]>; 92def F5 : Rf< 5, "F5">, DwarfRegNum<[37]>; 93def F6 : Rf< 6, "F6">, DwarfRegNum<[38]>; 94def F7 : Rf< 7, "F7">, DwarfRegNum<[39]>; 95def F8 : Rf< 8, "F8">, DwarfRegNum<[40]>; 96def F9 : Rf< 9, "F9">, DwarfRegNum<[41]>; 97def F10 : Rf<10, "F10">, DwarfRegNum<[42]>; 98def F11 : Rf<11, "F11">, DwarfRegNum<[43]>; 99def F12 : Rf<12, "F12">, DwarfRegNum<[44]>; 100def F13 : Rf<13, "F13">, DwarfRegNum<[45]>; 101def F14 : Rf<14, "F14">, DwarfRegNum<[46]>; 102def F15 : Rf<15, "F15">, DwarfRegNum<[47]>; 103def F16 : Rf<16, "F16">, DwarfRegNum<[48]>; 104def F17 : Rf<17, "F17">, DwarfRegNum<[49]>; 105def F18 : Rf<18, "F18">, DwarfRegNum<[50]>; 106def F19 : Rf<19, "F19">, DwarfRegNum<[51]>; 107def F20 : Rf<20, "F20">, DwarfRegNum<[52]>; 108def F21 : Rf<21, "F21">, DwarfRegNum<[53]>; 109def F22 : Rf<22, "F22">, DwarfRegNum<[54]>; 110def F23 : Rf<23, "F23">, DwarfRegNum<[55]>; 111def F24 : Rf<24, "F24">, DwarfRegNum<[56]>; 112def F25 : Rf<25, "F25">, DwarfRegNum<[57]>; 113def F26 : Rf<26, "F26">, DwarfRegNum<[58]>; 114def F27 : Rf<27, "F27">, DwarfRegNum<[59]>; 115def F28 : Rf<28, "F28">, DwarfRegNum<[60]>; 116def F29 : Rf<29, "F29">, DwarfRegNum<[61]>; 117def F30 : Rf<30, "F30">, DwarfRegNum<[62]>; 118def F31 : Rf<31, "F31">, DwarfRegNum<[63]>; 119 120// Aliases of the F* registers used to hold 64-bit fp values (doubles) 121def D0 : Rd< 0, "F0", [F0, F1]>, DwarfRegNum<[72]>; 122def D1 : Rd< 2, "F2", [F2, F3]>, DwarfRegNum<[73]>; 123def D2 : Rd< 4, "F4", [F4, F5]>, DwarfRegNum<[74]>; 124def D3 : Rd< 6, "F6", [F6, F7]>, DwarfRegNum<[75]>; 125def D4 : Rd< 8, "F8", [F8, F9]>, DwarfRegNum<[76]>; 126def D5 : Rd<10, "F10", [F10, F11]>, DwarfRegNum<[77]>; 127def D6 : Rd<12, "F12", [F12, F13]>, DwarfRegNum<[78]>; 128def D7 : Rd<14, "F14", [F14, F15]>, DwarfRegNum<[79]>; 129def D8 : Rd<16, "F16", [F16, F17]>, DwarfRegNum<[80]>; 130def D9 : Rd<18, "F18", [F18, F19]>, DwarfRegNum<[81]>; 131def D10 : Rd<20, "F20", [F20, F21]>, DwarfRegNum<[82]>; 132def D11 : Rd<22, "F22", [F22, F23]>, DwarfRegNum<[83]>; 133def D12 : Rd<24, "F24", [F24, F25]>, DwarfRegNum<[84]>; 134def D13 : Rd<26, "F26", [F26, F27]>, DwarfRegNum<[85]>; 135def D14 : Rd<28, "F28", [F28, F29]>, DwarfRegNum<[86]>; 136def D15 : Rd<30, "F30", [F30, F31]>, DwarfRegNum<[87]>; 137 138// Register classes. 139// 140// FIXME: the register order should be defined in terms of the preferred 141// allocation order... 142// 143def IntRegs : RegisterClass<"SP", [i32], 32, 144 (add L0, L1, L2, L3, L4, L5, L6, 145 L7, I0, I1, I2, I3, I4, I5, 146 O0, O1, O2, O3, O4, O5, O7, 147 G1, 148 // Non-allocatable regs: 149 G2, G3, G4, // FIXME: OK for use only in 150 // applications, not libraries. 151 O6, // stack ptr 152 I6, // frame ptr 153 I7, // return address 154 G0, // constant zero 155 G5, G6, G7 // reserved for kernel 156 )>; 157 158def FPRegs : RegisterClass<"SP", [f32], 32, (sequence "F%u", 0, 31)>; 159 160def DFPRegs : RegisterClass<"SP", [f64], 64, (sequence "D%u", 0, 15)>; 161