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 #include "src/compiler/register-configuration.h" |
| 6 #include "src/macro-assembler.h" |
| 7 |
| 8 namespace v8 { |
| 9 namespace internal { |
| 10 namespace compiler { |
| 11 |
| 12 namespace { |
| 13 |
| 14 STATIC_ASSERT(RegisterConfiguration::kMaxGeneralRegisters >= |
| 15 Register::kNumRegisters); |
| 16 STATIC_ASSERT(RegisterConfiguration::kMaxDoubleRegisters >= |
| 17 DoubleRegister::kMaxNumRegisters); |
| 18 |
| 19 class ArchDefaultRegisterConfiguration : public RegisterConfiguration { |
| 20 public: |
| 21 ArchDefaultRegisterConfiguration() |
| 22 : RegisterConfiguration(Register::kMaxNumAllocatableRegisters, |
| 23 DoubleRegister::kMaxNumAllocatableRegisters, |
| 24 DoubleRegister::NumAllocatableAliasedRegisters(), |
| 25 general_register_name_table_, |
| 26 double_register_name_table_) { |
| 27 DCHECK_EQ(Register::kMaxNumAllocatableRegisters, |
| 28 Register::NumAllocatableRegisters()); |
| 29 for (int i = 0; i < Register::kMaxNumAllocatableRegisters; ++i) { |
| 30 general_register_name_table_[i] = Register::AllocationIndexToString(i); |
| 31 } |
| 32 for (int i = 0; i < DoubleRegister::kMaxNumAllocatableRegisters; ++i) { |
| 33 double_register_name_table_[i] = |
| 34 DoubleRegister::AllocationIndexToString(i); |
| 35 } |
| 36 } |
| 37 |
| 38 const char* |
| 39 general_register_name_table_[Register::kMaxNumAllocatableRegisters]; |
| 40 const char* |
| 41 double_register_name_table_[DoubleRegister::kMaxNumAllocatableRegisters]; |
| 42 }; |
| 43 |
| 44 |
| 45 static base::LazyInstance<ArchDefaultRegisterConfiguration>::type |
| 46 kDefaultRegisterConfiguration = LAZY_INSTANCE_INITIALIZER; |
| 47 |
| 48 } // namepace |
| 49 |
| 50 |
| 51 const RegisterConfiguration* RegisterConfiguration::ArchDefault() { |
| 52 return &kDefaultRegisterConfiguration.Get(); |
| 53 } |
| 54 |
| 55 RegisterConfiguration::RegisterConfiguration( |
| 56 int num_general_registers, int num_double_registers, |
| 57 int num_aliased_double_registers, const char* const* general_register_names, |
| 58 const char* const* double_register_names) |
| 59 : num_general_registers_(num_general_registers), |
| 60 num_double_registers_(num_double_registers), |
| 61 num_aliased_double_registers_(num_aliased_double_registers), |
| 62 general_register_names_(general_register_names), |
| 63 double_register_names_(double_register_names) {} |
| 64 |
| 65 |
| 66 } // namespace compiler |
| 67 } // namespace internal |
| 68 } // namespace v8 |
OLD | NEW |