OLD | NEW |
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 #ifndef V8_COMPILER_MACHINE_TYPE_H_ | 5 #ifndef V8_COMPILER_MACHINE_TYPE_H_ |
6 #define V8_COMPILER_MACHINE_TYPE_H_ | 6 #define V8_COMPILER_MACHINE_TYPE_H_ |
7 | 7 |
| 8 #include <iosfwd> |
| 9 |
8 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
9 #include "src/globals.h" | 11 #include "src/globals.h" |
10 #include "src/zone.h" | 12 #include "src/zone.h" |
11 | 13 |
12 namespace v8 { | 14 namespace v8 { |
13 namespace internal { | 15 namespace internal { |
14 | |
15 class OStream; | |
16 | |
17 namespace compiler { | 16 namespace compiler { |
18 | 17 |
19 // Machine-level types and representations. | 18 // Machine-level types and representations. |
20 // TODO(titzer): Use the real type system instead of MachineType. | 19 // TODO(titzer): Use the real type system instead of MachineType. |
21 enum MachineType { | 20 enum MachineType { |
22 // Representations. | 21 // Representations. |
23 kRepBit = 1 << 0, | 22 kRepBit = 1 << 0, |
24 kRepWord8 = 1 << 1, | 23 kRepWord8 = 1 << 1, |
25 kRepWord16 = 1 << 2, | 24 kRepWord16 = 1 << 2, |
26 kRepWord32 = 1 << 3, | 25 kRepWord32 = 1 << 3, |
(...skipping 20 matching lines...) Expand all Loading... |
47 kMachInt16 = kRepWord16 | kTypeInt32, | 46 kMachInt16 = kRepWord16 | kTypeInt32, |
48 kMachUint16 = kRepWord16 | kTypeUint32, | 47 kMachUint16 = kRepWord16 | kTypeUint32, |
49 kMachInt32 = kRepWord32 | kTypeInt32, | 48 kMachInt32 = kRepWord32 | kTypeInt32, |
50 kMachUint32 = kRepWord32 | kTypeUint32, | 49 kMachUint32 = kRepWord32 | kTypeUint32, |
51 kMachInt64 = kRepWord64 | kTypeInt64, | 50 kMachInt64 = kRepWord64 | kTypeInt64, |
52 kMachUint64 = kRepWord64 | kTypeUint64, | 51 kMachUint64 = kRepWord64 | kTypeUint64, |
53 kMachPtr = (kPointerSize == 4) ? kRepWord32 : kRepWord64, | 52 kMachPtr = (kPointerSize == 4) ? kRepWord32 : kRepWord64, |
54 kMachAnyTagged = kRepTagged | kTypeAny | 53 kMachAnyTagged = kRepTagged | kTypeAny |
55 }; | 54 }; |
56 | 55 |
57 OStream& operator<<(OStream& os, const MachineType& type); | 56 std::ostream& operator<<(std::ostream& os, const MachineType& type); |
58 | 57 |
59 typedef uint16_t MachineTypeUnion; | 58 typedef uint16_t MachineTypeUnion; |
60 | 59 |
61 // Globally useful machine types and constants. | 60 // Globally useful machine types and constants. |
62 const MachineTypeUnion kRepMask = kRepBit | kRepWord8 | kRepWord16 | | 61 const MachineTypeUnion kRepMask = kRepBit | kRepWord8 | kRepWord16 | |
63 kRepWord32 | kRepWord64 | kRepFloat32 | | 62 kRepWord32 | kRepWord64 | kRepFloat32 | |
64 kRepFloat64 | kRepTagged; | 63 kRepFloat64 | kRepTagged; |
65 const MachineTypeUnion kTypeMask = kTypeBool | kTypeInt32 | kTypeUint32 | | 64 const MachineTypeUnion kTypeMask = kTypeBool | kTypeInt32 | kTypeUint32 | |
66 kTypeInt64 | kTypeUint64 | kTypeNumber | | 65 kTypeInt64 | kTypeUint64 | kTypeNumber | |
67 kTypeAny; | 66 kTypeAny; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 size_t parameter_count_; | 163 size_t parameter_count_; |
165 T* reps_; | 164 T* reps_; |
166 }; | 165 }; |
167 | 166 |
168 typedef Signature<MachineType> MachineSignature; | 167 typedef Signature<MachineType> MachineSignature; |
169 } // namespace compiler | 168 } // namespace compiler |
170 } // namespace internal | 169 } // namespace internal |
171 } // namespace v8 | 170 } // namespace v8 |
172 | 171 |
173 #endif // V8_COMPILER_MACHINE_TYPE_H_ | 172 #endif // V8_COMPILER_MACHINE_TYPE_H_ |
OLD | NEW |