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

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: Clean up ARM register functions. 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
« no previous file with comments | « src/IceInstARM32.cpp ('k') | tests_lit/assembler/arm32/vadd.ll » ('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
(...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 void assertRegisterDefined(int32_t RegNum) {
150 assert(Reg_GPR_First <= RegNum); 150 (void)RegNum;
151 assert(RegNum <= Reg_GPR_Last); 151 assert(RegNum >= 0);
152 assert(RegNum < Reg_NUM);
153 }
154
155 static inline bool isGPRegister(int32_t RegNum) {
156 assertRegisterDefined(RegNum);
157 return Table[RegNum].IsGPR;
158 }
159
160 static constexpr inline SizeT getNumGPRegs() {
161 return 0
162 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \
163 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \
164 +(isGPR)
165 REGARM32_TABLE
166 #undef X
167 ;
168 }
169
170 static inline GPRRegister getEncodedGPReg(int32_t RegNum) {
171 assert(isGPRegister(RegNum));
152 return GPRRegister(Table[RegNum].Encoding); 172 return GPRRegister(Table[RegNum].Encoding);
153 } 173 }
154 174
155 static inline GPRRegister getI64PairFirstGPRNum(int32_t RegNum) { 175 static inline GPRRegister getI64PairFirstGPRNum(int32_t RegNum) {
156 assert(Reg_I64PAIR_First <= RegNum); 176 assert(isI64RegisterPair(RegNum));
157 assert(RegNum <= Reg_I64PAIR_Last);
158 return GPRRegister(Table[RegNum].Encoding); 177 return GPRRegister(Table[RegNum].Encoding);
159 } 178 }
160 179
161 static inline GPRRegister getI64PairSecondGPRNum(int32_t RegNum) { 180 static inline GPRRegister getI64PairSecondGPRNum(int32_t RegNum) {
162 assert(Reg_I64PAIR_First <= RegNum); 181 assert(isI64RegisterPair(RegNum));
163 assert(RegNum <= Reg_I64PAIR_Last);
164 return GPRRegister(Table[RegNum].Encoding + 1); 182 return GPRRegister(Table[RegNum].Encoding + 1);
165 } 183 }
166 184
167 static inline bool isI64RegisterPair(int32_t RegNum) { 185 static inline bool isI64RegisterPair(int32_t RegNum) {
186 assertRegisterDefined(RegNum);
168 return Table[RegNum].IsI64Pair; 187 return Table[RegNum].IsI64Pair;
169 } 188 }
170 189
171 static inline bool isEncodedSReg(int32_t RegNum) { 190 static inline bool isEncodedSReg(int32_t RegNum) {
191 assertRegisterDefined(RegNum);
172 return Table[RegNum].IsFP32; 192 return Table[RegNum].IsFP32;
173 } 193 }
174 194
175 static inline SizeT getNumSRegs() { 195 static constexpr inline SizeT getNumSRegs() {
176 return Reg_SREG_Last + 1 - Reg_SREG_First; 196 return 0
197 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \
198 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \
199 +(isFP32)
200 REGARM32_TABLE
201 #undef X
202 ;
177 } 203 }
178 204
179 static inline SRegister getEncodedSReg(int32_t RegNum) { 205 static inline SRegister getEncodedSReg(int32_t RegNum) {
180 assert(Reg_SREG_First <= RegNum); 206 assert(isEncodedSReg(RegNum));
181 assert(RegNum <= Reg_SREG_Last);
182 return SRegister(Table[RegNum].Encoding); 207 return SRegister(Table[RegNum].Encoding);
183 } 208 }
184 209
210 static inline bool isEncodedDReg(int32_t RegNum) {
211 assertRegisterDefined(RegNum);
212 return Table[RegNum].IsFP64;
213 }
214
215 static constexpr inline SizeT getNumDRegs() {
216 return 0
217 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \
218 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \
219 +(isFP64)
220 REGARM32_TABLE
221 #undef X
222 ;
223 }
224
185 static inline DRegister getEncodedDReg(int32_t RegNum) { 225 static inline DRegister getEncodedDReg(int32_t RegNum) {
186 assert(Reg_DREG_First <= RegNum); 226 assert(isEncodedDReg(RegNum));
187 assert(RegNum <= Reg_DREG_Last);
188 return DRegister(Table[RegNum].Encoding); 227 return DRegister(Table[RegNum].Encoding);
189 } 228 }
190 229
230 static inline bool isEncodedQReg(int32_t RegNum) {
231 assertRegisterDefined(RegNum);
232 return Table[RegNum].IsVec128;
233 }
234
191 static inline QRegister getEncodedQReg(int32_t RegNum) { 235 static inline QRegister getEncodedQReg(int32_t RegNum) {
192 assert(Reg_QREG_First <= RegNum); 236 assert(isEncodedQReg(RegNum));
193 assert(RegNum <= Reg_QREG_Last);
194 return QRegister(Table[RegNum].Encoding); 237 return QRegister(Table[RegNum].Encoding);
195 } 238 }
196 239
197 static inline IceString getRegName(SizeT RegNum) { 240 static inline IceString getRegName(int32_t RegNum) {
198 assert(RegNum < Reg_NUM); 241 assertRegisterDefined(RegNum);
199 return Table[RegNum].Name; 242 return Table[RegNum].Name;
200 } 243 }
201 }; 244 };
202 245
203 // Extend enum RegClass with ARM32-specific register classes (if any). 246 // Extend enum RegClass with ARM32-specific register classes (if any).
204 enum RegClassARM32 : uint8_t { RCARM32_NUM = RC_Target }; 247 enum RegClassARM32 : uint8_t { RCARM32_NUM = RC_Target };
205 248
206 } // end of namespace ARM32 249 } // end of namespace ARM32
207 } // end of namespace Ice 250 } // end of namespace Ice
208 251
209 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H 252 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H
OLDNEW
« no previous file with comments | « src/IceInstARM32.cpp ('k') | tests_lit/assembler/arm32/vadd.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698