1//===-- PPCRegisterInfo.td - The PowerPC Register File -----*- tablegen -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8// 9// 10//===----------------------------------------------------------------------===// 11 12let Namespace = "PPC" in { 13def sub_lt : SubRegIndex<1>; 14def sub_gt : SubRegIndex<1, 1>; 15def sub_eq : SubRegIndex<1, 2>; 16def sub_un : SubRegIndex<1, 3>; 17def sub_32 : SubRegIndex<32>; 18def sub_32_hi_phony : SubRegIndex<32,32>; 19def sub_64 : SubRegIndex<64>; 20def sub_64_hi_phony : SubRegIndex<64,64>; 21def sub_vsx0 : SubRegIndex<128>; 22def sub_vsx1 : SubRegIndex<128, 128>; 23def sub_gp8_x0 : SubRegIndex<64>; 24def sub_gp8_x1 : SubRegIndex<64, 64>; 25def sub_fp0 : SubRegIndex<64>; 26def sub_fp1 : SubRegIndex<64, 64>; 27} 28 29 30class PPCReg<string n> : Register<n> { 31 let Namespace = "PPC"; 32} 33 34// We identify all our registers with a 5-bit ID, for consistency's sake. 35 36// GPR - One of the 32 32-bit general-purpose registers 37class GPR<bits<5> num, string n> : PPCReg<n> { 38 let HWEncoding{4-0} = num; 39} 40 41// GP8 - One of the 32 64-bit general-purpose registers 42class GP8<GPR SubReg, string n> : PPCReg<n> { 43 let HWEncoding = SubReg.HWEncoding; 44 let SubRegs = [SubReg]; 45 let SubRegIndices = [sub_32]; 46} 47 48class SPE<string n, bits<5> Enc, list<Register> subregs = []> : PPCReg<n> { 49 let HWEncoding{4-0} = Enc; 50 let SubRegs = subregs; 51 let SubRegIndices = [sub_32, sub_32_hi_phony]; 52 let CoveredBySubRegs = 1; 53} 54// SPR - One of the 32-bit special-purpose registers 55class SPR<bits<10> num, string n> : PPCReg<n> { 56 let HWEncoding{9-0} = num; 57} 58 59// FPR - One of the 32 64-bit floating-point registers 60class FPR<bits<5> num, string n> : PPCReg<n> { 61 let HWEncoding{4-0} = num; 62} 63 64// FPPair - A pair of 64-bit floating-point registers. 65class FPPair<string n, bits<5> EvenIndex> : PPCReg<n> { 66 assert !eq(EvenIndex{0}, 0), "Index should be even."; 67 let HWEncoding{4-0} = EvenIndex; 68 let SubRegs = [!cast<FPR>("F"#EvenIndex), !cast<FPR>("F"#!add(EvenIndex, 1))]; 69 let DwarfNumbers = [-1, -1]; 70 let SubRegIndices = [sub_fp0, sub_fp1]; 71} 72 73// VF - One of the 32 64-bit floating-point subregisters of the vector 74// registers (used by VSX). 75class VF<bits<5> num, string n> : PPCReg<n> { 76 let HWEncoding{4-0} = num; 77 let HWEncoding{5} = 1; 78} 79 80// VR - One of the 32 128-bit vector registers 81class VR<VF SubReg, VF SubRegH, string n> : PPCReg<n> { 82 let HWEncoding{4-0} = SubReg.HWEncoding{4-0}; 83 let HWEncoding{5} = 0; 84 let SubRegs = [SubReg, SubRegH]; 85 let SubRegIndices = [sub_64, sub_64_hi_phony]; 86} 87 88// VSRL - One of the 32 128-bit VSX registers that overlap with the scalar 89// floating-point registers. 90class VSRL<FPR SubReg, FPR SubRegH, string n> : PPCReg<n> { 91 let HWEncoding = SubReg.HWEncoding; 92 let SubRegs = [SubReg, SubRegH]; 93 let SubRegIndices = [sub_64, sub_64_hi_phony]; 94} 95 96// VSXReg - One of the VSX registers in the range vs32-vs63 with numbering 97// and encoding to match. 98class VSXReg<bits<6> num, string n> : PPCReg<n> { 99 let HWEncoding{5-0} = num; 100} 101 102// CR - One of the 8 4-bit condition registers 103class CR<bits<3> num, string n, list<Register> subregs> : PPCReg<n> { 104 let HWEncoding{2-0} = num; 105 let SubRegs = subregs; 106} 107 108// CRBIT - One of the 32 1-bit condition register fields 109class CRBIT<bits<5> num, string n> : PPCReg<n> { 110 let HWEncoding{4-0} = num; 111} 112 113// VSR Pairs - One of the 32 paired even-odd consecutive VSRs. 114class VSRPair<bits<5> num, string n, list<Register> subregs> : PPCReg<n> { 115 let HWEncoding{4-0} = num; 116 let SubRegs = subregs; 117} 118 119// GP8Pair - Consecutive even-odd paired GP8. 120class GP8Pair<string n, bits<5> EvenIndex> : PPCReg<n> { 121 assert !eq(EvenIndex{0}, 0), "Index should be even."; 122 let HWEncoding{4-0} = EvenIndex; 123 let SubRegs = [!cast<GP8>("X"#EvenIndex), !cast<GP8>("X"#!add(EvenIndex, 1))]; 124 let DwarfNumbers = [-1, -1]; 125 let SubRegIndices = [sub_gp8_x0, sub_gp8_x1]; 126} 127 128// General-purpose registers 129foreach Index = 0-31 in { 130 def R#Index : GPR<Index, "r"#Index>, DwarfRegNum<[-2, Index]>; 131} 132 133let isArtificial = 1 in { 134 foreach Index = 0-31 in { 135 def H#Index : GPR<-1,"">; 136 } 137} 138 139// 64-bit General-purpose registers 140foreach Index = 0-31 in { 141 def X#Index : GP8<!cast<GPR>("R"#Index), "r"#Index>, 142 DwarfRegNum<[Index, -2]>; 143} 144 145// SPE registers 146foreach Index = 0-31 in { 147 def S#Index : SPE<"r"#Index, Index, [!cast<GPR>("R"#Index), !cast<GPR>("H"#Index)]>, 148 DwarfRegNum<[!add(Index, 1200), !add(Index, 1200)]>; 149 150} 151 152 153// Floating-point registers 154foreach Index = 0-31 in { 155 def F#Index : FPR<Index, "f"#Index>, 156 DwarfRegNum<[!add(Index, 32), !add(Index, 32)]>; 157} 158 159// The FH and VFH registers have been marked as Artifical because there are no 160// instructions on PowerPC that use those register classes. They only exist 161// in order to ensure that the super registers (V and VSL) are covered by their 162// subregisters and have correct subregister lane masks. 163let isArtificial = 1 in { 164 foreach Index = 0-31 in { 165 def FH#Index : FPR<-1, "">; 166 def VFH#Index : VF<-1, "">; 167 } 168} 169 170let isAllocatable = 0, CopyCost = -1 in { 171 def VFHRC : RegisterClass<"PPC", [f64], 64, (sequence "VFH%u", 0, 31)>; 172 def FHRC : RegisterClass<"PPC", [f64], 64, (sequence "FH%u", 0, 31)>; 173} 174 175// Floating-point pair registers 176foreach Index = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 } in { 177 def Fpair#Index : FPPair<"fp"#Index, Index>; 178} 179 180// 64-bit Floating-point subregisters of Altivec registers 181// Note: the register names are v0-v31 or vs32-vs63 depending on the use. 182// Custom C++ code is used to produce the correct name and encoding. 183foreach Index = 0-31 in { 184 def VF#Index : VF<Index, "v" #Index>, 185 DwarfRegNum<[!add(Index, 77), !add(Index, 77)]>; 186} 187 188let CoveredBySubRegs = 1 in { 189// Vector registers 190foreach Index = 0-31 in { 191 def V#Index : VR<!cast<VF>("VF"#Index), !cast<VF>("VFH"#Index), "v"#Index>, 192 DwarfRegNum<[!add(Index, 77), !add(Index, 77)]>; 193} 194 195// VSX registers 196foreach Index = 0-31 in { 197 def VSL#Index : VSRL<!cast<FPR>("F"#Index), !cast<FPR>("FH"#Index), "vs"#Index>, 198 DwarfRegAlias<!cast<FPR>("F"#Index)>; 199} 200} 201 202// Dummy VSX registers, this defines string: "vs32"-"vs63", and is only used for 203// asm printing. 204foreach Index = 32-63 in { 205 def VSX#Index : VSXReg<Index, "vs"#Index>; 206} 207 208let SubRegIndices = [sub_vsx0, sub_vsx1] in { 209 // VSR pairs 0 - 15 (corresponding to VSRs 0 - 30 paired with 1 - 31). 210 foreach Index = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 } in { 211 def VSRp#!srl(Index, 1) : VSRPair<!srl(Index, 1), "vsp"#Index, 212 [!cast<VSRL>("VSL"#Index), !cast<VSRL>("VSL"#!add(Index, 1))]>, 213 DwarfRegNum<[-1, -1]>; 214 } 215 216 // VSR pairs 16 - 31 (corresponding to VSRs 32 - 62 paired with 33 - 63). 217 foreach Index = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 } in { 218 def VSRp#!add(!srl(Index, 1), 16) : 219 VSRPair<!add(!srl(Index, 1), 16), "vsp"#!add(Index, 32), 220 [!cast<VR>("V"#Index), !cast<VR>("V"#!add(Index, 1))]>, 221 DwarfRegAlias<!cast<VR>("V"#Index)>; 222 } 223} 224 225// 16 paired even-odd consecutive GP8s. 226foreach Index = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 } in { 227 def G8p#!srl(Index, 1) : GP8Pair<"r"#Index, Index>; 228} 229 230// The representation of r0 when treated as the constant 0. 231let isConstant = true in { 232def ZERO : GPR<0, "0">, DwarfRegAlias<R0>; 233def ZERO8 : GP8<ZERO, "0">, DwarfRegAlias<X0>; 234} // isConstant = true 235 236// Representations of the frame pointer used by ISD::FRAMEADDR. 237def FP : GPR<0 /* arbitrary */, "**FRAME POINTER**">; 238def FP8 : GP8<FP, "**FRAME POINTER**">; 239 240// Representations of the base pointer used by setjmp. 241def BP : GPR<0 /* arbitrary */, "**BASE POINTER**">; 242def BP8 : GP8<BP, "**BASE POINTER**">; 243 244// Condition register bits 245def CR0LT : CRBIT< 0, "0">; 246def CR0GT : CRBIT< 1, "1">; 247def CR0EQ : CRBIT< 2, "2">; 248def CR0UN : CRBIT< 3, "3">; 249def CR1LT : CRBIT< 4, "4">; 250def CR1GT : CRBIT< 5, "5">; 251def CR1EQ : CRBIT< 6, "6">; 252def CR1UN : CRBIT< 7, "7">; 253def CR2LT : CRBIT< 8, "8">; 254def CR2GT : CRBIT< 9, "9">; 255def CR2EQ : CRBIT<10, "10">; 256def CR2UN : CRBIT<11, "11">; 257def CR3LT : CRBIT<12, "12">; 258def CR3GT : CRBIT<13, "13">; 259def CR3EQ : CRBIT<14, "14">; 260def CR3UN : CRBIT<15, "15">; 261def CR4LT : CRBIT<16, "16">; 262def CR4GT : CRBIT<17, "17">; 263def CR4EQ : CRBIT<18, "18">; 264def CR4UN : CRBIT<19, "19">; 265def CR5LT : CRBIT<20, "20">; 266def CR5GT : CRBIT<21, "21">; 267def CR5EQ : CRBIT<22, "22">; 268def CR5UN : CRBIT<23, "23">; 269def CR6LT : CRBIT<24, "24">; 270def CR6GT : CRBIT<25, "25">; 271def CR6EQ : CRBIT<26, "26">; 272def CR6UN : CRBIT<27, "27">; 273def CR7LT : CRBIT<28, "28">; 274def CR7GT : CRBIT<29, "29">; 275def CR7EQ : CRBIT<30, "30">; 276def CR7UN : CRBIT<31, "31">; 277 278// Condition registers 279let SubRegIndices = [sub_lt, sub_gt, sub_eq, sub_un] in { 280def CR0 : CR<0, "cr0", [CR0LT, CR0GT, CR0EQ, CR0UN]>, DwarfRegNum<[68, 68]>; 281def CR1 : CR<1, "cr1", [CR1LT, CR1GT, CR1EQ, CR1UN]>, DwarfRegNum<[69, 69]>; 282def CR2 : CR<2, "cr2", [CR2LT, CR2GT, CR2EQ, CR2UN]>, DwarfRegNum<[70, 70]>; 283def CR3 : CR<3, "cr3", [CR3LT, CR3GT, CR3EQ, CR3UN]>, DwarfRegNum<[71, 71]>; 284def CR4 : CR<4, "cr4", [CR4LT, CR4GT, CR4EQ, CR4UN]>, DwarfRegNum<[72, 72]>; 285def CR5 : CR<5, "cr5", [CR5LT, CR5GT, CR5EQ, CR5UN]>, DwarfRegNum<[73, 73]>; 286def CR6 : CR<6, "cr6", [CR6LT, CR6GT, CR6EQ, CR6UN]>, DwarfRegNum<[74, 74]>; 287def CR7 : CR<7, "cr7", [CR7LT, CR7GT, CR7EQ, CR7UN]>, DwarfRegNum<[75, 75]>; 288} 289 290// Link register 291def LR : SPR<8, "lr">, DwarfRegNum<[-2, 65]>; 292def LR8 : SPR<8, "lr">, DwarfRegNum<[65, -2]> { 293 let Aliases = [LR]; 294} 295 296// Count register 297def CTR : SPR<9, "ctr">, DwarfRegNum<[-2, 66]>; 298def CTR8 : SPR<9, "ctr">, DwarfRegNum<[66, -2]> { 299 let Aliases = [CTR]; 300} 301 302// VRsave register 303def VRSAVE: SPR<256, "vrsave">, DwarfRegNum<[109]>; 304 305// SPE extra registers 306def SPEFSCR: SPR<512, "spefscr">, DwarfRegNum<[612, 112]>; 307 308def XER: SPR<1, "xer">, DwarfRegNum<[76]>; 309 310// Carry bit. In the architecture this is really bit 0 of the XER register 311// (which really is SPR register 1); this is the only bit interesting to a 312// compiler. 313def CARRY: SPR<1, "xer">, DwarfRegNum<[76]> { 314 let Aliases = [XER]; 315} 316 317// FP rounding mode: bits 30 and 31 of the FP status and control register 318// This is not allocated as a normal register; it appears only in 319// Uses and Defs. The ABI says it needs to be preserved by a function, 320// but this is not achieved by saving and restoring it as with 321// most registers, it has to be done in code; to make this work all the 322// return and call instructions are described as Uses of RM, so instructions 323// that do nothing but change RM will not get deleted. 324def RM: PPCReg<"**ROUNDING MODE**">; 325 326let isAllocatable = 0 in 327def GPRC32 : RegisterClass<"PPC", [i32,f32], 32, (add (sequence "H%u", 2, 12), 328 (sequence "H%u", 30, 13), 329 H31, H0, H1)>; 330 331/// Register classes 332// Allocate volatiles first 333// then nonvolatiles in reverse order since stmw/lmw save from rN to r31 334def GPRC : RegisterClass<"PPC", [i32,f32], 32, (add (sequence "R%u", 2, 12), 335 (sequence "R%u", 30, 13), 336 R31, R0, R1, FP, BP)> { 337 // On non-Darwin PPC64 systems, R2 can be allocated, but must be restored, so 338 // put it at the end of the list. 339 // On AIX, CSRs are allocated starting from R31 according to: 340 // https://www.ibm.com/docs/en/ssw_aix_72/assembler/assembler_pdf.pdf. 341 // This also helps setting the correct `NumOfGPRsSaved' in traceback table. 342 let AltOrders = [(add (sub GPRC, R2), R2), 343 (add (sequence "R%u", 2, 12), 344 (sequence "R%u", 31, 13), R0, R1, FP, BP)]; 345 let AltOrderSelect = [{ 346 return MF.getSubtarget<PPCSubtarget>().getGPRAllocationOrderIdx(); 347 }]; 348} 349 350def G8RC : RegisterClass<"PPC", [i64], 64, (add (sequence "X%u", 2, 12), 351 (sequence "X%u", 30, 14), 352 X31, X13, X0, X1, FP8, BP8)> { 353 // On non-Darwin PPC64 systems, R2 can be allocated, but must be restored, so 354 // put it at the end of the list. 355 let AltOrders = [(add (sub G8RC, X2), X2), 356 (add (sequence "X%u", 2, 12), 357 (sequence "X%u", 31, 13), X0, X1, FP8, BP8)]; 358 let AltOrderSelect = [{ 359 return MF.getSubtarget<PPCSubtarget>().getGPRAllocationOrderIdx(); 360 }]; 361} 362 363// For some instructions r0 is special (representing the value 0 instead of 364// the value in the r0 register), and we use these register subclasses to 365// prevent r0 from being allocated for use by those instructions. 366def GPRC_NOR0 : RegisterClass<"PPC", [i32,f32], 32, (add (sub GPRC, R0), ZERO)> { 367 // On non-Darwin PPC64 systems, R2 can be allocated, but must be restored, so 368 // put it at the end of the list. 369 let AltOrders = [(add (sub GPRC_NOR0, R2), R2), 370 (add (sequence "R%u", 2, 12), 371 (sequence "R%u", 31, 13), R1, FP, BP, ZERO)]; 372 let AltOrderSelect = [{ 373 return MF.getSubtarget<PPCSubtarget>().getGPRAllocationOrderIdx(); 374 }]; 375} 376 377def G8RC_NOX0 : RegisterClass<"PPC", [i64], 64, (add (sub G8RC, X0), ZERO8)> { 378 // On non-Darwin PPC64 systems, R2 can be allocated, but must be restored, so 379 // put it at the end of the list. 380 let AltOrders = [(add (sub G8RC_NOX0, X2), X2), 381 (add (sequence "X%u", 2, 12), 382 (sequence "X%u", 31, 13), X1, FP8, BP8, ZERO8)]; 383 let AltOrderSelect = [{ 384 return MF.getSubtarget<PPCSubtarget>().getGPRAllocationOrderIdx(); 385 }]; 386} 387 388def SPERC : RegisterClass<"PPC", [f64], 64, (add (sequence "S%u", 2, 12), 389 (sequence "S%u", 30, 13), 390 S31, S0, S1)>; 391 392// Allocate volatiles first, then non-volatiles in reverse order. With the SVR4 393// ABI the size of the Floating-point register save area is determined by the 394// allocated non-volatile register with the lowest register number, as FP 395// register N is spilled to offset 8 * (32 - N) below the back chain word of the 396// previous stack frame. By allocating non-volatiles in reverse order we make 397// sure that the Floating-point register save area is always as small as 398// possible because there aren't any unused spill slots. 399def F8RC : RegisterClass<"PPC", [f64], 64, (add (sequence "F%u", 0, 13), 400 (sequence "F%u", 31, 14))>; 401def F4RC : RegisterClass<"PPC", [f32], 32, (add F8RC)>; 402 403// Floating point pair registers. 404// Note that the type used for this register class is ppcf128. This is not 405// completely correct. However, since we are not pattern matching any 406// instructions for these registers and we are not register allocating or 407// scheduling any of these instructions it should be safe to do this. 408// The reason we didn't use the correct type (Decimal Floating Point) is that 409// at the time of this implementation the correct type was not available. 410def FpRC : 411 RegisterClass<"PPC", [ppcf128], 128, 412 (add Fpair0, Fpair2, Fpair4, Fpair6, Fpair8, Fpair10, Fpair12, 413 Fpair14, Fpair16, Fpair18, Fpair20, Fpair22, Fpair24, 414 Fpair26, Fpair28, Fpair30)> { 415 let Size = 128; 416} 417 418def VRRC : RegisterClass<"PPC", 419 [v16i8,v8i16,v4i32,v2i64,v1i128,v4f32,v2f64, f128], 420 128, 421 (add V2, V3, V4, V5, V0, V1, V6, V7, V8, V9, V10, V11, 422 V12, V13, V14, V15, V16, V17, V18, V19, V31, V30, 423 V29, V28, V27, V26, V25, V24, V23, V22, V21, V20)>; 424 425// VSX register classes (the allocation order mirrors that of the corresponding 426// subregister classes). 427def VSLRC : RegisterClass<"PPC", [v4i32,v4f32,v2f64,v2i64], 128, 428 (add (sequence "VSL%u", 0, 13), 429 (sequence "VSL%u", 31, 14))>; 430def VSRC : RegisterClass<"PPC", [v4i32,v4f32,v2f64,v2i64], 128, 431 (add VSLRC, VRRC)>; 432 433// Register classes for the 64-bit "scalar" VSX subregisters. 434def VFRC : RegisterClass<"PPC", [f64], 64, 435 (add VF2, VF3, VF4, VF5, VF0, VF1, VF6, VF7, 436 VF8, VF9, VF10, VF11, VF12, VF13, VF14, 437 VF15, VF16, VF17, VF18, VF19, VF31, VF30, 438 VF29, VF28, VF27, VF26, VF25, VF24, VF23, 439 VF22, VF21, VF20)>; 440def VSFRC : RegisterClass<"PPC", [f64], 64, (add F8RC, VFRC)>; 441 442// Allow spilling GPR's into caller-saved VSR's. 443def SPILLTOVSRRC : RegisterClass<"PPC", [i64, f64], 64, (add G8RC, (sub VSFRC, 444 (sequence "VF%u", 31, 20), 445 (sequence "F%u", 31, 14)))>; 446 447// Register class for single precision scalars in VSX registers 448def VSSRC : RegisterClass<"PPC", [f32], 32, (add VSFRC)>; 449 450def CRBITRC : RegisterClass<"PPC", [i1], 32, 451 (add CR2LT, CR2GT, CR2EQ, CR2UN, 452 CR3LT, CR3GT, CR3EQ, CR3UN, 453 CR4LT, CR4GT, CR4EQ, CR4UN, 454 CR5LT, CR5GT, CR5EQ, CR5UN, 455 CR6LT, CR6GT, CR6EQ, CR6UN, 456 CR7LT, CR7GT, CR7EQ, CR7UN, 457 CR1LT, CR1GT, CR1EQ, CR1UN, 458 CR0LT, CR0GT, CR0EQ, CR0UN)> { 459 let Size = 32; 460 let AltOrders = [(sub CRBITRC, CR2LT, CR2GT, CR2EQ, CR2UN, CR3LT, CR3GT, 461 CR3EQ, CR3UN, CR4LT, CR4GT, CR4EQ, CR4UN)]; 462 let AltOrderSelect = [{ 463 return MF.getSubtarget<PPCSubtarget>().isELFv2ABI() && 464 MF.getInfo<PPCFunctionInfo>()->isNonVolatileCRDisabled(); 465 }]; 466} 467 468def CRRC : RegisterClass<"PPC", [i32], 32, 469 (add CR0, CR1, CR5, CR6, 470 CR7, CR2, CR3, CR4)> { 471 let AltOrders = [(sub CRRC, CR2, CR3, CR4)]; 472 let AltOrderSelect = [{ 473 return MF.getSubtarget<PPCSubtarget>().isELFv2ABI() && 474 MF.getInfo<PPCFunctionInfo>()->isNonVolatileCRDisabled(); 475 }]; 476} 477// The CTR registers are not allocatable because they're used by the 478// decrement-and-branch instructions, and thus need to stay live across 479// multiple basic blocks. 480def CTRRC : RegisterClass<"PPC", [i32], 32, (add CTR)> { 481 let isAllocatable = 0; 482} 483def CTRRC8 : RegisterClass<"PPC", [i64], 64, (add CTR8)> { 484 let isAllocatable = 0; 485} 486 487def LRRC : RegisterClass<"PPC", [i32], 32, (add LR)> { 488 let isAllocatable = 0; 489} 490def LR8RC : RegisterClass<"PPC", [i64], 64, (add LR8)> { 491 let isAllocatable = 0; 492} 493 494def VRSAVERC : RegisterClass<"PPC", [i32], 32, (add VRSAVE)>; 495def CARRYRC : RegisterClass<"PPC", [i32], 32, (add CARRY, XER)> { 496 let CopyCost = -1; 497} 498 499// Make AllocationOrder as similar as G8RC's to avoid potential spilling. 500// Similarly, we have an AltOrder for 64-bit ELF ABI which r2 is allocated 501// at last. 502def G8pRC : 503 RegisterClass<"PPC", [i128], 128, 504 (add (sequence "G8p%u", 1, 5), 505 (sequence "G8p%u", 14, 7), 506 G8p15, G8p6, G8p0)> { 507 let AltOrders = [(add (sub G8pRC, G8p1), G8p1)]; 508 let AltOrderSelect = [{ 509 return MF.getSubtarget<PPCSubtarget>().is64BitELFABI(); 510 }]; 511 let Size = 128; 512} 513 514include "PPCRegisterInfoMMA.td" 515include "PPCRegisterInfoDMR.td" 516 517//===----------------------------------------------------------------------===// 518// PowerPC Operand Definitions. 519 520// In the default PowerPC assembler syntax, registers are specified simply 521// by number, so they cannot be distinguished from immediate values (without 522// looking at the opcode). This means that the default operand matching logic 523// for the asm parser does not work, and we need to specify custom matchers. 524// Since those can only be specified with RegisterOperand classes and not 525// directly on the RegisterClass, all instructions patterns used by the asm 526// parser need to use a RegisterOperand (instead of a RegisterClass) for 527// all their register operands. 528// For this purpose, we define one RegisterOperand for each RegisterClass, 529// using the same name as the class, just in lower case. 530 531def PPCRegGPRCAsmOperand : AsmOperandClass { 532 let Name = "RegGPRC"; let PredicateMethod = "isRegNumber"; 533} 534def gprc : RegisterOperand<GPRC> { 535 let ParserMatchClass = PPCRegGPRCAsmOperand; 536} 537def PPCRegG8RCAsmOperand : AsmOperandClass { 538 let Name = "RegG8RC"; let PredicateMethod = "isRegNumber"; 539} 540def g8rc : RegisterOperand<G8RC> { 541 let ParserMatchClass = PPCRegG8RCAsmOperand; 542} 543def PPCRegG8pRCAsmOperand : AsmOperandClass { 544 let Name = "RegG8pRC"; let PredicateMethod = "isEvenRegNumber"; 545} 546def g8prc : RegisterOperand<G8pRC> { 547 let ParserMatchClass = PPCRegG8pRCAsmOperand; 548} 549def PPCRegGPRCNoR0AsmOperand : AsmOperandClass { 550 let Name = "RegGPRCNoR0"; let PredicateMethod = "isRegNumber"; 551} 552def gprc_nor0 : RegisterOperand<GPRC_NOR0> { 553 let ParserMatchClass = PPCRegGPRCNoR0AsmOperand; 554} 555def PPCRegG8RCNoX0AsmOperand : AsmOperandClass { 556 let Name = "RegG8RCNoX0"; let PredicateMethod = "isRegNumber"; 557} 558def g8rc_nox0 : RegisterOperand<G8RC_NOX0> { 559 let ParserMatchClass = PPCRegG8RCNoX0AsmOperand; 560} 561def PPCRegF8RCAsmOperand : AsmOperandClass { 562 let Name = "RegF8RC"; let PredicateMethod = "isRegNumber"; 563} 564def f8rc : RegisterOperand<F8RC> { 565 let ParserMatchClass = PPCRegF8RCAsmOperand; 566} 567def PPCRegF4RCAsmOperand : AsmOperandClass { 568 let Name = "RegF4RC"; let PredicateMethod = "isRegNumber"; 569} 570def f4rc : RegisterOperand<F4RC> { 571 let ParserMatchClass = PPCRegF4RCAsmOperand; 572} 573def PPCRegFpRCAsmOperand : AsmOperandClass { 574 let Name = "RegFpRC"; let PredicateMethod = "isEvenRegNumber"; 575} 576def fpairrc : RegisterOperand<FpRC> { 577 let ParserMatchClass = PPCRegFpRCAsmOperand; 578} 579def PPCRegVRRCAsmOperand : AsmOperandClass { 580 let Name = "RegVRRC"; let PredicateMethod = "isRegNumber"; 581} 582def vrrc : RegisterOperand<VRRC> { 583 let ParserMatchClass = PPCRegVRRCAsmOperand; 584} 585def PPCRegVFRCAsmOperand : AsmOperandClass { 586 let Name = "RegVFRC"; let PredicateMethod = "isRegNumber"; 587} 588def vfrc : RegisterOperand<VFRC> { 589 let ParserMatchClass = PPCRegVFRCAsmOperand; 590} 591def PPCRegCRBITRCAsmOperand : AsmOperandClass { 592 let Name = "RegCRBITRC"; let PredicateMethod = "isCRBitNumber"; 593} 594def crbitrc : RegisterOperand<CRBITRC> { 595 let ParserMatchClass = PPCRegCRBITRCAsmOperand; 596} 597def PPCRegCRRCAsmOperand : AsmOperandClass { 598 let Name = "RegCRRC"; let PredicateMethod = "isCCRegNumber"; 599} 600def crrc : RegisterOperand<CRRC> { 601 let ParserMatchClass = PPCRegCRRCAsmOperand; 602} 603def PPCRegSPERCAsmOperand : AsmOperandClass { 604 let Name = "RegSPERC"; let PredicateMethod = "isRegNumber"; 605} 606def sperc : RegisterOperand<SPERC> { 607 let ParserMatchClass = PPCRegSPERCAsmOperand; 608} 609def PPCRegSPE4RCAsmOperand : AsmOperandClass { 610 let Name = "RegSPE4RC"; let PredicateMethod = "isRegNumber"; 611} 612def spe4rc : RegisterOperand<GPRC> { 613 let ParserMatchClass = PPCRegSPE4RCAsmOperand; 614} 615 616def PPCU1ImmAsmOperand : AsmOperandClass { 617 let Name = "U1Imm"; let PredicateMethod = "isU1Imm"; 618 let RenderMethod = "addImmOperands"; 619} 620def u1imm : Operand<i32> { 621 let PrintMethod = "printU1ImmOperand"; 622 let ParserMatchClass = PPCU1ImmAsmOperand; 623 let DecoderMethod = "decodeUImmOperand<1>"; 624 let OperandType = "OPERAND_IMMEDIATE"; 625} 626 627def PPCU2ImmAsmOperand : AsmOperandClass { 628 let Name = "U2Imm"; let PredicateMethod = "isU2Imm"; 629 let RenderMethod = "addImmOperands"; 630} 631def u2imm : Operand<i32> { 632 let PrintMethod = "printU2ImmOperand"; 633 let ParserMatchClass = PPCU2ImmAsmOperand; 634 let DecoderMethod = "decodeUImmOperand<2>"; 635 let OperandType = "OPERAND_IMMEDIATE"; 636} 637 638def PPCATBitsAsHintAsmOperand : AsmOperandClass { 639 let Name = "ATBitsAsHint"; let PredicateMethod = "isATBitsAsHint"; 640 let RenderMethod = "addImmOperands"; // Irrelevant, predicate always fails. 641} 642def atimm : Operand<i32> { 643 let PrintMethod = "printATBitsAsHint"; 644 let ParserMatchClass = PPCATBitsAsHintAsmOperand; 645 let OperandType = "OPERAND_IMMEDIATE"; 646} 647 648def PPCU3ImmAsmOperand : AsmOperandClass { 649 let Name = "U3Imm"; let PredicateMethod = "isU3Imm"; 650 let RenderMethod = "addImmOperands"; 651} 652def u3imm : Operand<i32> { 653 let PrintMethod = "printU3ImmOperand"; 654 let ParserMatchClass = PPCU3ImmAsmOperand; 655 let DecoderMethod = "decodeUImmOperand<3>"; 656 let OperandType = "OPERAND_IMMEDIATE"; 657} 658 659def PPCU4ImmAsmOperand : AsmOperandClass { 660 let Name = "U4Imm"; let PredicateMethod = "isU4Imm"; 661 let RenderMethod = "addImmOperands"; 662} 663def u4imm : Operand<i32> { 664 let PrintMethod = "printU4ImmOperand"; 665 let ParserMatchClass = PPCU4ImmAsmOperand; 666 let DecoderMethod = "decodeUImmOperand<4>"; 667 let OperandType = "OPERAND_IMMEDIATE"; 668} 669def PPCS5ImmAsmOperand : AsmOperandClass { 670 let Name = "S5Imm"; let PredicateMethod = "isS5Imm"; 671 let RenderMethod = "addImmOperands"; 672} 673def s5imm : Operand<i32> { 674 let PrintMethod = "printS5ImmOperand"; 675 let ParserMatchClass = PPCS5ImmAsmOperand; 676 let DecoderMethod = "decodeSImmOperand<5>"; 677 let OperandType = "OPERAND_IMMEDIATE"; 678} 679def PPCU5ImmAsmOperand : AsmOperandClass { 680 let Name = "U5Imm"; let PredicateMethod = "isU5Imm"; 681 let RenderMethod = "addImmOperands"; 682} 683def u5imm : Operand<i32> { 684 let PrintMethod = "printU5ImmOperand"; 685 let ParserMatchClass = PPCU5ImmAsmOperand; 686 let DecoderMethod = "decodeUImmOperand<5>"; 687 let OperandType = "OPERAND_IMMEDIATE"; 688} 689def PPCU6ImmAsmOperand : AsmOperandClass { 690 let Name = "U6Imm"; let PredicateMethod = "isU6Imm"; 691 let RenderMethod = "addImmOperands"; 692} 693def u6imm : Operand<i32> { 694 let PrintMethod = "printU6ImmOperand"; 695 let ParserMatchClass = PPCU6ImmAsmOperand; 696 let DecoderMethod = "decodeUImmOperand<6>"; 697 let OperandType = "OPERAND_IMMEDIATE"; 698} 699def PPCU7ImmAsmOperand : AsmOperandClass { 700 let Name = "U7Imm"; let PredicateMethod = "isU7Imm"; 701 let RenderMethod = "addImmOperands"; 702} 703def u7imm : Operand<i32> { 704 let PrintMethod = "printU7ImmOperand"; 705 let ParserMatchClass = PPCU7ImmAsmOperand; 706 let DecoderMethod = "decodeUImmOperand<7>"; 707 let OperandType = "OPERAND_IMMEDIATE"; 708} 709def PPCU8ImmAsmOperand : AsmOperandClass { 710 let Name = "U8Imm"; let PredicateMethod = "isU8Imm"; 711 let RenderMethod = "addImmOperands"; 712} 713def u8imm : Operand<i32> { 714 let PrintMethod = "printU8ImmOperand"; 715 let ParserMatchClass = PPCU8ImmAsmOperand; 716 let DecoderMethod = "decodeUImmOperand<8>"; 717 let OperandType = "OPERAND_IMMEDIATE"; 718} 719def PPCU10ImmAsmOperand : AsmOperandClass { 720 let Name = "U10Imm"; let PredicateMethod = "isU10Imm"; 721 let RenderMethod = "addImmOperands"; 722} 723def u10imm : Operand<i32> { 724 let PrintMethod = "printU10ImmOperand"; 725 let ParserMatchClass = PPCU10ImmAsmOperand; 726 let DecoderMethod = "decodeUImmOperand<10>"; 727 let OperandType = "OPERAND_IMMEDIATE"; 728} 729def PPCU12ImmAsmOperand : AsmOperandClass { 730 let Name = "U12Imm"; let PredicateMethod = "isU12Imm"; 731 let RenderMethod = "addImmOperands"; 732} 733def u12imm : Operand<i32> { 734 let PrintMethod = "printU12ImmOperand"; 735 let ParserMatchClass = PPCU12ImmAsmOperand; 736 let DecoderMethod = "decodeUImmOperand<12>"; 737 let OperandType = "OPERAND_IMMEDIATE"; 738} 739def PPCS16ImmAsmOperand : AsmOperandClass { 740 let Name = "S16Imm"; let PredicateMethod = "isS16Imm"; 741 let RenderMethod = "addS16ImmOperands"; 742} 743def s16imm : Operand<i32> { 744 let PrintMethod = "printS16ImmOperand"; 745 let EncoderMethod = "getImm16Encoding"; 746 let ParserMatchClass = PPCS16ImmAsmOperand; 747 let DecoderMethod = "decodeSImmOperand<16>"; 748 let OperandType = "OPERAND_IMMEDIATE"; 749} 750def PPCU16ImmAsmOperand : AsmOperandClass { 751 let Name = "U16Imm"; let PredicateMethod = "isU16Imm"; 752 let RenderMethod = "addU16ImmOperands"; 753} 754def u16imm : Operand<i32> { 755 let PrintMethod = "printU16ImmOperand"; 756 let EncoderMethod = "getImm16Encoding"; 757 let ParserMatchClass = PPCU16ImmAsmOperand; 758 let DecoderMethod = "decodeUImmOperand<16>"; 759 let OperandType = "OPERAND_IMMEDIATE"; 760} 761def PPCS17ImmAsmOperand : AsmOperandClass { 762 let Name = "S17Imm"; let PredicateMethod = "isS17Imm"; 763 let RenderMethod = "addS16ImmOperands"; 764} 765def s17imm : Operand<i32> { 766 // This operand type is used for addis/lis to allow the assembler parser 767 // to accept immediates in the range -65536..65535 for compatibility with 768 // the GNU assembler. The operand is treated as 16-bit otherwise. 769 let PrintMethod = "printS16ImmOperand"; 770 let EncoderMethod = "getImm16Encoding"; 771 let ParserMatchClass = PPCS17ImmAsmOperand; 772 let DecoderMethod = "decodeSImmOperand<16>"; 773 let OperandType = "OPERAND_IMMEDIATE"; 774} 775def PPCS34ImmAsmOperand : AsmOperandClass { 776 let Name = "S34Imm"; 777 let PredicateMethod = "isS34Imm"; 778 let RenderMethod = "addImmOperands"; 779} 780def s34imm : Operand<i64> { 781 let PrintMethod = "printS34ImmOperand"; 782 let EncoderMethod = "getImm34EncodingNoPCRel"; 783 let ParserMatchClass = PPCS34ImmAsmOperand; 784 let DecoderMethod = "decodeSImmOperand<34>"; 785 let OperandType = "OPERAND_IMMEDIATE"; 786} 787def s34imm_pcrel : Operand<i64> { 788 let PrintMethod = "printS34ImmOperand"; 789 let EncoderMethod = "getImm34EncodingPCRel"; 790 let ParserMatchClass = PPCS34ImmAsmOperand; 791 let DecoderMethod = "decodeSImmOperand<34>"; 792 let OperandType = "OPERAND_IMMEDIATE"; 793} 794def PPCImmZeroAsmOperand : AsmOperandClass { 795 let Name = "ImmZero"; 796 let PredicateMethod = "isImmZero"; 797 let RenderMethod = "addImmOperands"; 798} 799def immZero : Operand<i32> { 800 let PrintMethod = "printImmZeroOperand"; 801 let ParserMatchClass = PPCImmZeroAsmOperand; 802 let DecoderMethod = "decodeImmZeroOperand"; 803 let OperandType = "OPERAND_IMMEDIATE"; 804} 805 806def fpimm0 : PatLeaf<(fpimm), [{ return N->isExactlyValue(+0.0); }]>; 807def fpimm0neg : PatLeaf<(fpimm), [{return N->isExactlyValue(-0.0);}]>; 808 809def PPCDirectBrAsmOperand : AsmOperandClass { 810 let Name = "DirectBr"; let PredicateMethod = "isDirectBr"; 811 let RenderMethod = "addBranchTargetOperands"; 812} 813def directbrtarget : Operand<OtherVT> { 814 let PrintMethod = "printBranchOperand"; 815 let EncoderMethod = "getDirectBrEncoding"; 816 let DecoderMethod = "decodeDirectBrTarget"; 817 let ParserMatchClass = PPCDirectBrAsmOperand; 818 let OperandType = "OPERAND_PCREL"; 819} 820def absdirectbrtarget : Operand<OtherVT> { 821 let PrintMethod = "printAbsBranchOperand"; 822 let EncoderMethod = "getAbsDirectBrEncoding"; 823 let DecoderMethod = "decodeDirectBrTarget"; 824 let ParserMatchClass = PPCDirectBrAsmOperand; 825} 826def PPCCondBrAsmOperand : AsmOperandClass { 827 let Name = "CondBr"; let PredicateMethod = "isCondBr"; 828 let RenderMethod = "addBranchTargetOperands"; 829} 830def condbrtarget : Operand<OtherVT> { 831 let PrintMethod = "printBranchOperand"; 832 let EncoderMethod = "getCondBrEncoding"; 833 let DecoderMethod = "decodeCondBrTarget"; 834 let ParserMatchClass = PPCCondBrAsmOperand; 835 let OperandType = "OPERAND_PCREL"; 836} 837def abscondbrtarget : Operand<OtherVT> { 838 let PrintMethod = "printAbsBranchOperand"; 839 let EncoderMethod = "getAbsCondBrEncoding"; 840 let DecoderMethod = "decodeCondBrTarget"; 841 let ParserMatchClass = PPCCondBrAsmOperand; 842} 843def calltarget : Operand<iPTR> { 844 let PrintMethod = "printBranchOperand"; 845 let EncoderMethod = "getDirectBrEncoding"; 846 let DecoderMethod = "decodeDirectBrTarget"; 847 let ParserMatchClass = PPCDirectBrAsmOperand; 848 let OperandType = "OPERAND_PCREL"; 849} 850def abscalltarget : Operand<iPTR> { 851 let PrintMethod = "printAbsBranchOperand"; 852 let EncoderMethod = "getAbsDirectBrEncoding"; 853 let DecoderMethod = "decodeDirectBrTarget"; 854 let ParserMatchClass = PPCDirectBrAsmOperand; 855} 856def PPCCRBitMaskOperand : AsmOperandClass { 857 let Name = "CRBitMask"; let PredicateMethod = "isCRBitMask"; 858} 859def crbitm: Operand<i8> { 860 let PrintMethod = "printcrbitm"; 861 let EncoderMethod = "get_crbitm_encoding"; 862 let DecoderMethod = "decodeCRBitMOperand"; 863 let ParserMatchClass = PPCCRBitMaskOperand; 864} 865// Address operands 866// A version of ptr_rc which excludes R0 (or X0 in 64-bit mode). 867def PPCRegGxRCNoR0Operand : AsmOperandClass { 868 let Name = "RegGxRCNoR0"; let PredicateMethod = "isRegNumber"; 869} 870def ptr_rc_nor0 : Operand<iPTR>, PointerLikeRegClass<1> { 871 let ParserMatchClass = PPCRegGxRCNoR0Operand; 872} 873 874// New addressing modes with 34 bit immediates. 875def PPCDispRI34Operand : AsmOperandClass { 876 let Name = "DispRI34"; let PredicateMethod = "isS34Imm"; 877 let RenderMethod = "addImmOperands"; 878} 879def dispRI34 : Operand<iPTR> { 880 let ParserMatchClass = PPCDispRI34Operand; 881 let EncoderMethod = "getDispRI34Encoding"; 882 let DecoderMethod = "decodeSImmOperand<34>"; 883} 884def dispRI34_pcrel : Operand<iPTR> { 885 let ParserMatchClass = PPCDispRI34Operand; 886 let EncoderMethod = "getDispRI34PCRelEncoding"; 887 let DecoderMethod = "decodeSImmOperand<34>"; 888} 889def memri34 : Operand<iPTR> { // memri, imm is a 34-bit value. 890 let PrintMethod = "printMemRegImm34"; 891 let MIOperandInfo = (ops dispRI34:$imm, ptr_rc_nor0:$reg); 892} 893// memri, imm is a 34-bit value for pc-relative instructions where 894// base register is set to zero. 895def memri34_pcrel : Operand<iPTR> { // memri, imm is a 34-bit value. 896 let PrintMethod = "printMemRegImm34PCRel"; 897 let MIOperandInfo = (ops dispRI34_pcrel:$imm, immZero:$reg); 898} 899 900// A version of ptr_rc usable with the asm parser. 901def PPCRegGxRCOperand : AsmOperandClass { 902 let Name = "RegGxRC"; let PredicateMethod = "isRegNumber"; 903} 904def ptr_rc_idx : Operand<iPTR>, PointerLikeRegClass<0> { 905 let ParserMatchClass = PPCRegGxRCOperand; 906} 907 908def PPCDispRIOperand : AsmOperandClass { 909 let Name = "DispRI"; let PredicateMethod = "isS16Imm"; 910 let RenderMethod = "addS16ImmOperands"; 911} 912def dispRI : Operand<iPTR> { 913 let ParserMatchClass = PPCDispRIOperand; 914 let EncoderMethod = "getDispRIEncoding"; 915} 916def PPCDispRIXOperand : AsmOperandClass { 917 let Name = "DispRIX"; let PredicateMethod = "isS16ImmX4"; 918 let RenderMethod = "addS16ImmOperands"; 919} 920def dispRIX : Operand<iPTR> { 921 let ParserMatchClass = PPCDispRIXOperand; 922 let EncoderMethod = "getDispRIXEncoding"; 923 let DecoderMethod = "decodeDispRIXOperand"; 924} 925def PPCDispRIHashOperand : AsmOperandClass { 926 let Name = "DispRIHash"; let PredicateMethod = "isHashImmX8"; 927 let RenderMethod = "addImmOperands"; 928} 929def dispRIHash : Operand<iPTR> { 930 let ParserMatchClass = PPCDispRIHashOperand; 931 let EncoderMethod = "getDispRIHashEncoding"; 932 let DecoderMethod = "decodeDispRIHashOperand"; 933} 934def PPCDispRIX16Operand : AsmOperandClass { 935 let Name = "DispRIX16"; let PredicateMethod = "isS16ImmX16"; 936 let RenderMethod = "addS16ImmOperands"; 937} 938def dispRIX16 : Operand<iPTR> { 939 let ParserMatchClass = PPCDispRIX16Operand; 940 let EncoderMethod = "getDispRIX16Encoding"; 941 let DecoderMethod = "decodeDispRIX16Operand"; 942 943} 944def PPCDispSPE8Operand : AsmOperandClass { 945 let Name = "DispSPE8"; let PredicateMethod = "isU8ImmX8"; 946 let RenderMethod = "addImmOperands"; 947} 948def dispSPE8 : Operand<iPTR> { 949 let ParserMatchClass = PPCDispSPE8Operand; 950 let DecoderMethod = "decodeDispSPE8Operand"; 951 let EncoderMethod = "getDispSPE8Encoding"; 952} 953def PPCDispSPE4Operand : AsmOperandClass { 954 let Name = "DispSPE4"; let PredicateMethod = "isU7ImmX4"; 955 let RenderMethod = "addImmOperands"; 956} 957def dispSPE4 : Operand<iPTR> { 958 let ParserMatchClass = PPCDispSPE4Operand; 959 let DecoderMethod = "decodeDispSPE4Operand"; 960 let EncoderMethod = "getDispSPE4Encoding"; 961} 962def PPCDispSPE2Operand : AsmOperandClass { 963 let Name = "DispSPE2"; let PredicateMethod = "isU6ImmX2"; 964 let RenderMethod = "addImmOperands"; 965} 966def dispSPE2 : Operand<iPTR> { 967 let ParserMatchClass = PPCDispSPE2Operand; 968 let DecoderMethod = "decodeDispSPE2Operand"; 969 let EncoderMethod = "getDispSPE2Encoding"; 970} 971 972def memri : Operand<iPTR> { 973 let PrintMethod = "printMemRegImm"; 974 let MIOperandInfo = (ops dispRI:$imm, ptr_rc_nor0:$reg); 975 let OperandType = "OPERAND_MEMORY"; 976} 977def memrr : Operand<iPTR> { 978 let PrintMethod = "printMemRegReg"; 979 let MIOperandInfo = (ops ptr_rc_nor0:$ptrreg, ptr_rc_idx:$offreg); 980 let OperandType = "OPERAND_MEMORY"; 981} 982def memrix : Operand<iPTR> { // memri where the imm is 4-aligned. 983 let PrintMethod = "printMemRegImm"; 984 let MIOperandInfo = (ops dispRIX:$imm, ptr_rc_nor0:$reg); 985 let OperandType = "OPERAND_MEMORY"; 986} 987def memrihash : Operand<iPTR> { 988 // memrihash 8-aligned for ROP Protection Instructions. 989 let PrintMethod = "printMemRegImmHash"; 990 let MIOperandInfo = (ops dispRIHash:$imm, ptr_rc_nor0:$reg); 991 let OperandType = "OPERAND_MEMORY"; 992} 993def memrix16 : Operand<iPTR> { // memri, imm is 16-aligned, 12-bit, Inst{16:27} 994 let PrintMethod = "printMemRegImm"; 995 let MIOperandInfo = (ops dispRIX16:$imm, ptr_rc_nor0:$reg); 996 let OperandType = "OPERAND_MEMORY"; 997} 998def spe8dis : Operand<iPTR> { // SPE displacement where the imm is 8-aligned. 999 let PrintMethod = "printMemRegImm"; 1000 let MIOperandInfo = (ops dispSPE8:$imm, ptr_rc_nor0:$reg); 1001 let OperandType = "OPERAND_MEMORY"; 1002} 1003def spe4dis : Operand<iPTR> { // SPE displacement where the imm is 4-aligned. 1004 let PrintMethod = "printMemRegImm"; 1005 let MIOperandInfo = (ops dispSPE4:$imm, ptr_rc_nor0:$reg); 1006 let OperandType = "OPERAND_MEMORY"; 1007} 1008def spe2dis : Operand<iPTR> { // SPE displacement where the imm is 2-aligned. 1009 let PrintMethod = "printMemRegImm"; 1010 let MIOperandInfo = (ops dispSPE2:$imm, ptr_rc_nor0:$reg); 1011 let OperandType = "OPERAND_MEMORY"; 1012} 1013 1014// A single-register address. This is used with the SjLj 1015// pseudo-instructions which translates to LD/LWZ. These instructions requires 1016// G8RC_NOX0 registers. 1017def memr : Operand<iPTR> { 1018 let MIOperandInfo = (ops ptr_rc_nor0:$ptrreg); 1019 let OperandType = "OPERAND_MEMORY"; 1020} 1021def PPCTLSRegOperand : AsmOperandClass { 1022 let Name = "TLSReg"; let PredicateMethod = "isTLSReg"; 1023 let RenderMethod = "addTLSRegOperands"; 1024} 1025def tlsreg32 : Operand<i32> { 1026 let EncoderMethod = "getTLSRegEncoding"; 1027 let ParserMatchClass = PPCTLSRegOperand; 1028} 1029def tlsgd32 : Operand<i32> {} 1030def tlscall32 : Operand<i32> { 1031 let PrintMethod = "printTLSCall"; 1032 let MIOperandInfo = (ops calltarget:$func, tlsgd32:$sym); 1033 let EncoderMethod = "getTLSCallEncoding"; 1034} 1035 1036// PowerPC Predicate operand. 1037def pred : Operand<OtherVT> { 1038 let PrintMethod = "printPredicateOperand"; 1039 let MIOperandInfo = (ops i32imm:$bibo, crrc:$reg); 1040} 1041 1042def PPCRegVSRCAsmOperand : AsmOperandClass { 1043 let Name = "RegVSRC"; let PredicateMethod = "isVSRegNumber"; 1044} 1045def vsrc : RegisterOperand<VSRC> { 1046 let ParserMatchClass = PPCRegVSRCAsmOperand; 1047} 1048 1049def PPCRegVSFRCAsmOperand : AsmOperandClass { 1050 let Name = "RegVSFRC"; let PredicateMethod = "isVSRegNumber"; 1051} 1052def vsfrc : RegisterOperand<VSFRC> { 1053 let ParserMatchClass = PPCRegVSFRCAsmOperand; 1054} 1055 1056def PPCRegVSSRCAsmOperand : AsmOperandClass { 1057 let Name = "RegVSSRC"; let PredicateMethod = "isVSRegNumber"; 1058} 1059def vssrc : RegisterOperand<VSSRC> { 1060 let ParserMatchClass = PPCRegVSSRCAsmOperand; 1061} 1062 1063def PPCRegSPILLTOVSRRCAsmOperand : AsmOperandClass { 1064 let Name = "RegSPILLTOVSRRC"; let PredicateMethod = "isVSRegNumber"; 1065} 1066 1067def spilltovsrrc : RegisterOperand<SPILLTOVSRRC> { 1068 let ParserMatchClass = PPCRegSPILLTOVSRRCAsmOperand; 1069} 1070 1071def PPCRegVSRpRCAsmOperand : AsmOperandClass { 1072 let Name = "RegVSRpRC"; let PredicateMethod = "isVSRpEvenRegNumber"; 1073} 1074 1075def vsrprc : RegisterOperand<VSRpRC> { 1076 let ParserMatchClass = PPCRegVSRpRCAsmOperand; 1077} 1078 1079def PPCRegVSRpEvenRCAsmOperand : AsmOperandClass { 1080 let Name = "RegVSRpEvenRC"; let PredicateMethod = "isVSRpEvenRegNumber"; 1081} 1082 1083def vsrpevenrc : RegisterOperand<VSRpRC> { 1084 let ParserMatchClass = PPCRegVSRpEvenRCAsmOperand; 1085 let EncoderMethod = "getVSRpEvenEncoding"; 1086 let DecoderMethod = "decodeVSRpEvenOperands"; 1087} 1088 1089def PPCRegACCRCAsmOperand : AsmOperandClass { 1090 let Name = "RegACCRC"; let PredicateMethod = "isACCRegNumber"; 1091} 1092 1093def acc : RegisterOperand<ACCRC> { 1094 let ParserMatchClass = PPCRegACCRCAsmOperand; 1095} 1096 1097def uacc : RegisterOperand<UACCRC> { 1098 let ParserMatchClass = PPCRegACCRCAsmOperand; 1099} 1100 1101// DMR Register Operands 1102def PPCRegDMRROWRCAsmOperand : AsmOperandClass { 1103 let Name = "RegDMRROWRC"; 1104 let PredicateMethod = "isDMRROWRegNumber"; 1105} 1106 1107def dmrrow : RegisterOperand<DMRROWRC> { 1108 let ParserMatchClass = PPCRegDMRROWRCAsmOperand; 1109} 1110 1111def PPCRegDMRROWpRCAsmOperand : AsmOperandClass { 1112 let Name = "RegDMRROWpRC"; 1113 let PredicateMethod = "isDMRROWpRegNumber"; 1114} 1115 1116def dmrrowp : RegisterOperand<DMRROWpRC> { 1117 let ParserMatchClass = PPCRegDMRROWpRCAsmOperand; 1118} 1119 1120def wacc : RegisterOperand<WACCRC> { 1121 let ParserMatchClass = PPCRegACCRCAsmOperand; 1122} 1123 1124def wacc_hi : RegisterOperand<WACC_HIRC> { 1125 let ParserMatchClass = PPCRegACCRCAsmOperand; 1126} 1127 1128def PPCRegDMRRCAsmOperand : AsmOperandClass { 1129 let Name = "RegDMRRC"; 1130 let PredicateMethod = "isDMRRegNumber"; 1131} 1132 1133def dmr : RegisterOperand<DMRRC> { 1134 let ParserMatchClass = PPCRegDMRRCAsmOperand; 1135} 1136 1137def PPCRegDMRpRCAsmOperand : AsmOperandClass { 1138 let Name = "RegDMRpRC"; 1139 let PredicateMethod = "isDMRpRegNumber"; 1140} 1141 1142def dmrp : RegisterOperand<DMRpRC> { 1143 let ParserMatchClass = PPCRegDMRpRCAsmOperand; 1144} 1145