diff options
Diffstat (limited to 'lib/Basic/TargetInfo.cpp')
-rw-r--r-- | lib/Basic/TargetInfo.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp index e965b9aec3..9ebacb240e 100644 --- a/lib/Basic/TargetInfo.cpp +++ b/lib/Basic/TargetInfo.cpp @@ -96,17 +96,33 @@ const char *TargetInfo::getTypeConstantSuffix(IntType T) { unsigned TargetInfo::getTypeWidth(IntType T) const { switch (T) { default: assert(0 && "not an integer!"); - case SignedShort: return getShortWidth(); + case SignedShort: case UnsignedShort: return getShortWidth(); - case SignedInt: return getIntWidth(); + case SignedInt: case UnsignedInt: return getIntWidth(); - case SignedLong: return getLongWidth(); + case SignedLong: case UnsignedLong: return getLongWidth(); - case SignedLongLong: return getLongLongWidth(); + case SignedLongLong: case UnsignedLongLong: return getLongLongWidth(); }; } +/// getTypeAlign - Return the alignment (in bits) of the specified integer type +/// enum. For example, SignedInt -> getIntAlign(). +unsigned TargetInfo::getTypeAlign(IntType T) const { + switch (T) { + default: assert(0 && "not an integer!"); + case SignedShort: + case UnsignedShort: return getShortAlign(); + case SignedInt: + case UnsignedInt: return getIntAlign(); + case SignedLong: + case UnsignedLong: return getLongAlign(); + case SignedLongLong: + case UnsignedLongLong: return getLongLongAlign(); + }; +} + /// isTypeSigned - Return whether an integer types is signed. Returns true if /// the type is signed; false otherwise. bool TargetInfo::isTypeSigned(IntType T) const { |