John Porto | 2b18687 | 2015-06-26 13:41:00 -0700 | [diff] [blame] | 1 | //===- subzero/src/IceRegistersX8664.h - Register information ---*- C++ -*-===// |
| 2 | // |
| 3 | // The Subzero Code Generator |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
Andrew Scull | 9612d32 | 2015-07-06 14:53:25 -0700 | [diff] [blame] | 9 | /// |
| 10 | /// \file |
Jim Stichnoth | 92a6e5b | 2015-12-02 16:52:44 -0800 | [diff] [blame] | 11 | /// \brief Declares the registers and their encodings for x86-64. |
Andrew Scull | 9612d32 | 2015-07-06 14:53:25 -0700 | [diff] [blame] | 12 | /// |
John Porto | 2b18687 | 2015-06-26 13:41:00 -0700 | [diff] [blame] | 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef SUBZERO_SRC_ICEREGISTERSX8664_H |
| 16 | #define SUBZERO_SRC_ICEREGISTERSX8664_H |
| 17 | |
| 18 | #include "IceDefs.h" |
| 19 | #include "IceInstX8664.def" |
| 20 | #include "IceTypes.h" |
| 21 | |
| 22 | namespace Ice { |
| 23 | |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 24 | class RegX8664 { |
| 25 | public: |
Andrew Scull | 57e1268 | 2015-09-16 11:30:19 -0700 | [diff] [blame] | 26 | /// An enum of every register. The enum value may not match the encoding used |
| 27 | /// to binary encode register operands in instructions. |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 28 | enum AllRegisters { |
Jim Stichnoth | 5bff61c | 2015-10-28 09:26:00 -0700 | [diff] [blame] | 29 | #define X(val, encode, name, base, scratch, preserved, stackptr, frameptr, \ |
John Porto | 56958cb | 2016-01-14 09:18:18 -0800 | [diff] [blame] | 30 | sboxres, isGPR, is64, is32, is16, is8, isXmm, is64To8, is32To8, \ |
| 31 | is16To8, isTrunc8Rcvr, isAhRcvr, aliases) \ |
John Porto | 2b18687 | 2015-06-26 13:41:00 -0700 | [diff] [blame] | 32 | val, |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 33 | REGX8664_TABLE |
John Porto | 2b18687 | 2015-06-26 13:41:00 -0700 | [diff] [blame] | 34 | #undef X |
Jim Stichnoth | 5bff61c | 2015-10-28 09:26:00 -0700 | [diff] [blame] | 35 | Reg_NUM |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 36 | }; |
John Porto | 2b18687 | 2015-06-26 13:41:00 -0700 | [diff] [blame] | 37 | |
Andrew Scull | 57e1268 | 2015-09-16 11:30:19 -0700 | [diff] [blame] | 38 | /// An enum of GPR Registers. The enum value does match the encoding used to |
| 39 | /// binary encode register operands in instructions. |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 40 | enum GPRRegister { |
Jim Stichnoth | 5bff61c | 2015-10-28 09:26:00 -0700 | [diff] [blame] | 41 | #define X(val, encode, name, base, scratch, preserved, stackptr, frameptr, \ |
John Porto | 56958cb | 2016-01-14 09:18:18 -0800 | [diff] [blame] | 42 | sboxres, isGPR, is64, is32, is16, is8, isXmm, is64To8, is32To8, \ |
| 43 | is16To8, isTrunc8Rcvr, isAhRcvr, aliases) \ |
Jim Stichnoth | 5bff61c | 2015-10-28 09:26:00 -0700 | [diff] [blame] | 44 | Encoded_##val = encode, |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 45 | REGX8664_GPR_TABLE |
John Porto | 2b18687 | 2015-06-26 13:41:00 -0700 | [diff] [blame] | 46 | #undef X |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 47 | Encoded_Not_GPR = -1 |
| 48 | }; |
John Porto | 2b18687 | 2015-06-26 13:41:00 -0700 | [diff] [blame] | 49 | |
Andrew Scull | 57e1268 | 2015-09-16 11:30:19 -0700 | [diff] [blame] | 50 | /// An enum of XMM Registers. The enum value does match the encoding used to |
| 51 | /// binary encode register operands in instructions. |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 52 | enum XmmRegister { |
Jim Stichnoth | 5bff61c | 2015-10-28 09:26:00 -0700 | [diff] [blame] | 53 | #define X(val, encode, name, base, scratch, preserved, stackptr, frameptr, \ |
John Porto | 56958cb | 2016-01-14 09:18:18 -0800 | [diff] [blame] | 54 | sboxres, isGPR, is64, is32, is16, is8, isXmm, is64To8, is32To8, \ |
| 55 | is16To8, isTrunc8Rcvr, isAhRcvr, aliases) \ |
Jim Stichnoth | 5bff61c | 2015-10-28 09:26:00 -0700 | [diff] [blame] | 56 | Encoded_##val = encode, |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 57 | REGX8664_XMM_TABLE |
John Porto | 2b18687 | 2015-06-26 13:41:00 -0700 | [diff] [blame] | 58 | #undef X |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 59 | Encoded_Not_Xmm = -1 |
| 60 | }; |
John Porto | 2b18687 | 2015-06-26 13:41:00 -0700 | [diff] [blame] | 61 | |
Andrew Scull | 57e1268 | 2015-09-16 11:30:19 -0700 | [diff] [blame] | 62 | /// An enum of Byte Registers. The enum value does match the encoding used to |
| 63 | /// binary encode register operands in instructions. |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 64 | enum ByteRegister { |
Jim Stichnoth | 5bff61c | 2015-10-28 09:26:00 -0700 | [diff] [blame] | 65 | #define X(val, encode, name, base, scratch, preserved, stackptr, frameptr, \ |
John Porto | 56958cb | 2016-01-14 09:18:18 -0800 | [diff] [blame] | 66 | sboxres, isGPR, is64, is32, is16, is8, isXmm, is64To8, is32To8, \ |
| 67 | is16To8, isTrunc8Rcvr, isAhRcvr, aliases) \ |
Jim Stichnoth | 5bff61c | 2015-10-28 09:26:00 -0700 | [diff] [blame] | 68 | Encoded_8_##val = encode, |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 69 | REGX8664_BYTEREG_TABLE |
John Porto | 2b18687 | 2015-06-26 13:41:00 -0700 | [diff] [blame] | 70 | #undef X |
John Porto | 5d0acff | 2015-06-30 15:29:21 -0700 | [diff] [blame] | 71 | Encoded_Not_ByteReg = -1 |
| 72 | }; |
John Porto | 2b18687 | 2015-06-26 13:41:00 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
John Porto | 2b18687 | 2015-06-26 13:41:00 -0700 | [diff] [blame] | 75 | } // end of namespace Ice |
| 76 | |
| 77 | #endif // SUBZERO_SRC_ICEREGISTERSX8664_H |