| 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. |
| 11 // | 11 // |
| 12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
| 13 | 13 |
| 14 #include "IceDefs.h" | 14 #include "IceDefs.h" |
| 15 #include "IceTypes.h" | 15 #include "IceTypes.h" |
| 16 | 16 |
| 17 namespace Ice { | 17 namespace Ice { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 const char *TargetArchName[] = { |
| 22 #define X(tag, str) str , |
| 23 TARGETARCH_TABLE |
| 24 #undef X |
| 25 }; |
| 26 |
| 21 // Show tags match between ICETYPE_TABLE and ICETYPE_PROPS_TABLE. | 27 // Show tags match between ICETYPE_TABLE and ICETYPE_PROPS_TABLE. |
| 22 | 28 |
| 23 // Define a temporary set of enum values based on ICETYPE_TABLE | 29 // Define a temporary set of enum values based on ICETYPE_TABLE |
| 24 enum { | 30 enum { |
| 25 #define X(tag, size, align, elts, elty, str) _table_tag_##tag, | 31 #define X(tag, size, align, elts, elty, str) _table_tag_##tag, |
| 26 ICETYPE_TABLE | 32 ICETYPE_TABLE |
| 27 #undef X | 33 #undef X |
| 28 _enum_table_tag_Names | 34 _enum_table_tag_Names |
| 29 }; | 35 }; |
| 30 // Define a temporary set of enum values based on ICETYPE_PROPS_TABLE | 36 // Define a temporary set of enum values based on ICETYPE_PROPS_TABLE |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 IsVec, IsInt, IsInt && !IsVec, IsInt && IsVec, IsIntArith, IsFloat, \ | 115 IsVec, IsInt, IsInt && !IsVec, IsInt && IsVec, IsIntArith, IsFloat, \ |
| 110 IsFloat && !IsVec, IsFloat && IsVec, IsLoadStore, CompareResult \ | 116 IsFloat && !IsVec, IsFloat && IsVec, IsLoadStore, CompareResult \ |
| 111 } \ | 117 } \ |
| 112 , | 118 , |
| 113 ICETYPE_PROPS_TABLE | 119 ICETYPE_PROPS_TABLE |
| 114 #undef X | 120 #undef X |
| 115 }; | 121 }; |
| 116 | 122 |
| 117 } // end anonymous namespace | 123 } // end anonymous namespace |
| 118 | 124 |
| 125 const char *targetArchString(const TargetArch Arch) { |
| 126 size_t Index = static_cast<size_t>(Arch); |
| 127 if (Index < TargetArch_NUM) |
| 128 return TargetArchName[Index]; |
| 129 llvm_unreachable("Invalid target arch for targetArchString"); |
| 130 return "???"; |
| 131 } |
| 132 |
| 119 size_t typeWidthInBytes(Type Ty) { | 133 size_t typeWidthInBytes(Type Ty) { |
| 120 size_t Index = static_cast<size_t>(Ty); | 134 size_t Index = static_cast<size_t>(Ty); |
| 121 if (Index < IceType_NUM) | 135 if (Index < IceType_NUM) |
| 122 return TypeAttributes[Index].TypeWidthInBytes; | 136 return TypeAttributes[Index].TypeWidthInBytes; |
| 123 llvm_unreachable("Invalid type for typeWidthInBytes()"); | 137 llvm_unreachable("Invalid type for typeWidthInBytes()"); |
| 124 return 0; | 138 return 0; |
| 125 } | 139 } |
| 126 | 140 |
| 127 size_t typeAlignInBytes(Type Ty) { | 141 size_t typeAlignInBytes(Type Ty) { |
| 128 size_t Index = static_cast<size_t>(Ty); | 142 size_t Index = static_cast<size_t>(Ty); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 IsFirst = false; | 267 IsFirst = false; |
| 254 } else { | 268 } else { |
| 255 Stream << ", "; | 269 Stream << ", "; |
| 256 } | 270 } |
| 257 Stream << ArgTy; | 271 Stream << ArgTy; |
| 258 } | 272 } |
| 259 Stream << ")"; | 273 Stream << ")"; |
| 260 } | 274 } |
| 261 | 275 |
| 262 } // end of namespace Ice | 276 } // end of namespace Ice |
| OLD | NEW |