OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 # define CAN_USE_THUMB_INSTRUCTIONS 1 | 72 # define CAN_USE_THUMB_INSTRUCTIONS 1 |
73 #endif | 73 #endif |
74 | 74 |
75 namespace assembler { | 75 namespace assembler { |
76 namespace arm { | 76 namespace arm { |
77 | 77 |
78 // Number of registers in normal ARM mode. | 78 // Number of registers in normal ARM mode. |
79 static const int kNumRegisters = 16; | 79 static const int kNumRegisters = 16; |
80 | 80 |
81 // VFP support. | 81 // VFP support. |
82 static const int kNumVFPRegisters = 48; | 82 static const int kNumVFPSingleRegisters = 32; |
| 83 static const int kNumVFPDoubleRegisters = 16; |
| 84 static const int kNumVFPRegisters = |
| 85 kNumVFPSingleRegisters + kNumVFPDoubleRegisters; |
83 | 86 |
84 // PC is register 15. | 87 // PC is register 15. |
85 static const int kPCRegister = 15; | 88 static const int kPCRegister = 15; |
86 static const int kNoRegister = -1; | 89 static const int kNoRegister = -1; |
87 | 90 |
88 // Defines constants and accessor classes to assemble, disassemble and | 91 // Defines constants and accessor classes to assemble, disassemble and |
89 // simulate ARM instructions. | 92 // simulate ARM instructions. |
90 // | 93 // |
91 // Section references in the code refer to the "ARM Architecture Reference | 94 // Section references in the code refer to the "ARM Architecture Reference |
92 // Manual" from July 2005 (available at http://www.arm.com/miscPDFs/14128.pdf) | 95 // Manual" from July 2005 (available at http://www.arm.com/miscPDFs/14128.pdf) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // Vn(19-16) | Vd(15-12) | Vm(3-0) | 245 // Vn(19-16) | Vd(15-12) | Vm(3-0) |
243 inline int VnField() const { return Bits(19, 16); } | 246 inline int VnField() const { return Bits(19, 16); } |
244 inline int VmField() const { return Bits(3, 0); } | 247 inline int VmField() const { return Bits(3, 0); } |
245 inline int VdField() const { return Bits(15, 12); } | 248 inline int VdField() const { return Bits(15, 12); } |
246 inline int NField() const { return Bit(7); } | 249 inline int NField() const { return Bit(7); } |
247 inline int MField() const { return Bit(5); } | 250 inline int MField() const { return Bit(5); } |
248 inline int DField() const { return Bit(22); } | 251 inline int DField() const { return Bit(22); } |
249 inline int RtField() const { return Bits(15, 12); } | 252 inline int RtField() const { return Bits(15, 12); } |
250 inline int PField() const { return Bit(24); } | 253 inline int PField() const { return Bit(24); } |
251 inline int UField() const { return Bit(23); } | 254 inline int UField() const { return Bit(23); } |
| 255 inline int Opc1Field() const { return (Bit(23) << 2) | Bits(21, 20); } |
| 256 inline int Opc2Field() const { return Bits(19, 16); } |
| 257 inline int Opc3Field() const { return Bits(7, 6); } |
| 258 inline int SzField() const { return Bit(8); } |
| 259 inline int VLField() const { return Bit(20); } |
| 260 inline int VCField() const { return Bit(8); } |
| 261 inline int VAField() const { return Bits(23, 21); } |
| 262 inline int VBField() const { return Bits(6, 5); } |
252 | 263 |
253 // Fields used in Data processing instructions | 264 // Fields used in Data processing instructions |
254 inline Opcode OpcodeField() const { | 265 inline Opcode OpcodeField() const { |
255 return static_cast<Opcode>(Bits(24, 21)); | 266 return static_cast<Opcode>(Bits(24, 21)); |
256 } | 267 } |
257 inline int SField() const { return Bit(20); } | 268 inline int SField() const { return Bit(20); } |
258 // with register | 269 // with register |
259 inline int RmField() const { return Bits(3, 0); } | 270 inline int RmField() const { return Bits(3, 0); } |
260 inline Shift ShiftField() const { return static_cast<Shift>(Bits(6, 5)); } | 271 inline Shift ShiftField() const { return static_cast<Shift>(Bits(6, 5)); } |
261 inline int RegShiftField() const { return Bit(4); } | 272 inline int RegShiftField() const { return Bit(4); } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 343 |
333 private: | 344 private: |
334 static const char* names_[kNumRegisters]; | 345 static const char* names_[kNumRegisters]; |
335 static const RegisterAlias aliases_[]; | 346 static const RegisterAlias aliases_[]; |
336 }; | 347 }; |
337 | 348 |
338 // Helper functions for converting between VFP register numbers and names. | 349 // Helper functions for converting between VFP register numbers and names. |
339 class VFPRegisters { | 350 class VFPRegisters { |
340 public: | 351 public: |
341 // Return the name of the register. | 352 // Return the name of the register. |
342 static const char* Name(int reg); | 353 static const char* Name(int reg, bool is_double); |
| 354 |
| 355 // Lookup the register number for the name provided. |
| 356 // Set flag pointed by is_double to true if register |
| 357 // is double-precision. |
| 358 static int Number(const char* name, bool* is_double); |
343 | 359 |
344 private: | 360 private: |
345 static const char* names_[kNumVFPRegisters]; | 361 static const char* names_[kNumVFPRegisters]; |
346 }; | 362 }; |
347 | 363 |
348 | 364 |
349 } } // namespace assembler::arm | 365 } } // namespace assembler::arm |
350 | 366 |
351 #endif // V8_ARM_CONSTANTS_ARM_H_ | 367 #endif // V8_ARM_CONSTANTS_ARM_H_ |
OLD | NEW |