OLD | NEW |
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_MIPS_H_ | 5 #ifndef VM_CONSTANTS_MIPS_H_ |
6 #define VM_CONSTANTS_MIPS_H_ | 6 #define VM_CONSTANTS_MIPS_H_ |
7 | 7 |
8 namespace dart { | 8 namespace dart { |
9 | 9 |
10 enum Register { | 10 enum Register { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 kSaShift = 6, | 167 kSaShift = 6, |
168 kSaBits = 5, | 168 kSaBits = 5, |
169 kFunctionShift = 0, | 169 kFunctionShift = 0, |
170 kFunctionBits = 6, | 170 kFunctionBits = 6, |
171 kImmShift = 0, | 171 kImmShift = 0, |
172 kImmBits = 16, | 172 kImmBits = 16, |
173 kInstrShift = 0, | 173 kInstrShift = 0, |
174 kInstrBits = 26, | 174 kInstrBits = 26, |
175 kBreakCodeShift = 5, | 175 kBreakCodeShift = 5, |
176 kBreakCodeBits = 20, | 176 kBreakCodeBits = 20, |
| 177 |
| 178 kBranchOffsetMask = 0x0000ffff, |
177 }; | 179 }; |
178 | 180 |
179 | 181 |
180 enum Opcode { | 182 enum Opcode { |
181 SPECIAL = 0, | 183 SPECIAL = 0, |
182 REGIMM = 1, | 184 REGIMM = 1, |
183 J = 2, | 185 J = 2, |
184 JAL = 3, | 186 JAL = 3, |
185 BEQ = 4, | 187 BEQ = 4, |
186 BNE = 5, | 188 BNE = 5, |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 } | 361 } |
360 | 362 |
361 inline int32_t BreakCodeField() const { | 363 inline int32_t BreakCodeField() const { |
362 return Bits(kBreakCodeShift, kBreakCodeBits); | 364 return Bits(kBreakCodeShift, kBreakCodeBits); |
363 } | 365 } |
364 | 366 |
365 inline SpecialFunction FunctionField() const { | 367 inline SpecialFunction FunctionField() const { |
366 return static_cast<SpecialFunction>(Bits(kFunctionShift, kFunctionBits)); | 368 return static_cast<SpecialFunction>(Bits(kFunctionShift, kFunctionBits)); |
367 } | 369 } |
368 | 370 |
| 371 inline RtRegImm RegImmFnField() const { |
| 372 return static_cast<RtRegImm>(Bits(kRtShift, kRtBits)); |
| 373 } |
| 374 |
369 inline bool IsBreakPoint() { | 375 inline bool IsBreakPoint() { |
370 return (OpcodeField() == SPECIAL) && (FunctionField() == BREAK); | 376 return (OpcodeField() == SPECIAL) && (FunctionField() == BREAK); |
371 } | 377 } |
372 | 378 |
373 // Instructions are read out of a code stream. The only way to get a | 379 // Instructions are read out of a code stream. The only way to get a |
374 // reference to an instruction is to convert a pc. There is no way | 380 // reference to an instruction is to convert a pc. There is no way |
375 // to allocate or create instances of class Instr. | 381 // to allocate or create instances of class Instr. |
376 // Use the At(pc) function to create references to Instr. | 382 // Use the At(pc) function to create references to Instr. |
377 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } | 383 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } |
378 | 384 |
379 private: | 385 private: |
380 DISALLOW_ALLOCATION(); | 386 DISALLOW_ALLOCATION(); |
381 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 387 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
382 }; | 388 }; |
383 | 389 |
384 } // namespace dart | 390 } // namespace dart |
385 | 391 |
386 #endif // VM_CONSTANTS_MIPS_H_ | 392 #endif // VM_CONSTANTS_MIPS_H_ |
OLD | NEW |