summaryrefslogtreecommitdiffstats
path: root/lib/Basic/TargetInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Basic/TargetInfo.cpp')
-rw-r--r--lib/Basic/TargetInfo.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp
index 9cd1249..8f3c777 100644
--- a/lib/Basic/TargetInfo.cpp
+++ b/lib/Basic/TargetInfo.cpp
@@ -43,6 +43,7 @@ TargetInfo::TargetInfo(const std::string &T) : Triple(T) {
UIntMaxType = UnsignedLongLong;
IntPtrType = SignedLong;
WCharType = SignedInt;
+ WIntType = SignedInt;
Char16Type = UnsignedShort;
Char32Type = UnsignedInt;
Int64Type = SignedLongLong;
@@ -73,6 +74,57 @@ const char *TargetInfo::getTypeName(IntType T) {
}
}
+/// getTypeConstantSuffix - Return the constant suffix for the specified
+/// integer type enum. For example, SignedLong -> "L".
+const char *TargetInfo::getTypeConstantSuffix(IntType T) {
+ switch (T) {
+ default: assert(0 && "not an integer!");
+ case SignedShort:
+ case SignedInt: return "";
+ case SignedLong: return "L";
+ case SignedLongLong: return "LL";
+ case UnsignedShort:
+ case UnsignedInt: return "U";
+ case UnsignedLong: return "UL";
+ case UnsignedLongLong: return "ULL";
+ }
+}
+
+/// getTypeWidth - Return the width (in bits) of the specified integer type
+/// enum. For example, SignedInt -> getIntWidth().
+unsigned TargetInfo::getTypeWidth(IntType T) const {
+ switch (T) {
+ default: assert(0 && "not an integer!");
+ case SignedShort: return getShortWidth();
+ case UnsignedShort: return getShortWidth();
+ case SignedInt: return getIntWidth();
+ case UnsignedInt: return getIntWidth();
+ case SignedLong: return getLongWidth();
+ case UnsignedLong: return getLongWidth();
+ case SignedLongLong: return getLongLongWidth();
+ case UnsignedLongLong: return getLongLongWidth();
+ };
+}
+
+/// getTypeSigned - Return whether an integer types is signed. Returns true if
+/// the type is signed; false otherwise.
+bool TargetInfo::getTypeSigned(IntType T) const {
+ switch (T) {
+ default: assert(0 && "not an integer!");
+ case SignedShort:
+ case SignedInt:
+ case SignedLong:
+ case SignedLongLong:
+ return true;
+ case UnsignedShort:
+ case UnsignedInt:
+ case UnsignedLong:
+ case UnsignedLongLong:
+ return false;
+ };
+}
+
+
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud