//===-- CodeViewRegisters.def - CodeView registers --------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// See CV_HREG_e in cvconst.h. This should match the constants there.
//
//===----------------------------------------------------------------------===//

#ifndef CV_REGISTER
#define CV_REGISTER(name, value)
#endif

#if !defined(CV_REGISTERS_ALL) && !defined(CV_REGISTERS_X86) &&                \
    !defined(CV_REGISTERS_ARM64)
#error Need include at least one register set.
#endif

// This currently only contains the "register subset shared by all processor
// types" (ERR etc.) and the x86/arm64 registers.

#if defined(CV_REGISTERS_ALL) || defined(CV_REGISTERS_X86)

// Some system headers define macros that conflict with our enums. Every
// compiler supported by LLVM has the push_macro and pop_macro pragmas, so use
// them to avoid the conflict.
#pragma push_macro("CR0")
#pragma push_macro("CR1")
#pragma push_macro("CR2")
#pragma push_macro("CR3")
#pragma push_macro("CR4")

CV_REGISTER(ERR, 30000)
CV_REGISTER(TEB, 30001)
CV_REGISTER(TIMER, 30002)
CV_REGISTER(EFAD1, 30003)
CV_REGISTER(EFAD2, 30004)
CV_REGISTER(EFAD3, 30005)
CV_REGISTER(VFRAME, 30006)
CV_REGISTER(HANDLE, 30007)
CV_REGISTER(PARAMS, 30008)
CV_REGISTER(LOCALS, 30009)
CV_REGISTER(TID, 30010)
CV_REGISTER(ENV, 30011)
CV_REGISTER(CMDLN, 30012)

CV_REGISTER(NONE, 0)
CV_REGISTER(AL, 1)
CV_REGISTER(CL, 2)
CV_REGISTER(DL, 3)
CV_REGISTER(BL, 4)
CV_REGISTER(AH, 5)
CV_REGISTER(CH, 6)
CV_REGISTER(DH, 7)
CV_REGISTER(BH, 8)
CV_REGISTER(AX, 9)
CV_REGISTER(CX, 10)
CV_REGISTER(DX, 11)
CV_REGISTER(BX, 12)
CV_REGISTER(SP, 13)
CV_REGISTER(BP, 14)
CV_REGISTER(SI, 15)
CV_REGISTER(DI, 16)
CV_REGISTER(EAX, 17)
CV_REGISTER(ECX, 18)
CV_REGISTER(EDX, 19)
CV_REGISTER(EBX, 20)
CV_REGISTER(ESP, 21)
CV_REGISTER(EBP, 22)
CV_REGISTER(ESI, 23)
CV_REGISTER(EDI, 24)
CV_REGISTER(ES, 25)
CV_REGISTER(CS, 26)
CV_REGISTER(SS, 27)
CV_REGISTER(DS, 28)
CV_REGISTER(FS, 29)
CV_REGISTER(GS, 30)
CV_REGISTER(IP, 31)
CV_REGISTER(FLAGS, 32)
CV_REGISTER(EIP, 33)
CV_REGISTER(EFLAGS, 34)
CV_REGISTER(TEMP, 40)
CV_REGISTER(TEMPH, 41)
CV_REGISTER(QUOTE, 42)
CV_REGISTER(PCDR3, 43)
CV_REGISTER(PCDR4, 44)
CV_REGISTER(PCDR5, 45)
CV_REGISTER(PCDR6, 46)
CV_REGISTER(PCDR7, 47)
CV_REGISTER(CR0, 80)
CV_REGISTER(CR1, 81)
CV_REGISTER(CR2, 82)
CV_REGISTER(CR3, 83)
CV_REGISTER(CR4, 84)
CV_REGISTER(DR0, 90)
CV_REGISTER(DR1, 91)
CV_REGISTER(DR2, 92)
CV_REGISTER(DR3, 93)
CV_REGISTER(DR4, 94)
CV_REGISTER(DR5, 95)
CV_REGISTER(DR6, 96)
CV_REGISTER(DR7, 97)
CV_REGISTER(GDTR, 110)
CV_REGISTER(GDTL, 111)
CV_REGISTER(IDTR, 112)
CV_REGISTER(IDTL, 113)
CV_REGISTER(LDTR, 114)
CV_REGISTER(TR, 115)

CV_REGISTER(PSEUDO1, 116)
CV_REGISTER(PSEUDO2, 117)
CV_REGISTER(PSEUDO3, 118)
CV_REGISTER(PSEUDO4, 119)
CV_REGISTER(PSEUDO5, 120)
CV_REGISTER(PSEUDO6, 121)
CV_REGISTER(PSEUDO7, 122)
CV_REGISTER(PSEUDO8, 123)
CV_REGISTER(PSEUDO9, 124)

CV_REGISTER(ST0, 128)
CV_REGISTER(ST1, 129)
CV_REGISTER(ST2, 130)
CV_REGISTER(ST3, 131)
CV_REGISTER(ST4, 132)
CV_REGISTER(ST5, 133)
CV_REGISTER(ST6, 134)
CV_REGISTER(ST7, 135)
CV_REGISTER(CTRL, 136)
CV_REGISTER(STAT, 137)
CV_REGISTER(TAG, 138)
CV_REGISTER(FPIP, 139)
CV_REGISTER(FPCS, 140)
CV_REGISTER(FPDO, 141)
CV_REGISTER(FPDS, 142)
CV_REGISTER(ISEM, 143)
CV_REGISTER(FPEIP, 144)
CV_REGISTER(FPEDO, 145)

CV_REGISTER(MM0, 146)
CV_REGISTER(MM1, 147)
CV_REGISTER(MM2, 148)
CV_REGISTER(MM3, 149)
CV_REGISTER(MM4, 150)
CV_REGISTER(MM5, 151)
CV_REGISTER(MM6, 152)
CV_REGISTER(MM7, 153)

CV_REGISTER(XMM0, 154)
CV_REGISTER(XMM1, 155)
CV_REGISTER(XMM2, 156)
CV_REGISTER(XMM3, 157)
CV_REGISTER(XMM4, 158)
CV_REGISTER(XMM5, 159)
CV_REGISTER(XMM6, 160)
CV_REGISTER(XMM7, 161)

CV_REGISTER(MXCSR, 211)

CV_REGISTER(EDXEAX, 212)

CV_REGISTER(EMM0L, 220)
CV_REGISTER(EMM1L, 221)
CV_REGISTER(EMM2L, 222)
CV_REGISTER(EMM3L, 223)
CV_REGISTER(EMM4L, 224)
CV_REGISTER(EMM5L, 225)
CV_REGISTER(EMM6L, 226)
CV_REGISTER(EMM7L, 227)

CV_REGISTER(EMM0H, 228)
CV_REGISTER(EMM1H, 229)
CV_REGISTER(EMM2H, 230)
CV_REGISTER(EMM3H, 231)
CV_REGISTER(EMM4H, 232)
CV_REGISTER(EMM5H, 233)
CV_REGISTER(EMM6H, 234)
CV_REGISTER(EMM7H, 235)

CV_REGISTER(MM00, 236)
CV_REGISTER(MM01, 237)
CV_REGISTER(MM10, 238)
CV_REGISTER(MM11, 239)
CV_REGISTER(MM20, 240)
CV_REGISTER(MM21, 241)
CV_REGISTER(MM30, 242)
CV_REGISTER(MM31, 243)
CV_REGISTER(MM40, 244)
CV_REGISTER(MM41, 245)
CV_REGISTER(MM50, 246)
CV_REGISTER(MM51, 247)
CV_REGISTER(MM60, 248)
CV_REGISTER(MM61, 249)
CV_REGISTER(MM70, 250)
CV_REGISTER(MM71, 251)

CV_REGISTER(BND0, 396)
CV_REGISTER(BND1, 397)
CV_REGISTER(BND2, 398)


CV_REGISTER(XMM8, 252)
CV_REGISTER(XMM9, 253)
CV_REGISTER(XMM10, 254)
CV_REGISTER(XMM11, 255)
CV_REGISTER(XMM12, 256)
CV_REGISTER(XMM13, 257)
CV_REGISTER(XMM14, 258)
CV_REGISTER(XMM15, 259)


CV_REGISTER(SIL, 324)
CV_REGISTER(DIL, 325)
CV_REGISTER(BPL, 326)
CV_REGISTER(SPL, 327)

CV_REGISTER(RAX, 328)
CV_REGISTER(RBX, 329)
CV_REGISTER(RCX, 330)
CV_REGISTER(RDX, 331)
CV_REGISTER(RSI, 332)
CV_REGISTER(RDI, 333)
CV_REGISTER(RBP, 334)
CV_REGISTER(RSP, 335)

CV_REGISTER(R8, 336)
CV_REGISTER(R9, 337)
CV_REGISTER(R10, 338)
CV_REGISTER(R11, 339)
CV_REGISTER(R12, 340)
CV_REGISTER(R13, 341)
CV_REGISTER(R14, 342)
CV_REGISTER(R15, 343)

CV_REGISTER(R8B, 344)
CV_REGISTER(R9B, 345)
CV_REGISTER(R10B, 346)
CV_REGISTER(R11B, 347)
CV_REGISTER(R12B, 348)
CV_REGISTER(R13B, 349)
CV_REGISTER(R14B, 350)
CV_REGISTER(R15B, 351)

CV_REGISTER(R8W, 352)
CV_REGISTER(R9W, 353)
CV_REGISTER(R10W, 354)
CV_REGISTER(R11W, 355)
CV_REGISTER(R12W, 356)
CV_REGISTER(R13W, 357)
CV_REGISTER(R14W, 358)
CV_REGISTER(R15W, 359)

CV_REGISTER(R8D, 360)
CV_REGISTER(R9D, 361)
CV_REGISTER(R10D, 362)
CV_REGISTER(R11D, 363)
CV_REGISTER(R12D, 364)
CV_REGISTER(R13D, 365)
CV_REGISTER(R14D, 366)
CV_REGISTER(R15D, 367)


// cvconst.h defines both CV_REG_YMM0 (252) and CV_AMD64_YMM0 (368). Keep the
// original prefix to distinguish them.

CV_REGISTER(AMD64_YMM0, 368)
CV_REGISTER(AMD64_YMM1, 369)
CV_REGISTER(AMD64_YMM2, 370)
CV_REGISTER(AMD64_YMM3, 371)
CV_REGISTER(AMD64_YMM4, 372)
CV_REGISTER(AMD64_YMM5, 373)
CV_REGISTER(AMD64_YMM6, 374)
CV_REGISTER(AMD64_YMM7, 375)
CV_REGISTER(AMD64_YMM8, 376)
CV_REGISTER(AMD64_YMM9, 377)
CV_REGISTER(AMD64_YMM10, 378)
CV_REGISTER(AMD64_YMM11, 379)
CV_REGISTER(AMD64_YMM12, 380)
CV_REGISTER(AMD64_YMM13, 381)
CV_REGISTER(AMD64_YMM14, 382)
CV_REGISTER(AMD64_YMM15, 383)

CV_REGISTER(AMD64_XMM16, 694)
CV_REGISTER(AMD64_XMM17, 695)
CV_REGISTER(AMD64_XMM18, 696)
CV_REGISTER(AMD64_XMM19, 697)
CV_REGISTER(AMD64_XMM20, 698)
CV_REGISTER(AMD64_XMM21, 699)
CV_REGISTER(AMD64_XMM22, 700)
CV_REGISTER(AMD64_XMM23, 701)
CV_REGISTER(AMD64_XMM24, 702)
CV_REGISTER(AMD64_XMM25, 703)
CV_REGISTER(AMD64_XMM26, 704)
CV_REGISTER(AMD64_XMM27, 705)
CV_REGISTER(AMD64_XMM28, 706)
CV_REGISTER(AMD64_XMM29, 707)
CV_REGISTER(AMD64_XMM30, 708)
CV_REGISTER(AMD64_XMM31, 709)

CV_REGISTER(AMD64_YMM16, 710)
CV_REGISTER(AMD64_YMM17, 711)
CV_REGISTER(AMD64_YMM18, 712)
CV_REGISTER(AMD64_YMM19, 713)
CV_REGISTER(AMD64_YMM20, 714)
CV_REGISTER(AMD64_YMM21, 715)
CV_REGISTER(AMD64_YMM22, 716)
CV_REGISTER(AMD64_YMM23, 717)
CV_REGISTER(AMD64_YMM24, 718)
CV_REGISTER(AMD64_YMM25, 719)
CV_REGISTER(AMD64_YMM26, 720)
CV_REGISTER(AMD64_YMM27, 721)
CV_REGISTER(AMD64_YMM28, 722)
CV_REGISTER(AMD64_YMM29, 723)
CV_REGISTER(AMD64_YMM30, 724)
CV_REGISTER(AMD64_YMM31, 725)

CV_REGISTER(AMD64_ZMM0, 726)
CV_REGISTER(AMD64_ZMM1, 727)
CV_REGISTER(AMD64_ZMM2, 728)
CV_REGISTER(AMD64_ZMM3, 729)
CV_REGISTER(AMD64_ZMM4, 730)
CV_REGISTER(AMD64_ZMM5, 731)
CV_REGISTER(AMD64_ZMM6, 732)
CV_REGISTER(AMD64_ZMM7, 733)
CV_REGISTER(AMD64_ZMM8, 734)
CV_REGISTER(AMD64_ZMM9, 735)
CV_REGISTER(AMD64_ZMM10, 736)
CV_REGISTER(AMD64_ZMM11, 737)
CV_REGISTER(AMD64_ZMM12, 738)
CV_REGISTER(AMD64_ZMM13, 739)
CV_REGISTER(AMD64_ZMM14, 740)
CV_REGISTER(AMD64_ZMM15, 741)
CV_REGISTER(AMD64_ZMM16, 742)
CV_REGISTER(AMD64_ZMM17, 743)
CV_REGISTER(AMD64_ZMM18, 744)
CV_REGISTER(AMD64_ZMM19, 745)
CV_REGISTER(AMD64_ZMM20, 746)
CV_REGISTER(AMD64_ZMM21, 747)
CV_REGISTER(AMD64_ZMM22, 748)
CV_REGISTER(AMD64_ZMM23, 749)
CV_REGISTER(AMD64_ZMM24, 750)
CV_REGISTER(AMD64_ZMM25, 751)
CV_REGISTER(AMD64_ZMM26, 752)
CV_REGISTER(AMD64_ZMM27, 753)
CV_REGISTER(AMD64_ZMM28, 754)
CV_REGISTER(AMD64_ZMM29, 755)
CV_REGISTER(AMD64_ZMM30, 756)
CV_REGISTER(AMD64_ZMM31, 757)

CV_REGISTER(AMD64_K0, 758)
CV_REGISTER(AMD64_K1, 759)
CV_REGISTER(AMD64_K2, 760)
CV_REGISTER(AMD64_K3, 761)
CV_REGISTER(AMD64_K4, 762)
CV_REGISTER(AMD64_K5, 763)
CV_REGISTER(AMD64_K6, 764)
CV_REGISTER(AMD64_K7, 765)

#pragma pop_macro("CR0")
#pragma pop_macro("CR1")
#pragma pop_macro("CR2")
#pragma pop_macro("CR3")
#pragma pop_macro("CR4")

#endif // defined(CV_REGISTERS_ALL) || defined(CV_REGISTERS_X86)

#if defined(CV_REGISTERS_ALL) || defined(CV_REGISTERS_ARM64)

// ARM64 registers

CV_REGISTER(ARM64_NOREG, 0)

// General purpose 32-bit integer registers

CV_REGISTER(ARM64_W0, 10)
CV_REGISTER(ARM64_W1, 11)
CV_REGISTER(ARM64_W2, 12)
CV_REGISTER(ARM64_W3, 13)
CV_REGISTER(ARM64_W4, 14)
CV_REGISTER(ARM64_W5, 15)
CV_REGISTER(ARM64_W6, 16)
CV_REGISTER(ARM64_W7, 17)
CV_REGISTER(ARM64_W8, 18)
CV_REGISTER(ARM64_W9, 19)
CV_REGISTER(ARM64_W10, 20)
CV_REGISTER(ARM64_W11, 21)
CV_REGISTER(ARM64_W12, 22)
CV_REGISTER(ARM64_W13, 23)
CV_REGISTER(ARM64_W14, 24)
CV_REGISTER(ARM64_W15, 25)
CV_REGISTER(ARM64_W16, 26)
CV_REGISTER(ARM64_W17, 27)
CV_REGISTER(ARM64_W18, 28)
CV_REGISTER(ARM64_W19, 29)
CV_REGISTER(ARM64_W20, 30)
CV_REGISTER(ARM64_W21, 31)
CV_REGISTER(ARM64_W22, 32)
CV_REGISTER(ARM64_W23, 33)
CV_REGISTER(ARM64_W24, 34)
CV_REGISTER(ARM64_W25, 35)
CV_REGISTER(ARM64_W26, 36)
CV_REGISTER(ARM64_W27, 37)
CV_REGISTER(ARM64_W28, 38)
CV_REGISTER(ARM64_W29, 39)
CV_REGISTER(ARM64_W30, 40)
CV_REGISTER(ARM64_WZR, 41)

// General purpose 64-bit integer registers

CV_REGISTER(ARM64_X0, 50)
CV_REGISTER(ARM64_X1, 51)
CV_REGISTER(ARM64_X2, 52)
CV_REGISTER(ARM64_X3, 53)
CV_REGISTER(ARM64_X4, 54)
CV_REGISTER(ARM64_X5, 55)
CV_REGISTER(ARM64_X6, 56)
CV_REGISTER(ARM64_X7, 57)
CV_REGISTER(ARM64_X8, 58)
CV_REGISTER(ARM64_X9, 59)
CV_REGISTER(ARM64_X10, 60)
CV_REGISTER(ARM64_X11, 61)
CV_REGISTER(ARM64_X12, 62)
CV_REGISTER(ARM64_X13, 63)
CV_REGISTER(ARM64_X14, 64)
CV_REGISTER(ARM64_X15, 65)
CV_REGISTER(ARM64_X16, 66)
CV_REGISTER(ARM64_X17, 67)
CV_REGISTER(ARM64_X18, 68)
CV_REGISTER(ARM64_X19, 69)
CV_REGISTER(ARM64_X20, 70)
CV_REGISTER(ARM64_X21, 71)
CV_REGISTER(ARM64_X22, 72)
CV_REGISTER(ARM64_X23, 73)
CV_REGISTER(ARM64_X24, 74)
CV_REGISTER(ARM64_X25, 75)
CV_REGISTER(ARM64_X26, 76)
CV_REGISTER(ARM64_X27, 77)
CV_REGISTER(ARM64_X28, 78)
CV_REGISTER(ARM64_FP, 79)
CV_REGISTER(ARM64_LR, 80)
CV_REGISTER(ARM64_SP, 81)
CV_REGISTER(ARM64_ZR, 82)

// status register

CV_REGISTER(ARM64_NZCV, 90)

// 32-bit floating point registers

CV_REGISTER(ARM64_S0, 100)
CV_REGISTER(ARM64_S1, 101)
CV_REGISTER(ARM64_S2, 102)
CV_REGISTER(ARM64_S3, 103)
CV_REGISTER(ARM64_S4, 104)
CV_REGISTER(ARM64_S5, 105)
CV_REGISTER(ARM64_S6, 106)
CV_REGISTER(ARM64_S7, 107)
CV_REGISTER(ARM64_S8, 108)
CV_REGISTER(ARM64_S9, 109)
CV_REGISTER(ARM64_S10, 110)
CV_REGISTER(ARM64_S11, 111)
CV_REGISTER(ARM64_S12, 112)
CV_REGISTER(ARM64_S13, 113)
CV_REGISTER(ARM64_S14, 114)
CV_REGISTER(ARM64_S15, 115)
CV_REGISTER(ARM64_S16, 116)
CV_REGISTER(ARM64_S17, 117)
CV_REGISTER(ARM64_S18, 118)
CV_REGISTER(ARM64_S19, 119)
CV_REGISTER(ARM64_S20, 120)
CV_REGISTER(ARM64_S21, 121)
CV_REGISTER(ARM64_S22, 122)
CV_REGISTER(ARM64_S23, 123)
CV_REGISTER(ARM64_S24, 124)
CV_REGISTER(ARM64_S25, 125)
CV_REGISTER(ARM64_S26, 126)
CV_REGISTER(ARM64_S27, 127)
CV_REGISTER(ARM64_S28, 128)
CV_REGISTER(ARM64_S29, 129)
CV_REGISTER(ARM64_S30, 130)
CV_REGISTER(ARM64_S31, 131)

// 64-bit floating point registers

CV_REGISTER(ARM64_D0, 140)
CV_REGISTER(ARM64_D1, 141)
CV_REGISTER(ARM64_D2, 142)
CV_REGISTER(ARM64_D3, 143)
CV_REGISTER(ARM64_D4, 144)
CV_REGISTER(ARM64_D5, 145)
CV_REGISTER(ARM64_D6, 146)
CV_REGISTER(ARM64_D7, 147)
CV_REGISTER(ARM64_D8, 148)
CV_REGISTER(ARM64_D9, 149)
CV_REGISTER(ARM64_D10, 150)
CV_REGISTER(ARM64_D11, 151)
CV_REGISTER(ARM64_D12, 152)
CV_REGISTER(ARM64_D13, 153)
CV_REGISTER(ARM64_D14, 154)
CV_REGISTER(ARM64_D15, 155)
CV_REGISTER(ARM64_D16, 156)
CV_REGISTER(ARM64_D17, 157)
CV_REGISTER(ARM64_D18, 158)
CV_REGISTER(ARM64_D19, 159)
CV_REGISTER(ARM64_D20, 160)
CV_REGISTER(ARM64_D21, 161)
CV_REGISTER(ARM64_D22, 162)
CV_REGISTER(ARM64_D23, 163)
CV_REGISTER(ARM64_D24, 164)
CV_REGISTER(ARM64_D25, 165)
CV_REGISTER(ARM64_D26, 166)
CV_REGISTER(ARM64_D27, 167)
CV_REGISTER(ARM64_D28, 168)
CV_REGISTER(ARM64_D29, 169)
CV_REGISTER(ARM64_D30, 170)
CV_REGISTER(ARM64_D31, 171)

// 128-bit SIMD registers

CV_REGISTER(ARM64_Q0, 180)
CV_REGISTER(ARM64_Q1, 181)
CV_REGISTER(ARM64_Q2, 182)
CV_REGISTER(ARM64_Q3, 183)
CV_REGISTER(ARM64_Q4, 184)
CV_REGISTER(ARM64_Q5, 185)
CV_REGISTER(ARM64_Q6, 186)
CV_REGISTER(ARM64_Q7, 187)
CV_REGISTER(ARM64_Q8, 188)
CV_REGISTER(ARM64_Q9, 189)
CV_REGISTER(ARM64_Q10, 190)
CV_REGISTER(ARM64_Q11, 191)
CV_REGISTER(ARM64_Q12, 192)
CV_REGISTER(ARM64_Q13, 193)
CV_REGISTER(ARM64_Q14, 194)
CV_REGISTER(ARM64_Q15, 195)
CV_REGISTER(ARM64_Q16, 196)
CV_REGISTER(ARM64_Q17, 197)
CV_REGISTER(ARM64_Q18, 198)
CV_REGISTER(ARM64_Q19, 199)
CV_REGISTER(ARM64_Q20, 200)
CV_REGISTER(ARM64_Q21, 201)
CV_REGISTER(ARM64_Q22, 202)
CV_REGISTER(ARM64_Q23, 203)
CV_REGISTER(ARM64_Q24, 204)
CV_REGISTER(ARM64_Q25, 205)
CV_REGISTER(ARM64_Q26, 206)
CV_REGISTER(ARM64_Q27, 207)
CV_REGISTER(ARM64_Q28, 208)
CV_REGISTER(ARM64_Q29, 209)
CV_REGISTER(ARM64_Q30, 210)
CV_REGISTER(ARM64_Q31, 211)

// Floating point status register

CV_REGISTER(ARM64_FPSR, 220)

#endif // defined(CV_REGISTERS_ALL) || defined(CV_REGISTERS_ARM64)
