blob: 692d2f9e30ac6edadf4232a6728f80deeae7596b [file] [log] [blame]
John Porto2b186872015-06-26 13:41:00 -07001//===- 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 Scull9612d322015-07-06 14:53:25 -07009///
10/// \file
Jim Stichnoth92a6e5b2015-12-02 16:52:44 -080011/// \brief Declares the registers and their encodings for x86-64.
Andrew Scull9612d322015-07-06 14:53:25 -070012///
John Porto2b186872015-06-26 13:41:00 -070013//===----------------------------------------------------------------------===//
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
22namespace Ice {
23
John Porto5d0acff2015-06-30 15:29:21 -070024class RegX8664 {
25public:
Andrew Scull57e12682015-09-16 11:30:19 -070026 /// An enum of every register. The enum value may not match the encoding used
27 /// to binary encode register operands in instructions.
John Porto5d0acff2015-06-30 15:29:21 -070028 enum AllRegisters {
Jim Stichnoth5bff61c2015-10-28 09:26:00 -070029#define X(val, encode, name, base, scratch, preserved, stackptr, frameptr, \
John Porto56958cb2016-01-14 09:18:18 -080030 sboxres, isGPR, is64, is32, is16, is8, isXmm, is64To8, is32To8, \
31 is16To8, isTrunc8Rcvr, isAhRcvr, aliases) \
John Porto2b186872015-06-26 13:41:00 -070032 val,
John Porto5d0acff2015-06-30 15:29:21 -070033 REGX8664_TABLE
John Porto2b186872015-06-26 13:41:00 -070034#undef X
Jim Stichnoth5bff61c2015-10-28 09:26:00 -070035 Reg_NUM
John Porto5d0acff2015-06-30 15:29:21 -070036 };
John Porto2b186872015-06-26 13:41:00 -070037
Andrew Scull57e12682015-09-16 11:30:19 -070038 /// An enum of GPR Registers. The enum value does match the encoding used to
39 /// binary encode register operands in instructions.
John Porto5d0acff2015-06-30 15:29:21 -070040 enum GPRRegister {
Jim Stichnoth5bff61c2015-10-28 09:26:00 -070041#define X(val, encode, name, base, scratch, preserved, stackptr, frameptr, \
John Porto56958cb2016-01-14 09:18:18 -080042 sboxres, isGPR, is64, is32, is16, is8, isXmm, is64To8, is32To8, \
43 is16To8, isTrunc8Rcvr, isAhRcvr, aliases) \
Jim Stichnoth5bff61c2015-10-28 09:26:00 -070044 Encoded_##val = encode,
John Porto5d0acff2015-06-30 15:29:21 -070045 REGX8664_GPR_TABLE
John Porto2b186872015-06-26 13:41:00 -070046#undef X
John Porto5d0acff2015-06-30 15:29:21 -070047 Encoded_Not_GPR = -1
48 };
John Porto2b186872015-06-26 13:41:00 -070049
Andrew Scull57e12682015-09-16 11:30:19 -070050 /// An enum of XMM Registers. The enum value does match the encoding used to
51 /// binary encode register operands in instructions.
John Porto5d0acff2015-06-30 15:29:21 -070052 enum XmmRegister {
Jim Stichnoth5bff61c2015-10-28 09:26:00 -070053#define X(val, encode, name, base, scratch, preserved, stackptr, frameptr, \
John Porto56958cb2016-01-14 09:18:18 -080054 sboxres, isGPR, is64, is32, is16, is8, isXmm, is64To8, is32To8, \
55 is16To8, isTrunc8Rcvr, isAhRcvr, aliases) \
Jim Stichnoth5bff61c2015-10-28 09:26:00 -070056 Encoded_##val = encode,
John Porto5d0acff2015-06-30 15:29:21 -070057 REGX8664_XMM_TABLE
John Porto2b186872015-06-26 13:41:00 -070058#undef X
John Porto5d0acff2015-06-30 15:29:21 -070059 Encoded_Not_Xmm = -1
60 };
John Porto2b186872015-06-26 13:41:00 -070061
Andrew Scull57e12682015-09-16 11:30:19 -070062 /// An enum of Byte Registers. The enum value does match the encoding used to
63 /// binary encode register operands in instructions.
John Porto5d0acff2015-06-30 15:29:21 -070064 enum ByteRegister {
Jim Stichnoth5bff61c2015-10-28 09:26:00 -070065#define X(val, encode, name, base, scratch, preserved, stackptr, frameptr, \
John Porto56958cb2016-01-14 09:18:18 -080066 sboxres, isGPR, is64, is32, is16, is8, isXmm, is64To8, is32To8, \
67 is16To8, isTrunc8Rcvr, isAhRcvr, aliases) \
Jim Stichnoth5bff61c2015-10-28 09:26:00 -070068 Encoded_8_##val = encode,
John Porto5d0acff2015-06-30 15:29:21 -070069 REGX8664_BYTEREG_TABLE
John Porto2b186872015-06-26 13:41:00 -070070#undef X
John Porto5d0acff2015-06-30 15:29:21 -070071 Encoded_Not_ByteReg = -1
72 };
John Porto2b186872015-06-26 13:41:00 -070073};
74
John Porto2b186872015-06-26 13:41:00 -070075} // end of namespace Ice
76
77#endif // SUBZERO_SRC_ICEREGISTERSX8664_H