Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: src/IceRegistersX8632.h

Issue 582113003: Lift register and condition code enums out into their own file. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: add rest of codes Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceInstX8632.def ('k') | src/IceTargetLoweringX8632.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 //===- subzero/src/IceRegistersX8632.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 // This file declares the registers and their encodings for x86-32.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef SUBZERO_SRC_ICEREGISTERSX8632_H
15 #define SUBZERO_SRC_ICEREGISTERSX8632_H
16
17 #include "IceDefs.h"
18 #include "IceInstX8632.def"
19
20 namespace Ice {
21
22 class RegX8632 {
23 public:
24 // An enum of every register. The enum value may not match the encoding
25 // used to binary encode register operands in instructions.
26 enum AllRegisters {
27 #define X(val, encode, name, name16, name8, scratch, preserved, stackptr, \
28 frameptr, isI8, isInt, isFP) \
29 val,
Jim Stichnoth 2014/09/18 21:16:35 Just so I understand this correctly, the RegX8632:
jvoung (off chromium) 2014/09/19 00:52:47 Yes, that's right. I'm currently just letting the
30 REGX8632_TABLE
31 #undef X
32 Reg_NUM
33 };
34
35 // An enum of GPR Registers. The enum value does match encoding used
36 // to binary encode register operands in instructions.
37 enum GPRRegister {
38 #define X(val, encode, name, name16, name8, scratch, preserved, stackptr, \
39 frameptr, isI8, isInt, isFP) \
40 Encoded_##val encode,
41 REGX8632_GPR_TABLE
42 #undef X
43 };
44
45 // An enum of XMM Registers. The enum value does match encoding used
46 // to binary encode register operands in instructions.
47 enum XmmRegister {
48 #define X(val, encode, name, name16, name8, scratch, preserved, stackptr, \
49 frameptr, isI8, isInt, isFP) \
50 Encoded_##val encode,
51 REGX8632_XMM_TABLE
52 #undef X
53 };
54
55 // An enum of Byte Registers. The enum value does match encoding used
56 // to binary encode register operands in instructions.
57 enum ByteRegister {
58 #define X(val, encode) Encoded_##val encode,
59 REGX8632_BYTEREG_TABLE
60 #undef X
61 };
62
63 static GPRRegister getEncodedGPR(int32_t RegNum) {
64 assert(Reg_eax <= RegNum && RegNum <= Reg_edi);
Jim Stichnoth 2014/09/18 21:16:35 Would it be practical to use something like Reg_GP
jvoung (off chromium) 2014/09/19 00:52:47 Done (subtraction, and adding First/Last). It onl
65 return GPRRegister(RegNum);
66 }
67
68 static XmmRegister getEncodedXmm(int32_t RegNum) {
69 assert(Reg_xmm0 <= RegNum && RegNum <= Reg_xmm7);
70 return XmmRegister(RegNum - Reg_xmm0);
71 }
72
73 static ByteRegister getEncodedByteReg(int32_t RegNum) {
74 assert(RegNum == Reg_ah || (Reg_eax <= RegNum && RegNum <= Reg_ebx));
75 if (RegNum == Reg_ah)
76 return Encoded_Reg_ah;
77 return ByteRegister(RegNum);
78 }
79 };
80
81 } // end of namespace Ice
82
83 #endif // SUBZERO_SRC_ICEREGISTERSX8632_H
OLDNEW
« no previous file with comments | « src/IceInstX8632.def ('k') | src/IceTargetLoweringX8632.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698