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

Side by Side Diff: runtime/vm/constants_arm.h

Issue 269443002: Only assume that we have 32 D registers on ARMv7-a. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_CONSTANTS_ARM_H_ 5 #ifndef VM_CONSTANTS_ARM_H_
6 #define VM_CONSTANTS_ARM_H_ 6 #define VM_CONSTANTS_ARM_H_
7 7
8 #include "platform/globals.h"
8 #include "platform/assert.h" 9 #include "platform/assert.h"
9 10
10 namespace dart { 11 namespace dart {
11 12
12 // We support both VFPv3-D16 and VFPv3-D32 profiles, but currently only one at 13 // We support both VFPv3-D16 and VFPv3-D32 profiles, but currently only one at
13 // a time. 14 // a time.
14 // TODO(zra): Detect number of registers at runtime by querying /proc/cpuinfo. 15 #if defined(__ARM_ARCH_7A__)
15 #define VFPv3_D32 16 #define VFPv3_D32
17 #elif defined(TARGET_ARCH_ARM) && !defined(HOST_ARCH_ARM)
18 // If we're running in the simulator, use all 32.
19 #define VFPv3_D32
20 #else
21 #define VFPv3_D16
22 #endif
16 #if defined(VFPv3_D16) == defined(VFPv3_D32) 23 #if defined(VFPv3_D16) == defined(VFPv3_D32)
17 #error "Exactly one of VFPv3_D16 or VFPv3_D32 can be defined at a time." 24 #error "Exactly one of VFPv3_D16 or VFPv3_D32 can be defined at a time."
18 #endif 25 #endif
19 26
20 27
21 enum Register { 28 enum Register {
29 kNoRegister = -1,
22 kFirstFreeCpuRegister = 0, 30 kFirstFreeCpuRegister = 0,
23 R0 = 0, 31 R0 = 0,
24 R1 = 1, 32 R1 = 1,
25 R2 = 2, 33 R2 = 2,
26 R3 = 3, 34 R3 = 3,
27 R4 = 4, 35 R4 = 4,
28 R5 = 5, 36 R5 = 5,
29 R6 = 6, 37 R6 = 6,
30 R7 = 7, 38 R7 = 7,
31 R8 = 8, 39 R8 = 8,
32 kLastFreeCpuRegister = 8, 40 kLastFreeCpuRegister = 8,
33 R9 = 9, 41 R9 = 9,
34 R10 = 10, 42 R10 = 10,
35 R11 = 11, 43 R11 = 11,
36 R12 = 12, 44 R12 = 12,
37 R13 = 13, 45 R13 = 13,
38 R14 = 14, 46 R14 = 14,
39 R15 = 15, 47 R15 = 15,
40 FP = 11, 48 FP = 11,
41 IP = 12, 49 IP = 12,
42 SP = 13, 50 SP = 13,
43 LR = 14, 51 LR = 14,
44 PC = 15, 52 PC = 15,
45 kNumberOfCpuRegisters = 16, 53 kNumberOfCpuRegisters = 16,
46 kNoRegister = -1,
47 }; 54 };
48 55
49 56
50 // Values for single-precision floating point registers. 57 // Values for single-precision floating point registers.
51 enum SRegister { 58 enum SRegister {
59 kNoSRegister = -1,
52 S0 = 0, 60 S0 = 0,
53 S1 = 1, 61 S1 = 1,
54 S2 = 2, 62 S2 = 2,
55 S3 = 3, 63 S3 = 3,
56 S4 = 4, 64 S4 = 4,
57 S5 = 5, 65 S5 = 5,
58 S6 = 6, 66 S6 = 6,
59 S7 = 7, 67 S7 = 7,
60 S8 = 8, 68 S8 = 8,
61 S9 = 9, 69 S9 = 9,
(...skipping 13 matching lines...) Expand all
75 S23 = 23, 83 S23 = 23,
76 S24 = 24, 84 S24 = 24,
77 S25 = 25, 85 S25 = 25,
78 S26 = 26, 86 S26 = 26,
79 S27 = 27, 87 S27 = 27,
80 S28 = 28, 88 S28 = 28,
81 S29 = 29, 89 S29 = 29,
82 S30 = 30, 90 S30 = 30,
83 S31 = 31, 91 S31 = 31,
84 kNumberOfSRegisters = 32, 92 kNumberOfSRegisters = 32,
85 kNoSRegister = -1,
86 }; 93 };
87 94
88 95
89 // Values for double-precision floating point registers. 96 // Values for double-precision floating point registers.
90 enum DRegister { 97 enum DRegister {
98 kNoDRegister = -1,
91 D0 = 0, 99 D0 = 0,
92 D1 = 1, 100 D1 = 1,
93 D2 = 2, 101 D2 = 2,
94 D3 = 3, 102 D3 = 3,
95 D4 = 4, 103 D4 = 4,
96 D5 = 5, 104 D5 = 5,
97 D6 = 6, 105 D6 = 6,
98 D7 = 7, 106 D7 = 7,
99 D8 = 8, 107 D8 = 8,
100 D9 = 9, 108 D9 = 9,
101 D10 = 10, 109 D10 = 10,
102 D11 = 11, 110 D11 = 11,
103 D12 = 12, 111 D12 = 12,
104 D13 = 13, 112 D13 = 13,
105 D14 = 14, 113 D14 = 14,
106 D15 = 15, 114 D15 = 15,
107 #ifdef VFPv3_D16 115 #ifdef VFPv3_D16
108 kNumberOfDRegisters = 16, 116 kNumberOfDRegisters = 16,
117 // Leaving these defined, but marking them as kNoDRegister to avoid polluting
118 // other parts of the code with #ifdef's. Instead, query kNumberOfDRegisters
119 // to see which registers are valid.
120 D16 = kNoDRegister,
121 D17 = kNoDRegister,
122 D18 = kNoDRegister,
123 D19 = kNoDRegister,
124 D20 = kNoDRegister,
125 D21 = kNoDRegister,
126 D22 = kNoDRegister,
127 D23 = kNoDRegister,
128 D24 = kNoDRegister,
129 D25 = kNoDRegister,
130 D26 = kNoDRegister,
131 D27 = kNoDRegister,
132 D28 = kNoDRegister,
133 D29 = kNoDRegister,
134 D30 = kNoDRegister,
135 D31 = kNoDRegister,
109 #else 136 #else
110 D16 = 16, 137 D16 = 16,
111 D17 = 17, 138 D17 = 17,
112 D18 = 18, 139 D18 = 18,
113 D19 = 19, 140 D19 = 19,
114 D20 = 20, 141 D20 = 20,
115 D21 = 21, 142 D21 = 21,
116 D22 = 22, 143 D22 = 22,
117 D23 = 23, 144 D23 = 23,
118 D24 = 24, 145 D24 = 24,
119 D25 = 25, 146 D25 = 25,
120 D26 = 26, 147 D26 = 26,
121 D27 = 27, 148 D27 = 27,
122 D28 = 28, 149 D28 = 28,
123 D29 = 29, 150 D29 = 29,
124 D30 = 30, 151 D30 = 30,
125 D31 = 31, 152 D31 = 31,
126 kNumberOfDRegisters = 32, 153 kNumberOfDRegisters = 32,
127 #endif 154 #endif
128 kNumberOfOverlappingDRegisters = 16, 155 kNumberOfOverlappingDRegisters = 16,
129 kNoDRegister = -1,
130 }; 156 };
131 157
132 158
133 enum QRegister { 159 enum QRegister {
160 kNoQRegister = -1,
134 Q0 = 0, 161 Q0 = 0,
135 Q1 = 1, 162 Q1 = 1,
136 Q2 = 2, 163 Q2 = 2,
137 Q3 = 3, 164 Q3 = 3,
138 Q4 = 4, 165 Q4 = 4,
139 Q5 = 5, 166 Q5 = 5,
140 Q6 = 6, 167 Q6 = 6,
141 Q7 = 7, 168 Q7 = 7,
142 #ifdef VFPv3_D16 169 #ifdef VFPv3_D16
143 kNumberOfQRegisters = 8, 170 kNumberOfQRegisters = 8,
171 Q8 = kNoQRegister,
172 Q9 = kNoQRegister,
173 Q10 = kNoQRegister,
174 Q11 = kNoQRegister,
175 Q12 = kNoQRegister,
176 Q13 = kNoQRegister,
177 Q14 = kNoQRegister,
178 Q15 = kNoQRegister,
144 #else 179 #else
145 Q8 = 8, 180 Q8 = 8,
146 Q9 = 9, 181 Q9 = 9,
147 Q10 = 10, 182 Q10 = 10,
148 Q11 = 11, 183 Q11 = 11,
149 Q12 = 12, 184 Q12 = 12,
150 Q13 = 13, 185 Q13 = 13,
151 Q14 = 14, 186 Q14 = 14,
152 Q15 = 15, 187 Q15 = 15,
153 kNumberOfQRegisters = 16, 188 kNumberOfQRegisters = 16,
154 #endif 189 #endif
155 kNoQRegister = -1,
156 }; 190 };
157 191
158 192
159 static inline DRegister EvenDRegisterOf(QRegister q) { 193 static inline DRegister EvenDRegisterOf(QRegister q) {
160 return static_cast<DRegister>(q * 2); 194 return static_cast<DRegister>(q * 2);
161 } 195 }
162 196
163 static inline DRegister OddDRegisterOf(QRegister q) { 197 static inline DRegister OddDRegisterOf(QRegister q) {
164 return static_cast<DRegister>((q * 2) + 1); 198 return static_cast<DRegister>((q * 2) + 1);
165 } 199 }
166 200
167 201
168 static inline SRegister EvenSRegisterOf(DRegister d) { 202 static inline SRegister EvenSRegisterOf(DRegister d) {
169 #ifdef VFPv3_D32 203 #if defined(VFPv3_D32)
204 // When we have 32 D registers, the S registers only overlap the first 16.
205 // That is, there are only 32 S registers.
170 ASSERT(d < D16); 206 ASSERT(d < D16);
171 #endif 207 #endif
172 return static_cast<SRegister>(d * 2); 208 return static_cast<SRegister>(d * 2);
173 } 209 }
174 210
175 static inline SRegister OddSRegisterOf(DRegister d) { 211 static inline SRegister OddSRegisterOf(DRegister d) {
176 #ifdef VFPv3_D32 212 #if defined(VFPv3_D32)
177 ASSERT(d < D16); 213 ASSERT(d < D16);
178 #endif 214 #endif
179 return static_cast<SRegister>((d * 2) + 1); 215 return static_cast<SRegister>((d * 2) + 1);
180 } 216 }
181 217
182 218
183 // Register aliases for floating point scratch registers. 219 // Register aliases for floating point scratch registers.
184 const QRegister QTMP = Q7; // Overlaps with DTMP, STMP. 220 const QRegister QTMP = Q7; // Overlaps with DTMP, STMP.
185 const DRegister DTMP = EvenDRegisterOf(QTMP); // Overlaps with STMP. 221 const DRegister DTMP = EvenDRegisterOf(QTMP); // Overlaps with STMP.
186 const SRegister STMP = EvenSRegisterOf(DTMP); 222 const SRegister STMP = EvenSRegisterOf(DTMP);
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } 695 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); }
660 696
661 private: 697 private:
662 DISALLOW_ALLOCATION(); 698 DISALLOW_ALLOCATION();
663 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); 699 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr);
664 }; 700 };
665 701
666 } // namespace dart 702 } // namespace dart
667 703
668 #endif // VM_CONSTANTS_ARM_H_ 704 #endif // VM_CONSTANTS_ARM_H_
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698