OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef PLATFORM_GLOBALS_H_ | 5 #ifndef PLATFORM_GLOBALS_H_ |
6 #define PLATFORM_GLOBALS_H_ | 6 #define PLATFORM_GLOBALS_H_ |
7 | 7 |
8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to | 8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to |
9 // enable platform independent printf format specifiers. | 9 // enable platform independent printf format specifiers. |
10 #ifndef __STDC_FORMAT_MACROS | 10 #ifndef __STDC_FORMAT_MACROS |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 #error Automatic target os detection failed. | 72 #error Automatic target os detection failed. |
73 #endif | 73 #endif |
74 | 74 |
75 // Processor architecture detection. For more info on what's defined, see: | 75 // Processor architecture detection. For more info on what's defined, see: |
76 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 76 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
77 // http://www.agner.org/optimize/calling_conventions.pdf | 77 // http://www.agner.org/optimize/calling_conventions.pdf |
78 // or with gcc, run: "echo | gcc -E -dM -" | 78 // or with gcc, run: "echo | gcc -E -dM -" |
79 #if defined(_M_X64) || defined(__x86_64__) | 79 #if defined(_M_X64) || defined(__x86_64__) |
80 #define HOST_ARCH_X64 1 | 80 #define HOST_ARCH_X64 1 |
81 #define ARCH_IS_64_BIT 1 | 81 #define ARCH_IS_64_BIT 1 |
82 #include <xmmintrin.h> // NOLINT | |
83 #define kFpuRegisterSize 16 | |
84 typedef __m128 fpu_register_t; | |
85 typedef __m128 simd_value_t; | |
86 // Unaligned load. | |
87 #define simd_value_safe_load(addr) \ | |
88 _mm_loadu_ps(reinterpret_cast<const float*>(addr)) | |
89 // Unaligned store. | |
90 #define simd_value_safe_store(addr, value) \ | |
91 _mm_storeu_ps(reinterpret_cast<float*>(addr), value) | |
92 #elif defined(_M_IX86) || defined(__i386__) | 82 #elif defined(_M_IX86) || defined(__i386__) |
93 #define HOST_ARCH_IA32 1 | 83 #define HOST_ARCH_IA32 1 |
94 #define ARCH_IS_32_BIT 1 | 84 #define ARCH_IS_32_BIT 1 |
95 #include <xmmintrin.h> // NOLINT | |
96 #define kFpuRegisterSize 16 | |
97 typedef __m128 fpu_register_t; | |
98 typedef __m128 simd_value_t; | |
99 // Unaligned load. | |
100 #define simd_value_safe_load(addr) \ | |
101 _mm_loadu_ps(reinterpret_cast<const float*>(addr)) | |
102 // Unaligned store. | |
103 #define simd_value_safe_store(addr, value) \ | |
104 _mm_storeu_ps(reinterpret_cast<float*>(addr), value) | |
105 #elif defined(__ARMEL__) | 85 #elif defined(__ARMEL__) |
106 #define HOST_ARCH_ARM 1 | 86 #define HOST_ARCH_ARM 1 |
107 #define ARCH_IS_32_BIT 1 | 87 #define ARCH_IS_32_BIT 1 |
108 #define kFpuRegisterSize 8 | |
109 typedef double fpu_register_t; | |
110 // TODO(johnmccutchan): ARM simd type. | |
111 typedef struct { | |
112 uint32_t data_[4]; | |
113 } simd_value_t; | |
114 #elif defined(__MIPSEL__) | 88 #elif defined(__MIPSEL__) |
115 #define HOST_ARCH_MIPS 1 | 89 #define HOST_ARCH_MIPS 1 |
116 #define ARCH_IS_32_BIT 1 | 90 #define ARCH_IS_32_BIT 1 |
117 #define kFpuRegisterSize 8 | |
118 typedef double fpu_register_t; | |
119 // TODO(johnmccutchan): MIPS simd type. | |
120 typedef struct { | |
121 uint32_t data_[4]; | |
122 } simd_value_t; | |
123 #else | 91 #else |
124 #error Architecture was not detected as supported by Dart. | 92 #error Architecture was not detected as supported by Dart. |
125 #endif | 93 #endif |
126 | 94 |
127 #if !defined(TARGET_ARCH_MIPS) | 95 #if !defined(TARGET_ARCH_MIPS) |
128 #if !defined(TARGET_ARCH_ARM) | 96 #if !defined(TARGET_ARCH_ARM) |
129 #if !defined(TARGET_ARCH_X64) | 97 #if !defined(TARGET_ARCH_X64) |
130 #if !defined(TARGET_ARCH_IA32) | 98 #if !defined(TARGET_ARCH_IA32) |
131 // No target architecture specified pick the one matching the host architecture. | 99 // No target architecture specified pick the one matching the host architecture. |
132 #if defined(HOST_ARCH_MIPS) | 100 #if defined(HOST_ARCH_MIPS) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 const uint64_t kMaxUint64 = DART_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF); | 162 const uint64_t kMaxUint64 = DART_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF); |
195 | 163 |
196 // Types for native machine words. Guaranteed to be able to hold pointers and | 164 // Types for native machine words. Guaranteed to be able to hold pointers and |
197 // integers. | 165 // integers. |
198 typedef intptr_t word; | 166 typedef intptr_t word; |
199 typedef uintptr_t uword; | 167 typedef uintptr_t uword; |
200 | 168 |
201 // Byte sizes. | 169 // Byte sizes. |
202 const int kWordSize = sizeof(word); | 170 const int kWordSize = sizeof(word); |
203 const int kDoubleSize = sizeof(double); // NOLINT | 171 const int kDoubleSize = sizeof(double); // NOLINT |
204 const int kFloatSize = sizeof(float); // NOLINT | 172 const int kFloatSize = sizeof(float); // NOLINT |
205 const int kSimd128Size = 16; | |
206 #ifdef ARCH_IS_32_BIT | 173 #ifdef ARCH_IS_32_BIT |
207 const int kWordSizeLog2 = 2; | 174 const int kWordSizeLog2 = 2; |
208 const uword kUwordMax = kMaxUint32; | 175 const uword kUwordMax = kMaxUint32; |
209 #else | 176 #else |
210 const int kWordSizeLog2 = 3; | 177 const int kWordSizeLog2 = 3; |
211 const uword kUwordMax = kMaxUint64; | 178 const uword kUwordMax = kMaxUint64; |
212 #endif | 179 #endif |
213 | 180 |
214 // Bit sizes. | 181 // Bit sizes. |
215 const int kBitsPerByte = 8; | 182 const int kBitsPerByte = 8; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 // have an implicit 'this' argument, the arguments of such methods | 382 // have an implicit 'this' argument, the arguments of such methods |
416 // should be counted from two, not one." | 383 // should be counted from two, not one." |
417 // | 384 // |
418 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ | 385 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ |
419 __attribute__((__format__(__printf__, string_index, first_to_check))) | 386 __attribute__((__format__(__printf__, string_index, first_to_check))) |
420 #else | 387 #else |
421 #define PRINTF_ATTRIBUTE(string_index, first_to_check) | 388 #define PRINTF_ATTRIBUTE(string_index, first_to_check) |
422 #endif | 389 #endif |
423 | 390 |
424 #endif // PLATFORM_GLOBALS_H_ | 391 #endif // PLATFORM_GLOBALS_H_ |
OLD | NEW |