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

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

Issue 2101473002: [Turbofan] Allow compiler to elide complex aliasing code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 4 years, 5 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') | src/s390/assembler-s390.h » ('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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 STATIC_ASSERT(RegisterConfiguration::kMaxFPRegisters >= 50 STATIC_ASSERT(RegisterConfiguration::kMaxFPRegisters >=
51 DoubleRegister::kMaxNumRegisters); 51 DoubleRegister::kMaxNumRegisters);
52 52
53 class ArchDefaultRegisterConfiguration : public RegisterConfiguration { 53 class ArchDefaultRegisterConfiguration : public RegisterConfiguration {
54 public: 54 public:
55 explicit ArchDefaultRegisterConfiguration(CompilerSelector compiler) 55 explicit ArchDefaultRegisterConfiguration(CompilerSelector compiler)
56 : RegisterConfiguration( 56 : RegisterConfiguration(
57 Register::kNumRegisters, DoubleRegister::kMaxNumRegisters, 57 Register::kNumRegisters, DoubleRegister::kMaxNumRegisters,
58 #if V8_TARGET_ARCH_IA32 58 #if V8_TARGET_ARCH_IA32
59 kMaxAllocatableGeneralRegisterCount, 59 kMaxAllocatableGeneralRegisterCount,
60 kMaxAllocatableDoubleRegisterCount, AliasingKind::OVERLAP, 60 kMaxAllocatableDoubleRegisterCount,
61 #elif V8_TARGET_ARCH_X87 61 #elif V8_TARGET_ARCH_X87
62 kMaxAllocatableGeneralRegisterCount, 62 kMaxAllocatableGeneralRegisterCount,
63 compiler == TURBOFAN ? 1 : kMaxAllocatableDoubleRegisterCount, 63 compiler == TURBOFAN ? 1 : kMaxAllocatableDoubleRegisterCount,
64 AliasingKind::OVERLAP,
65 #elif V8_TARGET_ARCH_X64 64 #elif V8_TARGET_ARCH_X64
66 kMaxAllocatableGeneralRegisterCount, 65 kMaxAllocatableGeneralRegisterCount,
67 kMaxAllocatableDoubleRegisterCount, AliasingKind::OVERLAP, 66 kMaxAllocatableDoubleRegisterCount,
68 #elif V8_TARGET_ARCH_ARM 67 #elif V8_TARGET_ARCH_ARM
69 FLAG_enable_embedded_constant_pool 68 FLAG_enable_embedded_constant_pool
70 ? (kMaxAllocatableGeneralRegisterCount - 1) 69 ? (kMaxAllocatableGeneralRegisterCount - 1)
71 : kMaxAllocatableGeneralRegisterCount, 70 : kMaxAllocatableGeneralRegisterCount,
72 CpuFeatures::IsSupported(VFP32DREGS) 71 CpuFeatures::IsSupported(VFP32DREGS)
73 ? kMaxAllocatableDoubleRegisterCount 72 ? kMaxAllocatableDoubleRegisterCount
74 : (ALLOCATABLE_NO_VFP32_DOUBLE_REGISTERS(REGISTER_COUNT) 0), 73 : (ALLOCATABLE_NO_VFP32_DOUBLE_REGISTERS(REGISTER_COUNT) 0),
75 AliasingKind::COMBINE,
76 #elif V8_TARGET_ARCH_ARM64 74 #elif V8_TARGET_ARCH_ARM64
77 kMaxAllocatableGeneralRegisterCount, 75 kMaxAllocatableGeneralRegisterCount,
78 kMaxAllocatableDoubleRegisterCount, AliasingKind::OVERLAP, 76 kMaxAllocatableDoubleRegisterCount,
79 #elif V8_TARGET_ARCH_MIPS 77 #elif V8_TARGET_ARCH_MIPS
80 kMaxAllocatableGeneralRegisterCount, 78 kMaxAllocatableGeneralRegisterCount,
81 kMaxAllocatableDoubleRegisterCount, AliasingKind::OVERLAP, 79 kMaxAllocatableDoubleRegisterCount,
82 #elif V8_TARGET_ARCH_MIPS64 80 #elif V8_TARGET_ARCH_MIPS64
83 kMaxAllocatableGeneralRegisterCount, 81 kMaxAllocatableGeneralRegisterCount,
84 kMaxAllocatableDoubleRegisterCount, AliasingKind::OVERLAP, 82 kMaxAllocatableDoubleRegisterCount,
85 #elif V8_TARGET_ARCH_PPC 83 #elif V8_TARGET_ARCH_PPC
86 kMaxAllocatableGeneralRegisterCount, 84 kMaxAllocatableGeneralRegisterCount,
87 kMaxAllocatableDoubleRegisterCount, AliasingKind::OVERLAP, 85 kMaxAllocatableDoubleRegisterCount,
88 #elif V8_TARGET_ARCH_S390 86 #elif V8_TARGET_ARCH_S390
89 kMaxAllocatableGeneralRegisterCount, 87 kMaxAllocatableGeneralRegisterCount,
90 kMaxAllocatableDoubleRegisterCount, AliasingKind::OVERLAP, 88 kMaxAllocatableDoubleRegisterCount,
91 #else 89 #else
92 #error Unsupported target architecture. 90 #error Unsupported target architecture.
93 #endif 91 #endif
94 kAllocatableGeneralCodes, kAllocatableDoubleCodes, 92 kAllocatableGeneralCodes, kAllocatableDoubleCodes,
93 kSimpleFPAliasing ? AliasingKind::OVERLAP : AliasingKind::COMBINE,
95 kGeneralRegisterNames, kFloatRegisterNames, kDoubleRegisterNames) { 94 kGeneralRegisterNames, kFloatRegisterNames, kDoubleRegisterNames) {
96 } 95 }
97 }; 96 };
98 97
99 98
100 template <RegisterConfiguration::CompilerSelector compiler> 99 template <RegisterConfiguration::CompilerSelector compiler>
101 struct RegisterConfigurationInitializer { 100 struct RegisterConfigurationInitializer {
102 static void Construct(ArchDefaultRegisterConfiguration* config) { 101 static void Construct(ArchDefaultRegisterConfiguration* config) {
103 new (config) ArchDefaultRegisterConfiguration(compiler); 102 new (config) ArchDefaultRegisterConfiguration(compiler);
104 } 103 }
(...skipping 16 matching lines...) Expand all
121 const RegisterConfiguration* RegisterConfiguration::ArchDefault( 120 const RegisterConfiguration* RegisterConfiguration::ArchDefault(
122 CompilerSelector compiler) { 121 CompilerSelector compiler) {
123 return compiler == TURBOFAN 122 return compiler == TURBOFAN
124 ? &kDefaultRegisterConfigurationForTurboFan.Get() 123 ? &kDefaultRegisterConfigurationForTurboFan.Get()
125 : &kDefaultRegisterConfigurationForCrankshaft.Get(); 124 : &kDefaultRegisterConfigurationForCrankshaft.Get();
126 } 125 }
127 126
128 RegisterConfiguration::RegisterConfiguration( 127 RegisterConfiguration::RegisterConfiguration(
129 int num_general_registers, int num_double_registers, 128 int num_general_registers, int num_double_registers,
130 int num_allocatable_general_registers, int num_allocatable_double_registers, 129 int num_allocatable_general_registers, int num_allocatable_double_registers,
131 AliasingKind fp_aliasing_kind, const int* allocatable_general_codes, 130 const int* allocatable_general_codes, const int* allocatable_double_codes,
132 const int* allocatable_double_codes, 131 AliasingKind fp_aliasing_kind, const char* const* general_register_names,
133 const char* const* general_register_names,
134 const char* const* float_register_names, 132 const char* const* float_register_names,
135 const char* const* double_register_names) 133 const char* const* double_register_names)
136 : num_general_registers_(num_general_registers), 134 : num_general_registers_(num_general_registers),
137 num_float_registers_(0), 135 num_float_registers_(0),
138 num_double_registers_(num_double_registers), 136 num_double_registers_(num_double_registers),
139 num_allocatable_general_registers_(num_allocatable_general_registers), 137 num_allocatable_general_registers_(num_allocatable_general_registers),
140 num_allocatable_double_registers_(num_allocatable_double_registers), 138 num_allocatable_double_registers_(num_allocatable_double_registers),
141 num_allocatable_float_registers_(0), 139 num_allocatable_float_registers_(0),
142 fp_aliasing_kind_(fp_aliasing_kind),
143 allocatable_general_codes_mask_(0), 140 allocatable_general_codes_mask_(0),
144 allocatable_double_codes_mask_(0), 141 allocatable_double_codes_mask_(0),
145 allocatable_general_codes_(allocatable_general_codes), 142 allocatable_general_codes_(allocatable_general_codes),
146 allocatable_double_codes_(allocatable_double_codes), 143 allocatable_double_codes_(allocatable_double_codes),
144 fp_aliasing_kind_(fp_aliasing_kind),
147 general_register_names_(general_register_names), 145 general_register_names_(general_register_names),
148 float_register_names_(float_register_names), 146 float_register_names_(float_register_names),
149 double_register_names_(double_register_names) { 147 double_register_names_(double_register_names) {
150 DCHECK(num_general_registers_ <= RegisterConfiguration::kMaxGeneralRegisters); 148 DCHECK(num_general_registers_ <= RegisterConfiguration::kMaxGeneralRegisters);
151 DCHECK(num_double_registers_ <= RegisterConfiguration::kMaxFPRegisters); 149 DCHECK(num_double_registers_ <= RegisterConfiguration::kMaxFPRegisters);
152 for (int i = 0; i < num_allocatable_general_registers_; ++i) { 150 for (int i = 0; i < num_allocatable_general_registers_; ++i) {
153 allocatable_general_codes_mask_ |= (1 << allocatable_general_codes_[i]); 151 allocatable_general_codes_mask_ |= (1 << allocatable_general_codes_[i]);
154 } 152 }
155 for (int i = 0; i < num_allocatable_double_registers_; ++i) { 153 for (int i = 0; i < num_allocatable_double_registers_; ++i) {
156 allocatable_double_codes_mask_ |= (1 << allocatable_double_codes_[i]); 154 allocatable_double_codes_mask_ |= (1 << allocatable_double_codes_[i]);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // Alias indices are out of float register range. 225 // Alias indices are out of float register range.
228 return false; 226 return false;
229 } 227 }
230 return index == other_index / 2; 228 return index == other_index / 2;
231 } 229 }
232 230
233 #undef REGISTER_COUNT 231 #undef REGISTER_COUNT
234 232
235 } // namespace internal 233 } // namespace internal
236 } // namespace v8 234 } // namespace v8
OLDNEW
« no previous file with comments | « src/register-configuration.h ('k') | src/s390/assembler-s390.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698