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

Side by Side Diff: src/arm/assembler-arm.cc

Issue 14263018: ARM: Makefile/gyp update allowing better control of ARM specific options. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Review comments Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/constants-arm.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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return ExternalReference(&CpuFeatures::supported_); 56 return ExternalReference(&CpuFeatures::supported_);
57 } 57 }
58 58
59 // Get the CPU features enabled by the build. For cross compilation the 59 // Get the CPU features enabled by the build. For cross compilation the
60 // preprocessor symbols CAN_USE_ARMV7_INSTRUCTIONS and CAN_USE_VFP3_INSTRUCTIONS 60 // preprocessor symbols CAN_USE_ARMV7_INSTRUCTIONS and CAN_USE_VFP3_INSTRUCTIONS
61 // can be defined to enable ARMv7 and VFPv3 instructions when building the 61 // can be defined to enable ARMv7 and VFPv3 instructions when building the
62 // snapshot. 62 // snapshot.
63 static unsigned CpuFeaturesImpliedByCompiler() { 63 static unsigned CpuFeaturesImpliedByCompiler() {
64 unsigned answer = 0; 64 unsigned answer = 0;
65 #ifdef CAN_USE_ARMV7_INSTRUCTIONS 65 #ifdef CAN_USE_ARMV7_INSTRUCTIONS
66 answer |= 1u << ARMv7; 66 if (FLAG_enable_armv7) {
67 answer |= 1u << ARMv7;
68 }
67 #endif // CAN_USE_ARMV7_INSTRUCTIONS 69 #endif // CAN_USE_ARMV7_INSTRUCTIONS
68 #ifdef CAN_USE_VFP3_INSTRUCTIONS 70 #ifdef CAN_USE_VFP3_INSTRUCTIONS
69 answer |= 1u << VFP3 | 1u << ARMv7; 71 if (FLAG_enable_vfp3) {
72 answer |= 1u << VFP3 | 1u << ARMv7;
73 }
70 #endif // CAN_USE_VFP3_INSTRUCTIONS 74 #endif // CAN_USE_VFP3_INSTRUCTIONS
71 #ifdef CAN_USE_VFP32DREGS 75 #ifdef CAN_USE_VFP32DREGS
72 answer |= 1u << VFP32DREGS; 76 if (FLAG_enable_32dregs) {
77 answer |= 1u << VFP32DREGS;
78 }
73 #endif // CAN_USE_VFP32DREGS 79 #endif // CAN_USE_VFP32DREGS
74 80 if ((answer & (1u << ARMv7)) && FLAG_enable_unaligned_accesses) {
75 #ifdef __arm__
76 // If the compiler is allowed to use VFP then we can use VFP too in our code
77 // generation even when generating snapshots. ARMv7 and hardware floating
78 // point support implies VFPv3, see ARM DDI 0406B, page A1-6.
79 #if defined(CAN_USE_ARMV7_INSTRUCTIONS) && defined(__VFP_FP__) \
80 && !defined(__SOFTFP__)
81 answer |= 1u << VFP3 | 1u << ARMv7;
82 #endif // defined(CAN_USE_ARMV7_INSTRUCTIONS) && defined(__VFP_FP__)
83 // && !defined(__SOFTFP__)
84 #endif // _arm__
85 if (answer & (1u << ARMv7)) {
86 answer |= 1u << UNALIGNED_ACCESSES; 81 answer |= 1u << UNALIGNED_ACCESSES;
87 } 82 }
88 83
89 return answer; 84 return answer;
90 } 85 }
91 86
92 87
93 const char* DwVfpRegister::AllocationIndexToString(int index) { 88 const char* DwVfpRegister::AllocationIndexToString(int index) {
94 ASSERT(index >= 0 && index < NumAllocatableRegisters()); 89 ASSERT(index >= 0 && index < NumAllocatableRegisters());
95 ASSERT(kScratchDoubleReg.code() - kDoubleRegZero.code() == 90 ASSERT(kScratchDoubleReg.code() - kDoubleRegZero.code() ==
(...skipping 13 matching lines...) Expand all
109 initialized_ = true; 104 initialized_ = true;
110 #endif 105 #endif
111 106
112 // Get the features implied by the OS and the compiler settings. This is the 107 // Get the features implied by the OS and the compiler settings. This is the
113 // minimal set of features which is also alowed for generated code in the 108 // minimal set of features which is also alowed for generated code in the
114 // snapshot. 109 // snapshot.
115 supported_ |= standard_features; 110 supported_ |= standard_features;
116 111
117 if (Serializer::enabled()) { 112 if (Serializer::enabled()) {
118 // No probing for features if we might serialize (generate snapshot). 113 // No probing for features if we might serialize (generate snapshot).
114 printf(" ");
115 PrintFeatures();
119 return; 116 return;
120 } 117 }
121 118
122 #ifndef __arm__ 119 #ifndef __arm__
123 // For the simulator=arm build, use VFP when FLAG_enable_vfp3 is 120 // For the simulator=arm build, use VFP when FLAG_enable_vfp3 is
124 // enabled. VFPv3 implies ARMv7, see ARM DDI 0406B, page A1-6. 121 // enabled. VFPv3 implies ARMv7, see ARM DDI 0406B, page A1-6.
125 if (FLAG_enable_vfp3) { 122 if (FLAG_enable_vfp3) {
126 supported_ |= 123 supported_ |=
127 static_cast<uint64_t>(1) << VFP3 | 124 static_cast<uint64_t>(1) << VFP3 |
128 static_cast<uint64_t>(1) << ARMv7; 125 static_cast<uint64_t>(1) << ARMv7;
129 } 126 }
130 // For the simulator=arm build, use ARMv7 when FLAG_enable_armv7 is enabled 127 // For the simulator=arm build, use ARMv7 when FLAG_enable_armv7 is enabled
131 if (FLAG_enable_armv7) { 128 if (FLAG_enable_armv7) {
132 supported_ |= static_cast<uint64_t>(1) << ARMv7; 129 supported_ |= static_cast<uint64_t>(1) << ARMv7;
133 } 130 }
134 131
135 if (FLAG_enable_sudiv) { 132 if (FLAG_enable_sudiv) {
136 supported_ |= static_cast<uint64_t>(1) << SUDIV; 133 supported_ |= static_cast<uint64_t>(1) << SUDIV;
137 } 134 }
138 135
139 if (FLAG_enable_movw_movt) { 136 if (FLAG_enable_movw_movt) {
140 supported_ |= static_cast<uint64_t>(1) << MOVW_MOVT_IMMEDIATE_LOADS; 137 supported_ |= static_cast<uint64_t>(1) << MOVW_MOVT_IMMEDIATE_LOADS;
141 } 138 }
142 139
143 if (FLAG_enable_32dregs) { 140 if (FLAG_enable_32dregs) {
144 supported_ |= static_cast<uint64_t>(1) << VFP32DREGS; 141 supported_ |= static_cast<uint64_t>(1) << VFP32DREGS;
145 } 142 }
146 143
144 if (FLAG_enable_unaligned_accesses) {
145 supported_ |= static_cast<uint64_t>(1) << UNALIGNED_ACCESSES;
146 }
147
147 #else // __arm__ 148 #else // __arm__
148 // Probe for additional features not already known to be available. 149 // Probe for additional features not already known to be available.
149 if (!IsSupported(VFP3) && OS::ArmCpuHasFeature(VFP3)) { 150 if (!IsSupported(VFP3) && FLAG_enable_vfp3 && OS::ArmCpuHasFeature(VFP3)) {
150 // This implementation also sets the VFP flags if runtime 151 // This implementation also sets the VFP flags if runtime
151 // detection of VFP returns true. VFPv3 implies ARMv7, see ARM DDI 152 // detection of VFP returns true. VFPv3 implies ARMv7, see ARM DDI
152 // 0406B, page A1-6. 153 // 0406B, page A1-6.
153 found_by_runtime_probing_only_ |= 154 found_by_runtime_probing_only_ |=
154 static_cast<uint64_t>(1) << VFP3 | 155 static_cast<uint64_t>(1) << VFP3 |
155 static_cast<uint64_t>(1) << ARMv7; 156 static_cast<uint64_t>(1) << ARMv7;
156 } 157 }
157 158
158 if (!IsSupported(ARMv7) && OS::ArmCpuHasFeature(ARMv7)) { 159 if (!IsSupported(ARMv7) && FLAG_enable_armv7 && OS::ArmCpuHasFeature(ARMv7)) {
159 found_by_runtime_probing_only_ |= static_cast<uint64_t>(1) << ARMv7; 160 found_by_runtime_probing_only_ |= static_cast<uint64_t>(1) << ARMv7;
160 } 161 }
161 162
162 if (!IsSupported(SUDIV) && OS::ArmCpuHasFeature(SUDIV)) { 163 if (!IsSupported(SUDIV) && FLAG_enable_sudiv && OS::ArmCpuHasFeature(SUDIV)) {
163 found_by_runtime_probing_only_ |= static_cast<uint64_t>(1) << SUDIV; 164 found_by_runtime_probing_only_ |= static_cast<uint64_t>(1) << SUDIV;
164 } 165 }
165 166
166 if (!IsSupported(UNALIGNED_ACCESSES) && OS::ArmCpuHasFeature(ARMv7)) { 167 if (!IsSupported(UNALIGNED_ACCESSES) && FLAG_enable_unaligned_accesses
168 && OS::ArmCpuHasFeature(ARMv7)) {
167 found_by_runtime_probing_only_ |= 169 found_by_runtime_probing_only_ |=
168 static_cast<uint64_t>(1) << UNALIGNED_ACCESSES; 170 static_cast<uint64_t>(1) << UNALIGNED_ACCESSES;
169 } 171 }
170 172
171 if (OS::GetCpuImplementer() == QUALCOMM_IMPLEMENTER && 173 if (OS::GetCpuImplementer() == QUALCOMM_IMPLEMENTER &&
172 OS::ArmCpuHasFeature(ARMv7)) { 174 FLAG_enable_movw_movt && OS::ArmCpuHasFeature(ARMv7)) {
173 found_by_runtime_probing_only_ |= 175 found_by_runtime_probing_only_ |=
174 static_cast<uint64_t>(1) << MOVW_MOVT_IMMEDIATE_LOADS; 176 static_cast<uint64_t>(1) << MOVW_MOVT_IMMEDIATE_LOADS;
175 } 177 }
176 178
177 if (!IsSupported(VFP32DREGS) && OS::ArmCpuHasFeature(VFP32DREGS)) { 179 if (!IsSupported(VFP32DREGS) && FLAG_enable_32dregs
180 && OS::ArmCpuHasFeature(VFP32DREGS)) {
178 found_by_runtime_probing_only_ |= static_cast<uint64_t>(1) << VFP32DREGS; 181 found_by_runtime_probing_only_ |= static_cast<uint64_t>(1) << VFP32DREGS;
179 } 182 }
180 183
181 supported_ |= found_by_runtime_probing_only_; 184 supported_ |= found_by_runtime_probing_only_;
182 #endif 185 #endif
183 186
184 // Assert that VFP3 implies ARMv7. 187 // Assert that VFP3 implies ARMv7.
185 ASSERT(!IsSupported(VFP3) || IsSupported(ARMv7)); 188 ASSERT(!IsSupported(VFP3) || IsSupported(ARMv7));
186 } 189 }
187 190
188 191
192 void CpuFeatures::PrintTarget() {
193 const char* arm_arch = NULL;
194 const char* arm_test = "";
195 const char* arm_fpu = "";
196 const char* arm_thumb = "";
197 const char* arm_float_abi = NULL;
198
199 #if defined CAN_USE_ARMV7_INSTRUCTIONS
200 arm_arch = "arm v7";
201 #else
202 arm_arch = "arm v6";
203 #endif
204
205 #ifdef __arm__
206
207 # ifdef ARM_TEST
208 arm_test = " test";
209 # endif
210 # if defined __ARM_NEON__
211 arm_fpu = " neon";
212 # elif defined CAN_USE_VFP3_INSTRUCTIONS
213 arm_fpu = " vfp3";
214 # else
215 arm_fpu = " vfp2";
216 # endif
217 # if (defined __thumb__) || (defined __thumb2__)
218 arm_thumb = " thumb";
219 # endif
220 arm_float_abi = OS::ArmUsingHardFloat() ? "hard" : "softfp";
221
222 #else // __arm__
223
224 arm_test = " simulator";
225 # if defined CAN_USE_VFP3_INSTRUCTIONS
226 # if defined CAN_USE_VFP32DREGS
227 arm_fpu = " vfp3";
228 # else
229 arm_fpu = " vfp3-d16";
230 # endif
231 # else
232 arm_fpu = " vfp2";
233 # endif
234 # if USE_EABI_HARDFLOAT == 1
235 arm_float_abi = "hard";
236 # else
237 arm_float_abi = "softfp";
238 # endif
239
240 #endif // __arm__
241
242 printf("target%s %s%s%s %s\n",
243 arm_test, arm_arch, arm_fpu, arm_thumb, arm_float_abi);
244 }
245
246
247 void CpuFeatures::PrintFeatures() {
248 printf(
249 "ARMv7=%d VFP3=%d VFP32DREGS=%d SUDIV=%d UNALIGNED_ACCESSES=%d "
250 "MOVW_MOVT_IMMEDIATE_LOADS=%d",
251 CpuFeatures::IsSupported(ARMv7),
252 CpuFeatures::IsSupported(VFP3),
253 CpuFeatures::IsSupported(VFP32DREGS),
254 CpuFeatures::IsSupported(SUDIV),
255 CpuFeatures::IsSupported(UNALIGNED_ACCESSES),
256 CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS));
257 #ifdef __arm__
258 printf(" USE_EABI_HARDFLOAT=%d\n", OS::ArmUsingHardFloat());
259 #else
260 printf(" USE_EABI_HARDFLOAT=%d\n", USE_EABI_HARDFLOAT);
261 #endif
262 }
263
264
189 // ----------------------------------------------------------------------------- 265 // -----------------------------------------------------------------------------
190 // Implementation of RelocInfo 266 // Implementation of RelocInfo
191 267
192 const int RelocInfo::kApplyMask = 0; 268 const int RelocInfo::kApplyMask = 0;
193 269
194 270
195 bool RelocInfo::IsCodedSpecially() { 271 bool RelocInfo::IsCodedSpecially() {
196 // The deserializer needs to know whether a pointer is specially coded. Being 272 // The deserializer needs to know whether a pointer is specially coded. Being
197 // specially coded on ARM means that it is a movw/movt instruction. We don't 273 // specially coded on ARM means that it is a movw/movt instruction. We don't
198 // generate those yet. 274 // generate those yet.
(...skipping 2805 matching lines...) Expand 10 before | Expand all | Expand 10 after
3004 3080
3005 // Since a constant pool was just emitted, move the check offset forward by 3081 // Since a constant pool was just emitted, move the check offset forward by
3006 // the standard interval. 3082 // the standard interval.
3007 next_buffer_check_ = pc_offset() + kCheckPoolInterval; 3083 next_buffer_check_ = pc_offset() + kCheckPoolInterval;
3008 } 3084 }
3009 3085
3010 3086
3011 } } // namespace v8::internal 3087 } } // namespace v8::internal
3012 3088
3013 #endif // V8_TARGET_ARCH_ARM 3089 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/constants-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698