OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef V8_COMPILER_REGISTER_CONFIGURATION_H_ |
| 6 #define V8_COMPILER_REGISTER_CONFIGURATION_H_ |
| 7 |
| 8 #include "src/base/macros.h" |
| 9 |
| 10 namespace v8 { |
| 11 namespace internal { |
| 12 |
| 13 // An architecture independent representation of the sets of registers available |
| 14 // for instruction creation. |
| 15 class RegisterConfiguration { |
| 16 public: |
| 17 // Architecture independent maxes. |
| 18 static const int kMaxGeneralRegisters = 32; |
| 19 static const int kMaxDoubleRegisters = 32; |
| 20 |
| 21 static const RegisterConfiguration* ArchDefault(); |
| 22 |
| 23 RegisterConfiguration(int num_general_registers, int num_double_registers, |
| 24 int num_allocatable_general_registers, |
| 25 int num_allocatable_double_registers, |
| 26 int num_allocatable_aliased_double_registers, |
| 27 const int* allocatable_general_codes, |
| 28 const int* allocatable_double_codes, |
| 29 char const* const* general_names, |
| 30 char const* const* double_names); |
| 31 |
| 32 int num_general_registers() const { return num_general_registers_; } |
| 33 int num_double_registers() const { return num_double_registers_; } |
| 34 int num_allocatable_general_registers() const { |
| 35 return num_allocatable_general_registers_; |
| 36 } |
| 37 int num_allocatable_double_registers() const { |
| 38 return num_allocatable_double_registers_; |
| 39 } |
| 40 // TODO(turbofan): This is a temporary work-around required because our |
| 41 // register allocator does not yet support the aliasing of single/double |
| 42 // registers on ARM. |
| 43 int num_allocatable_aliased_double_registers() const { |
| 44 return num_allocatable_aliased_double_registers_; |
| 45 } |
| 46 int32_t allocatable_general_codes_mask() const { |
| 47 return allocatable_general_codes_mask_; |
| 48 } |
| 49 int32_t allocatable_double_codes_mask() const { |
| 50 return allocatable_double_codes_mask_; |
| 51 } |
| 52 int GetAllocatableGeneralCode(int index) const { |
| 53 return allocatable_general_codes_[index]; |
| 54 } |
| 55 int GetAllocatableDoubleCode(int index) const { |
| 56 return allocatable_double_codes_[index]; |
| 57 } |
| 58 const char* GetGeneralRegisterName(int code) const { |
| 59 return general_register_names_[code]; |
| 60 } |
| 61 const char* GetDoubleRegisterName(int code) const { |
| 62 return double_register_names_[code]; |
| 63 } |
| 64 const int* allocatable_general_codes() const { |
| 65 return allocatable_general_codes_; |
| 66 } |
| 67 const int* allocatable_double_codes() const { |
| 68 return allocatable_double_codes_; |
| 69 } |
| 70 |
| 71 private: |
| 72 const int num_general_registers_; |
| 73 const int num_double_registers_; |
| 74 int num_allocatable_general_registers_; |
| 75 int num_allocatable_double_registers_; |
| 76 int num_allocatable_aliased_double_registers_; |
| 77 int32_t allocatable_general_codes_mask_; |
| 78 int32_t allocatable_double_codes_mask_; |
| 79 const int* allocatable_general_codes_; |
| 80 const int* allocatable_double_codes_; |
| 81 char const* const* general_register_names_; |
| 82 char const* const* double_register_names_; |
| 83 }; |
| 84 |
| 85 } // namespace internal |
| 86 } // namespace v8 |
| 87 |
| 88 #endif // V8_COMPILER_REGISTER_CONFIGURATION_H_ |
OLD | NEW |