• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// \brief Declares the registers and their encodings for x86-64.
12 ///
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 
24 class RegX8664 {
25 public:
26   /// An enum of every register. The enum value may not match the encoding used
27   /// to binary encode register operands in instructions.
28   enum AllRegisters {
29 #define X(val, encode, name, base, scratch, preserved, stackptr, frameptr,     \
30           sboxres, isGPR, is64, is32, is16, is8, isXmm, is64To8, is32To8,      \
31           is16To8, isTrunc8Rcvr, isAhRcvr, aliases)                            \
32   val,
33     REGX8664_TABLE
34 #undef X
35         Reg_NUM
36   };
37 
38   /// An enum of GPR Registers. The enum value does match the encoding used to
39   /// binary encode register operands in instructions.
40   enum GPRRegister {
41 #define X(val, encode, name, base, scratch, preserved, stackptr, frameptr,     \
42           sboxres, isGPR, is64, is32, is16, is8, isXmm, is64To8, is32To8,      \
43           is16To8, isTrunc8Rcvr, isAhRcvr, aliases)                            \
44   Encoded_##val = encode,
45     REGX8664_GPR_TABLE
46 #undef X
47         Encoded_Not_GPR = -1
48   };
49 
50   /// An enum of XMM Registers. The enum value does match the encoding used to
51   /// binary encode register operands in instructions.
52   enum XmmRegister {
53 #define X(val, encode, name, base, scratch, preserved, stackptr, frameptr,     \
54           sboxres, isGPR, is64, is32, is16, is8, isXmm, is64To8, is32To8,      \
55           is16To8, isTrunc8Rcvr, isAhRcvr, aliases)                            \
56   Encoded_##val = encode,
57     REGX8664_XMM_TABLE
58 #undef X
59         Encoded_Not_Xmm = -1
60   };
61 
62   /// An enum of Byte Registers. The enum value does match the encoding used to
63   /// binary encode register operands in instructions.
64   enum ByteRegister {
65 #define X(val, encode, name, base, scratch, preserved, stackptr, frameptr,     \
66           sboxres, isGPR, is64, is32, is16, is8, isXmm, is64To8, is32To8,      \
67           is16To8, isTrunc8Rcvr, isAhRcvr, aliases)                            \
68   Encoded_8_##val = encode,
69     REGX8664_BYTEREG_TABLE
70 #undef X
71         Encoded_Not_ByteReg = -1
72   };
73 };
74 
75 } // end of namespace Ice
76 
77 #endif // SUBZERO_SRC_ICEREGISTERSX8664_H
78