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 #include "src/machine-type.h" | 5 #include "src/machine-type.h" |
6 #include "src/ostreams.h" | 6 #include "src/ostreams.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
11 std::ostream& operator<<(std::ostream& os, MachineRepresentation rep) { | 11 std::ostream& operator<<(std::ostream& os, MachineRepresentation rep) { |
| 12 return os << MachineReprToString(rep); |
| 13 } |
| 14 |
| 15 const char* MachineReprToString(MachineRepresentation rep) { |
12 switch (rep) { | 16 switch (rep) { |
13 case MachineRepresentation::kNone: | 17 case MachineRepresentation::kNone: |
14 return os << "kMachNone"; | 18 return "kMachNone"; |
15 case MachineRepresentation::kBit: | 19 case MachineRepresentation::kBit: |
16 return os << "kRepBit"; | 20 return "kRepBit"; |
17 case MachineRepresentation::kWord8: | 21 case MachineRepresentation::kWord8: |
18 return os << "kRepWord8"; | 22 return "kRepWord8"; |
19 case MachineRepresentation::kWord16: | 23 case MachineRepresentation::kWord16: |
20 return os << "kRepWord16"; | 24 return "kRepWord16"; |
21 case MachineRepresentation::kWord32: | 25 case MachineRepresentation::kWord32: |
22 return os << "kRepWord32"; | 26 return "kRepWord32"; |
23 case MachineRepresentation::kWord64: | 27 case MachineRepresentation::kWord64: |
24 return os << "kRepWord64"; | 28 return "kRepWord64"; |
25 case MachineRepresentation::kFloat32: | 29 case MachineRepresentation::kFloat32: |
26 return os << "kRepFloat32"; | 30 return "kRepFloat32"; |
27 case MachineRepresentation::kFloat64: | 31 case MachineRepresentation::kFloat64: |
28 return os << "kRepFloat64"; | 32 return "kRepFloat64"; |
29 case MachineRepresentation::kSimd128: | 33 case MachineRepresentation::kSimd128: |
30 return os << "kRepSimd128"; | 34 return "kRepSimd128"; |
31 case MachineRepresentation::kTagged: | 35 case MachineRepresentation::kTagged: |
32 return os << "kRepTagged"; | 36 return "kRepTagged"; |
33 } | 37 } |
34 UNREACHABLE(); | 38 UNREACHABLE(); |
35 return os; | 39 return nullptr; |
36 } | 40 } |
37 | 41 |
38 | |
39 std::ostream& operator<<(std::ostream& os, MachineSemantic type) { | 42 std::ostream& operator<<(std::ostream& os, MachineSemantic type) { |
40 switch (type) { | 43 switch (type) { |
41 case MachineSemantic::kNone: | 44 case MachineSemantic::kNone: |
42 return os << "kMachNone"; | 45 return os << "kMachNone"; |
43 case MachineSemantic::kBool: | 46 case MachineSemantic::kBool: |
44 return os << "kTypeBool"; | 47 return os << "kTypeBool"; |
45 case MachineSemantic::kInt32: | 48 case MachineSemantic::kInt32: |
46 return os << "kTypeInt32"; | 49 return os << "kTypeInt32"; |
47 case MachineSemantic::kUint32: | 50 case MachineSemantic::kUint32: |
48 return os << "kTypeUint32"; | 51 return os << "kTypeUint32"; |
(...skipping 19 matching lines...) Expand all Loading... |
68 } else if (type.semantic() == MachineSemantic::kNone) { | 71 } else if (type.semantic() == MachineSemantic::kNone) { |
69 return os << type.representation(); | 72 return os << type.representation(); |
70 } else { | 73 } else { |
71 return os << type.representation() << "|" << type.semantic(); | 74 return os << type.representation() << "|" << type.semantic(); |
72 } | 75 } |
73 return os; | 76 return os; |
74 } | 77 } |
75 | 78 |
76 } // namespace internal | 79 } // namespace internal |
77 } // namespace v8 | 80 } // namespace v8 |
OLD | NEW |