aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/TargetInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-05 21:21:32 +0000
committerChris Lattner <sabre@nondot.org>2009-11-05 21:21:32 +0000
commit9099e7bcda3922cee0cffcdf21332ac4aa193cea (patch)
tree0538b1525f620a43e901b260355cd84b3f1af6d7 /lib/Basic/TargetInfo.cpp
parent632d772a78db7e2cd9b36f8a22aee49d44486fbf (diff)
clean up integer preprocessor type definitions, patch by Ken Dyck!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86177 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/TargetInfo.cpp')
-rw-r--r--lib/Basic/TargetInfo.cpp24
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 {