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

Side by Side Diff: src/IceRegistersARM32.h

Issue 1540653003: Add VADD instruction to the ARM integrated assembler. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 4 years, 11 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
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
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 { \ 139 { \
140 name, encode, cc_arg, scratch, preserved, stackptr, frameptr, isGPR, \ 140 name, encode, cc_arg, scratch, preserved, stackptr, frameptr, isGPR, \
141 isInt, isI64Pair, isFP32, isFP64, isVec128, \ 141 isInt, isI64Pair, isFP32, isFP64, isVec128, \
142 (SizeOf alias_init).size(), alias_init \ 142 (SizeOf alias_init).size(), alias_init \
143 } \ 143 } \
144 , 144 ,
145 REGARM32_TABLE 145 REGARM32_TABLE
146 #undef X 146 #undef X
147 }; 147 };
148 148
149 static inline GPRRegister getEncodedGPR(int32_t RegNum) { 149 static inline bool isRegisterDefined(int32_t RegNum) {
Jim Stichnoth 2016/01/06 18:39:14 This function bothers me (perhaps more than it sho
Karl 2016/01/07 00:00:35 I agree that the check is an assertion, since enum
150 assert(Reg_GPR_First <= RegNum); 150 return RegNum >= 0 && RegNum < Reg_NUM;
151 assert(RegNum <= Reg_GPR_Last); 151 }
152
153 static inline bool isGPRegister(int32_t RegNum) {
154 assert(isRegisterDefined(RegNum));
155 return Table[RegNum].IsGPR;
156 }
157
158 static inline SizeT getNumGPRegs() {
Jim Stichnoth 2016/01/06 18:39:14 Can these getNumRegs() functions be defined as con
Karl 2016/01/07 00:00:35 Done.
159 return Reg_GPR_Last + 1 - Reg_GPR_First;
160 }
161
162 static inline GPRRegister getEncodedGPReg(int32_t RegNum) {
163 assert(isGPRegister(RegNum));
152 return GPRRegister(Table[RegNum].Encoding); 164 return GPRRegister(Table[RegNum].Encoding);
153 } 165 }
154 166
155 static inline GPRRegister getI64PairFirstGPRNum(int32_t RegNum) { 167 static inline GPRRegister getI64PairFirstGPRNum(int32_t RegNum) {
156 assert(Reg_I64PAIR_First <= RegNum); 168 assert(isI64RegisterPair(RegNum));
157 assert(RegNum <= Reg_I64PAIR_Last);
158 return GPRRegister(Table[RegNum].Encoding); 169 return GPRRegister(Table[RegNum].Encoding);
159 } 170 }
160 171
161 static inline GPRRegister getI64PairSecondGPRNum(int32_t RegNum) { 172 static inline GPRRegister getI64PairSecondGPRNum(int32_t RegNum) {
162 assert(Reg_I64PAIR_First <= RegNum); 173 assert(isI64RegisterPair(RegNum));
163 assert(RegNum <= Reg_I64PAIR_Last);
164 return GPRRegister(Table[RegNum].Encoding + 1); 174 return GPRRegister(Table[RegNum].Encoding + 1);
165 } 175 }
166 176
167 static inline bool isI64RegisterPair(int32_t RegNum) { 177 static inline bool isI64RegisterPair(int32_t RegNum) {
178 assert(isRegisterDefined(RegNum));
168 return Table[RegNum].IsI64Pair; 179 return Table[RegNum].IsI64Pair;
169 } 180 }
170 181
171 static inline bool isEncodedSReg(int32_t RegNum) { 182 static inline bool isEncodedSReg(int32_t RegNum) {
183 assert(isRegisterDefined(RegNum));
172 return Table[RegNum].IsFP32; 184 return Table[RegNum].IsFP32;
173 } 185 }
174 186
175 static inline SizeT getNumSRegs() { 187 static inline SizeT getNumSRegs() {
176 return Reg_SREG_Last + 1 - Reg_SREG_First; 188 return Reg_SREG_Last + 1 - Reg_SREG_First;
Jim Stichnoth 2016/01/06 18:39:14 Have I mentioned that I ***REALLY*** dislike assum
Karl 2016/01/07 00:00:35 Changed form of count functions to use REGARM32_TA
177 } 189 }
178 190
179 static inline SRegister getEncodedSReg(int32_t RegNum) { 191 static inline SRegister getEncodedSReg(int32_t RegNum) {
180 assert(Reg_SREG_First <= RegNum); 192 assert(isEncodedSReg(RegNum));
181 assert(RegNum <= Reg_SREG_Last);
182 return SRegister(Table[RegNum].Encoding); 193 return SRegister(Table[RegNum].Encoding);
183 } 194 }
184 195
196 // Note: D registers are listed from largest to smallest.
Jim Stichnoth 2016/01/06 18:39:14 Move this down to getNumDRegs(), assuming it's sti
Karl 2016/01/07 00:00:35 Removed. No longer applicable.
197
198 static inline bool isEncodedDReg(int32_t RegNum) {
199 assert(isRegisterDefined(RegNum));
200 return Table[RegNum].IsFP64;
201 }
202
203 static inline SizeT getNumDRegs() {
204 return Reg_DREG_First + 1 - Reg_DREG_Last;
205 }
206
185 static inline DRegister getEncodedDReg(int32_t RegNum) { 207 static inline DRegister getEncodedDReg(int32_t RegNum) {
186 assert(Reg_DREG_First <= RegNum); 208 assert(isEncodedDReg(RegNum));
187 assert(RegNum <= Reg_DREG_Last);
188 return DRegister(Table[RegNum].Encoding); 209 return DRegister(Table[RegNum].Encoding);
189 } 210 }
190 211
212 static inline bool isEncodedQReg(int32_t RegNum) {
213 assert(isRegisterDefined(RegNum));
214 return Table[RegNum].IsVec128;
215 }
216
191 static inline QRegister getEncodedQReg(int32_t RegNum) { 217 static inline QRegister getEncodedQReg(int32_t RegNum) {
192 assert(Reg_QREG_First <= RegNum); 218 assert(isEncodedQReg(RegNum));
193 assert(RegNum <= Reg_QREG_Last);
194 return QRegister(Table[RegNum].Encoding); 219 return QRegister(Table[RegNum].Encoding);
195 } 220 }
196 221
197 static inline IceString getRegName(SizeT RegNum) { 222 static inline IceString getRegName(int32_t RegNum) {
198 assert(RegNum < Reg_NUM); 223 assert(isRegisterDefined(RegNum));
199 return Table[RegNum].Name; 224 return Table[RegNum].Name;
200 } 225 }
201 }; 226 };
202 227
203 // Extend enum RegClass with ARM32-specific register classes (if any). 228 // Extend enum RegClass with ARM32-specific register classes (if any).
204 enum RegClassARM32 : uint8_t { RCARM32_NUM = RC_Target }; 229 enum RegClassARM32 : uint8_t { RCARM32_NUM = RC_Target };
205 230
206 } // end of namespace ARM32 231 } // end of namespace ARM32
207 } // end of namespace Ice 232 } // end of namespace Ice
208 233
209 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H 234 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698