Chromium Code Reviews| 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 /// \file | 10 /// \file |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 return TargetArchName[Index]; | 138 return TargetArchName[Index]; |
| 139 llvm_unreachable("Invalid target arch for targetArchString"); | 139 llvm_unreachable("Invalid target arch for targetArchString"); |
| 140 return "???"; | 140 return "???"; |
| 141 } | 141 } |
| 142 | 142 |
| 143 size_t typeWidthInBytes(Type Ty) { | 143 size_t typeWidthInBytes(Type Ty) { |
| 144 int8_t Shift = typeWidthInBytesLog2(Ty); | 144 int8_t Shift = typeWidthInBytesLog2(Ty); |
| 145 return (Shift < 0) ? 0 : 1 << Shift; | 145 return (Shift < 0) ? 0 : 1 << Shift; |
| 146 } | 146 } |
| 147 | 147 |
| 148 size_t typeWidthInBits(Type Ty) { return typeWidthInBytes(Ty) * 8; } | |
|
Jim Stichnoth
2016/02/03 15:28:38
Probably CHAR_BIT would be more appropriate than 8
Eric Holk
2016/02/03 21:02:22
Agreed. I removed this function and inlined it whe
| |
| 149 | |
| 148 int8_t typeWidthInBytesLog2(Type Ty) { | 150 int8_t typeWidthInBytesLog2(Type Ty) { |
| 149 size_t Index = static_cast<size_t>(Ty); | 151 size_t Index = static_cast<size_t>(Ty); |
| 150 if (Index < IceType_NUM) | 152 if (Index < IceType_NUM) |
| 151 return TypeAttributes[Index].TypeWidthInBytesLog2; | 153 return TypeAttributes[Index].TypeWidthInBytesLog2; |
| 152 llvm_unreachable("Invalid type for typeWidthInBytesLog2()"); | 154 llvm_unreachable("Invalid type for typeWidthInBytesLog2()"); |
| 153 return 0; | 155 return 0; |
| 154 } | 156 } |
| 155 | 157 |
| 156 size_t typeAlignInBytes(Type Ty) { | 158 size_t typeAlignInBytes(Type Ty) { |
| 157 size_t Index = static_cast<size_t>(Ty); | 159 size_t Index = static_cast<size_t>(Ty); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 IsFirst = false; | 301 IsFirst = false; |
| 300 } else { | 302 } else { |
| 301 Stream << ", "; | 303 Stream << ", "; |
| 302 } | 304 } |
| 303 Stream << ArgTy; | 305 Stream << ArgTy; |
| 304 } | 306 } |
| 305 Stream << ")"; | 307 Stream << ")"; |
| 306 } | 308 } |
| 307 | 309 |
| 308 } // end of namespace Ice | 310 } // end of namespace Ice |
| OLD | NEW |