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