OLD | NEW |
1 //===- subzero/src/IceTypes.cpp - Primitive type properties ---------------===// | 1 //===- subzero/src/IceTypes.cpp - Primitive type properties ---------------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file defines a few attributes of Subzero primitive types. | 10 // This file defines a few attributes of Subzero primitive types. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 Type ElementType = IceType_void; | 74 Type ElementType = IceType_void; |
75 size_t Index = static_cast<size_t>(Ty); | 75 size_t Index = static_cast<size_t>(Ty); |
76 if (Index < TypeAttributesSize) { | 76 if (Index < TypeAttributesSize) { |
77 ElementType = TypeAttributes[Index].TypeElementType; | 77 ElementType = TypeAttributes[Index].TypeElementType; |
78 } else { | 78 } else { |
79 llvm_unreachable("Invalid type for typeElementType()"); | 79 llvm_unreachable("Invalid type for typeElementType()"); |
80 } | 80 } |
81 return ElementType; | 81 return ElementType; |
82 } | 82 } |
83 | 83 |
84 // ======================== Dump routines ======================== // | 84 const char *typeString(Type Ty) { |
85 | |
86 template <> Ostream &operator<<(Ostream &Str, const Type &Ty) { | |
87 size_t Index = static_cast<size_t>(Ty); | 85 size_t Index = static_cast<size_t>(Ty); |
88 if (Index < TypeAttributesSize) { | 86 if (Index < TypeAttributesSize) { |
89 Str << TypeAttributes[Index].DisplayString; | 87 return TypeAttributes[Index].DisplayString; |
90 } else { | |
91 Str << "???"; | |
92 llvm_unreachable("Invalid type for printing"); | |
93 } | 88 } |
94 | 89 llvm_unreachable("Invalid type for typeString"); |
95 return Str; | 90 return "???"; |
96 } | 91 } |
97 | 92 |
98 } // end of namespace Ice | 93 } // end of namespace Ice |
OLD | NEW |