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