Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: src/register-configuration.cc

Issue 2030143002: Add FloatRegister names to RegisterConfiguration. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix non-ARM ports. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/register-configuration.h ('k') | test/unittests/compiler/instruction-sequence-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/register-configuration.h" 5 #include "src/register-configuration.h"
6 #include "src/globals.h" 6 #include "src/globals.h"
7 #include "src/macro-assembler.h" 7 #include "src/macro-assembler.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 15 matching lines...) Expand all
26 #define REGISTER_CODE(R) DoubleRegister::kCode_##R, 26 #define REGISTER_CODE(R) DoubleRegister::kCode_##R,
27 ALLOCATABLE_DOUBLE_REGISTERS(REGISTER_CODE)}; 27 ALLOCATABLE_DOUBLE_REGISTERS(REGISTER_CODE)};
28 #undef REGISTER_CODE 28 #undef REGISTER_CODE
29 29
30 static const char* const kGeneralRegisterNames[] = { 30 static const char* const kGeneralRegisterNames[] = {
31 #define REGISTER_NAME(R) #R, 31 #define REGISTER_NAME(R) #R,
32 GENERAL_REGISTERS(REGISTER_NAME) 32 GENERAL_REGISTERS(REGISTER_NAME)
33 #undef REGISTER_NAME 33 #undef REGISTER_NAME
34 }; 34 };
35 35
36 static const char* const kFloatRegisterNames[] = {
37 #define REGISTER_NAME(R) #R,
38 FLOAT_REGISTERS(REGISTER_NAME)
39 #undef REGISTER_NAME
40 };
41
36 static const char* const kDoubleRegisterNames[] = { 42 static const char* const kDoubleRegisterNames[] = {
37 #define REGISTER_NAME(R) #R, 43 #define REGISTER_NAME(R) #R,
38 DOUBLE_REGISTERS(REGISTER_NAME) 44 DOUBLE_REGISTERS(REGISTER_NAME)
39 #undef REGISTER_NAME 45 #undef REGISTER_NAME
40 }; 46 };
41 47
42 STATIC_ASSERT(RegisterConfiguration::kMaxGeneralRegisters >= 48 STATIC_ASSERT(RegisterConfiguration::kMaxGeneralRegisters >=
43 Register::kNumRegisters); 49 Register::kNumRegisters);
44 STATIC_ASSERT(RegisterConfiguration::kMaxFPRegisters >= 50 STATIC_ASSERT(RegisterConfiguration::kMaxFPRegisters >=
45 DoubleRegister::kMaxNumRegisters); 51 DoubleRegister::kMaxNumRegisters);
46 52
47 class ArchDefaultRegisterConfiguration : public RegisterConfiguration { 53 class ArchDefaultRegisterConfiguration : public RegisterConfiguration {
48 public: 54 public:
49 explicit ArchDefaultRegisterConfiguration(CompilerSelector compiler) 55 explicit ArchDefaultRegisterConfiguration(CompilerSelector compiler)
50 : RegisterConfiguration(Register::kNumRegisters, 56 : RegisterConfiguration(
51 DoubleRegister::kMaxNumRegisters, 57 Register::kNumRegisters, DoubleRegister::kMaxNumRegisters,
52 #if V8_TARGET_ARCH_IA32 58 #if V8_TARGET_ARCH_IA32
53 kMaxAllocatableGeneralRegisterCount, 59 kMaxAllocatableGeneralRegisterCount,
54 kMaxAllocatableDoubleRegisterCount, 60 kMaxAllocatableDoubleRegisterCount,
55 kMaxAllocatableDoubleRegisterCount, 61 kMaxAllocatableDoubleRegisterCount,
56 #elif V8_TARGET_ARCH_X87 62 #elif V8_TARGET_ARCH_X87
57 kMaxAllocatableGeneralRegisterCount, 63 kMaxAllocatableGeneralRegisterCount,
58 compiler == TURBOFAN 64 compiler == TURBOFAN ? 1 : kMaxAllocatableDoubleRegisterCount,
59 ? 1 65 compiler == TURBOFAN ? 1 : kMaxAllocatableDoubleRegisterCount,
60 : kMaxAllocatableDoubleRegisterCount,
61 compiler == TURBOFAN
62 ? 1
63 : kMaxAllocatableDoubleRegisterCount,
64 #elif V8_TARGET_ARCH_X64 66 #elif V8_TARGET_ARCH_X64
65 kMaxAllocatableGeneralRegisterCount, 67 kMaxAllocatableGeneralRegisterCount,
66 kMaxAllocatableDoubleRegisterCount, 68 kMaxAllocatableDoubleRegisterCount,
67 kMaxAllocatableDoubleRegisterCount, 69 kMaxAllocatableDoubleRegisterCount,
68 #elif V8_TARGET_ARCH_ARM 70 #elif V8_TARGET_ARCH_ARM
69 FLAG_enable_embedded_constant_pool 71 FLAG_enable_embedded_constant_pool
70 ? (kMaxAllocatableGeneralRegisterCount - 1) 72 ? (kMaxAllocatableGeneralRegisterCount - 1)
71 : kMaxAllocatableGeneralRegisterCount, 73 : kMaxAllocatableGeneralRegisterCount,
72 CpuFeatures::IsSupported(VFP32DREGS) 74 CpuFeatures::IsSupported(VFP32DREGS)
73 ? kMaxAllocatableDoubleRegisterCount 75 ? kMaxAllocatableDoubleRegisterCount
74 : (ALLOCATABLE_NO_VFP32_DOUBLE_REGISTERS( 76 : (ALLOCATABLE_NO_VFP32_DOUBLE_REGISTERS(REGISTER_COUNT) 0),
75 REGISTER_COUNT)0), 77 ALLOCATABLE_NO_VFP32_DOUBLE_REGISTERS(REGISTER_COUNT) 0,
76 ALLOCATABLE_NO_VFP32_DOUBLE_REGISTERS(
77 REGISTER_COUNT)0,
78 #elif V8_TARGET_ARCH_ARM64 78 #elif V8_TARGET_ARCH_ARM64
79 kMaxAllocatableGeneralRegisterCount, 79 kMaxAllocatableGeneralRegisterCount,
80 kMaxAllocatableDoubleRegisterCount, 80 kMaxAllocatableDoubleRegisterCount,
81 kMaxAllocatableDoubleRegisterCount, 81 kMaxAllocatableDoubleRegisterCount,
82 #elif V8_TARGET_ARCH_MIPS 82 #elif V8_TARGET_ARCH_MIPS
83 kMaxAllocatableGeneralRegisterCount, 83 kMaxAllocatableGeneralRegisterCount,
84 kMaxAllocatableDoubleRegisterCount, 84 kMaxAllocatableDoubleRegisterCount,
85 kMaxAllocatableDoubleRegisterCount, 85 kMaxAllocatableDoubleRegisterCount,
86 #elif V8_TARGET_ARCH_MIPS64 86 #elif V8_TARGET_ARCH_MIPS64
87 kMaxAllocatableGeneralRegisterCount, 87 kMaxAllocatableGeneralRegisterCount,
88 kMaxAllocatableDoubleRegisterCount, 88 kMaxAllocatableDoubleRegisterCount,
89 kMaxAllocatableDoubleRegisterCount, 89 kMaxAllocatableDoubleRegisterCount,
90 #elif V8_TARGET_ARCH_PPC 90 #elif V8_TARGET_ARCH_PPC
91 kMaxAllocatableGeneralRegisterCount, 91 kMaxAllocatableGeneralRegisterCount,
92 kMaxAllocatableDoubleRegisterCount, 92 kMaxAllocatableDoubleRegisterCount,
93 kMaxAllocatableDoubleRegisterCount, 93 kMaxAllocatableDoubleRegisterCount,
94 #elif V8_TARGET_ARCH_S390 94 #elif V8_TARGET_ARCH_S390
95 kMaxAllocatableGeneralRegisterCount, 95 kMaxAllocatableGeneralRegisterCount,
96 kMaxAllocatableDoubleRegisterCount, 96 kMaxAllocatableDoubleRegisterCount,
97 kMaxAllocatableDoubleRegisterCount, 97 kMaxAllocatableDoubleRegisterCount,
98 #else 98 #else
99 #error Unsupported target architecture. 99 #error Unsupported target architecture.
100 #endif 100 #endif
101 kAllocatableGeneralCodes, kAllocatableDoubleCodes, 101 kAllocatableGeneralCodes, kAllocatableDoubleCodes,
102 kGeneralRegisterNames, kDoubleRegisterNames) { 102 kGeneralRegisterNames, kFloatRegisterNames, kDoubleRegisterNames) {
103 } 103 }
104 }; 104 };
105 105
106 106
107 template <RegisterConfiguration::CompilerSelector compiler> 107 template <RegisterConfiguration::CompilerSelector compiler>
108 struct RegisterConfigurationInitializer { 108 struct RegisterConfigurationInitializer {
109 static void Construct(ArchDefaultRegisterConfiguration* config) { 109 static void Construct(ArchDefaultRegisterConfiguration* config) {
110 new (config) ArchDefaultRegisterConfiguration(compiler); 110 new (config) ArchDefaultRegisterConfiguration(compiler);
111 } 111 }
112 }; 112 };
(...skipping 12 matching lines...) Expand all
125 } // namespace 125 } // namespace
126 126
127 127
128 const RegisterConfiguration* RegisterConfiguration::ArchDefault( 128 const RegisterConfiguration* RegisterConfiguration::ArchDefault(
129 CompilerSelector compiler) { 129 CompilerSelector compiler) {
130 return compiler == TURBOFAN 130 return compiler == TURBOFAN
131 ? &kDefaultRegisterConfigurationForTurboFan.Get() 131 ? &kDefaultRegisterConfigurationForTurboFan.Get()
132 : &kDefaultRegisterConfigurationForCrankshaft.Get(); 132 : &kDefaultRegisterConfigurationForCrankshaft.Get();
133 } 133 }
134 134
135
136 RegisterConfiguration::RegisterConfiguration( 135 RegisterConfiguration::RegisterConfiguration(
137 int num_general_registers, int num_double_registers, 136 int num_general_registers, int num_double_registers,
138 int num_allocatable_general_registers, int num_allocatable_double_registers, 137 int num_allocatable_general_registers, int num_allocatable_double_registers,
139 int num_allocatable_aliased_double_registers, 138 int num_allocatable_aliased_double_registers,
140 const int* allocatable_general_codes, const int* allocatable_double_codes, 139 const int* allocatable_general_codes, const int* allocatable_double_codes,
141 const char* const* general_register_names, 140 const char* const* general_register_names,
141 const char* const* float_register_names,
142 const char* const* double_register_names) 142 const char* const* double_register_names)
143 : num_general_registers_(num_general_registers), 143 : num_general_registers_(num_general_registers),
144 num_double_registers_(num_double_registers), 144 num_double_registers_(num_double_registers),
145 num_allocatable_general_registers_(num_allocatable_general_registers), 145 num_allocatable_general_registers_(num_allocatable_general_registers),
146 num_allocatable_double_registers_(num_allocatable_double_registers), 146 num_allocatable_double_registers_(num_allocatable_double_registers),
147 num_allocatable_aliased_double_registers_( 147 num_allocatable_aliased_double_registers_(
148 num_allocatable_aliased_double_registers), 148 num_allocatable_aliased_double_registers),
149 allocatable_general_codes_mask_(0), 149 allocatable_general_codes_mask_(0),
150 allocatable_double_codes_mask_(0), 150 allocatable_double_codes_mask_(0),
151 allocatable_general_codes_(allocatable_general_codes), 151 allocatable_general_codes_(allocatable_general_codes),
152 allocatable_double_codes_(allocatable_double_codes), 152 allocatable_double_codes_(allocatable_double_codes),
153 general_register_names_(general_register_names), 153 general_register_names_(general_register_names),
154 float_register_names_(float_register_names),
154 double_register_names_(double_register_names) { 155 double_register_names_(double_register_names) {
155 DCHECK(num_general_registers_ <= RegisterConfiguration::kMaxGeneralRegisters); 156 DCHECK(num_general_registers_ <= RegisterConfiguration::kMaxGeneralRegisters);
156 DCHECK(num_double_registers_ <= RegisterConfiguration::kMaxFPRegisters); 157 DCHECK(num_double_registers_ <= RegisterConfiguration::kMaxFPRegisters);
157 for (int i = 0; i < num_allocatable_general_registers_; ++i) { 158 for (int i = 0; i < num_allocatable_general_registers_; ++i) {
158 allocatable_general_codes_mask_ |= (1 << allocatable_general_codes_[i]); 159 allocatable_general_codes_mask_ |= (1 << allocatable_general_codes_[i]);
159 } 160 }
160 for (int i = 0; i < num_allocatable_double_registers_; ++i) { 161 for (int i = 0; i < num_allocatable_double_registers_; ++i) {
161 allocatable_double_codes_mask_ |= (1 << allocatable_double_codes_[i]); 162 allocatable_double_codes_mask_ |= (1 << allocatable_double_codes_[i]);
162 } 163 }
163 } 164 }
164 165
165 #undef REGISTER_COUNT 166 #undef REGISTER_COUNT
166 167
167 } // namespace internal 168 } // namespace internal
168 } // namespace v8 169 } // namespace v8
OLDNEW
« no previous file with comments | « src/register-configuration.h ('k') | test/unittests/compiler/instruction-sequence-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698