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
This commit is contained in:
Chris Lattner 2005-04-23 22:00:09 +00:00
parent 4c5d305b1a
commit 4f0247c10d

View File

@ -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;
}
}