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

Side by Side Diff: src/IceRegistersARM32.h

Issue 1266263003: Add the ARM32 FP register table entries, simple arith, and args. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: format more Created 5 years, 4 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/IceInstARM32.def ('k') | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceRegistersARM32.h - Register information ---*- C++ -*-===// 1 //===- subzero/src/IceRegistersARM32.h - Register information ---*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
11 /// This file declares the registers and their encodings for ARM32. 11 /// This file declares the registers and their encodings for ARM32.
12 /// 12 ///
13 //===----------------------------------------------------------------------===// 13 //===----------------------------------------------------------------------===//
14 14
15 #ifndef SUBZERO_SRC_ICEREGISTERSARM32_H 15 #ifndef SUBZERO_SRC_ICEREGISTERSARM32_H
16 #define SUBZERO_SRC_ICEREGISTERSARM32_H 16 #define SUBZERO_SRC_ICEREGISTERSARM32_H
17 17
18 #include "IceDefs.h" 18 #include "IceDefs.h"
19 #include "IceInstARM32.def" 19 #include "IceInstARM32.def"
20 #include "IceTypes.h" 20 #include "IceTypes.h"
21 21
22 namespace Ice { 22 namespace Ice {
23 23
24 namespace RegARM32 { 24 class RegARM32 {
25 public:
26 /// An enum of every register. The enum value may not match the encoding
27 /// used to binary encode register operands in instructions.
28 enum AllRegisters {
29 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \
30 isFP32, isFP64, isVec128) \
31 val,
32 REGARM32_TABLE
33 #undef X
34 Reg_NUM,
35 #define X(val, init) val init,
36 REGARM32_TABLE_BOUNDS
37 #undef X
38 };
25 39
26 /// An enum of every register. The enum value may not match the encoding 40 /// An enum of GPR Registers. The enum value does match the encoding used
27 /// used to binary encode register operands in instructions. 41 /// to binary encode register operands in instructions.
28 enum AllRegisters { 42 enum GPRRegister {
29 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ 43 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \
30 isFP) \ 44 isFP32, isFP64, isVec128) \
31 val, 45 Encoded_##val = encode,
32 REGARM32_TABLE 46 REGARM32_GPR_TABLE
33 #undef X 47 #undef X
34 Reg_NUM, 48 Encoded_Not_GPR = -1
35 #define X(val, init) val init, 49 };
36 REGARM32_TABLE_BOUNDS 50
51 /// An enum of FP32 S-Registers. The enum value does match the encoding used
52 /// to binary encode register operands in instructions.
53 enum SRegister {
54 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \
55 isFP32, isFP64, isVec128) \
56 Encoded_##val = encode,
57 REGARM32_FP32_TABLE
37 #undef X 58 #undef X
59 Encoded_Not_SReg = -1
60 };
61
62 /// An enum of FP64 D-Registers. The enum value does match the encoding used
63 /// to binary encode register operands in instructions.
64 enum DRegister {
65 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \
66 isFP32, isFP64, isVec128) \
67 Encoded_##val = encode,
68 REGARM32_FP64_TABLE
69 #undef X
70 Encoded_Not_DReg = -1
71 };
72
73 /// An enum of 128-bit Q-Registers. The enum value does match the encoding
74 /// used to binary encode register operands in instructions.
75 enum QRegister {
76 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \
77 isFP32, isFP64, isVec128) \
78 Encoded_##val = encode,
79 REGARM32_VEC128_TABLE
80 #undef X
81 Encoded_Not_QReg = -1
82 };
83
84 static inline GPRRegister getEncodedGPR(int32_t RegNum) {
85 assert(Reg_GPR_First <= RegNum);
86 assert(RegNum <= Reg_GPR_Last);
87 return GPRRegister(RegNum - Reg_GPR_First);
88 }
89
90 static inline SRegister getEncodedSReg(int32_t RegNum) {
91 assert(Reg_SREG_First <= RegNum);
92 assert(RegNum <= Reg_SREG_Last);
93 return SRegister(RegNum - Reg_SREG_First);
94 }
95
96 static inline DRegister getEncodedDReg(int32_t RegNum) {
97 assert(Reg_DREG_First <= RegNum);
98 assert(RegNum <= Reg_DREG_Last);
99 return DRegister(RegNum - Reg_DREG_First);
100 }
101
102 static inline QRegister getEncodedQReg(int32_t RegNum) {
103 assert(Reg_QREG_First <= RegNum);
104 assert(RegNum <= Reg_QREG_Last);
105 return QRegister(RegNum - Reg_QREG_First);
106 }
38 }; 107 };
39 108
40 /// An enum of GPR Registers. The enum value does match the encoding used
41 /// to binary encode register operands in instructions.
42 enum GPRRegister {
43 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \
44 isFP) \
45 Encoded_##val encode,
46 REGARM32_GPR_TABLE
47 #undef X
48 Encoded_Not_GPR = -1
49 };
50
51 // TODO(jvoung): Floating point and vector registers...
52 // Need to model overlap and difference in encoding too.
53
54 static inline GPRRegister getEncodedGPR(int32_t RegNum) {
55 assert(Reg_GPR_First <= RegNum && RegNum <= Reg_GPR_Last);
56 return GPRRegister(RegNum - Reg_GPR_First);
57 }
58
59 } // end of namespace RegARM32
60
61 } // end of namespace Ice 109 } // end of namespace Ice
62 110
63 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H 111 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H
OLDNEW
« no previous file with comments | « src/IceInstARM32.def ('k') | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698