aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-04-23 22:00:09 +0000
committerChris Lattner <sabre@nondot.org>2005-04-23 22:00:09 +0000
commit4f0247c10dea3400aa396fbc8842bb3aaf9ac3dc (patch)
tree632fb2a5648a3e2e36d154f6c0514ba498514eac
parent4c5d305b1a77264780b170dd1b28bc66f7ed2733 (diff)
downloadexternal_llvm-4f0247c10dea3400aa396fbc8842bb3aaf9ac3dc.zip
external_llvm-4f0247c10dea3400aa396fbc8842bb3aaf9ac3dc.tar.gz
external_llvm-4f0247c10dea3400aa396fbc8842bb3aaf9ac3dc.tar.bz2
Add a method, remove last use of Type.def
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21483 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/Type.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 3e5757b..fb7479a 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -138,8 +138,34 @@ const Type *Type::getSignedVersion() const {
//
unsigned Type::getPrimitiveSize() const {
switch (getTypeID()) {
-#define HANDLE_PRIM_TYPE(TY,SIZE) case TY##TyID: return SIZE;
-#include "llvm/Type.def"
+ case Type::BoolTy:
+ case Type::SByteTy:
+ case Type::UByteTy: return 1;
+ case Type::UShortTy:
+ case Type::ShortTy: return 2;
+ case Type::FloatTy:
+ case Type::IntTy:
+ case Type::UIntTy: return 4;
+ case Type::LongTy:
+ case Type::ULongTy:
+ case Type::DoubleTy: return 8;
+ default: return 0;
+ }
+}
+
+unsigned Type::getPrimitiveSizeInBits() const {
+ switch (getTypeID()) {
+ case Type::BoolTy: return 1;
+ case Type::SByteTy:
+ case Type::UByteTy: return 8;
+ case Type::UShortTy:
+ case Type::ShortTy: return 16;
+ case Type::FloatTy:
+ case Type::IntTy:
+ case Type::UIntTy: return 32;
+ case Type::LongTy:
+ case Type::ULongTy:
+ case Type::DoubleTy: return 64;
default: return 0;
}
}