[llvm-commits] CVS: llvm/lib/VMCore/Type.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Apr 23 15:00:22 PDT 2005
Changes in directory llvm/lib/VMCore:
Type.cpp updated: 1.124 -> 1.125
---
Log message:
Add a method, remove last use of Type.def
---
Diffs of the changes: (+28 -2)
Type.cpp | 30 ++++++++++++++++++++++++++++--
1 files changed, 28 insertions(+), 2 deletions(-)
Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.124 llvm/lib/VMCore/Type.cpp:1.125
--- llvm/lib/VMCore/Type.cpp:1.124 Thu Apr 21 18:46:51 2005
+++ llvm/lib/VMCore/Type.cpp Sat Apr 23 17:00:09 2005
@@ -138,8 +138,34 @@
//
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;
}
}
More information about the llvm-commits
mailing list