aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-06 03:23:59 +0000
committerChris Lattner <sabre@nondot.org>2005-01-06 03:23:59 +0000
commit15afefbe9466ff638ec1a155224bc9ecd79b336b (patch)
tree6a819f91a7b2f406f3f29700db619b6383016082
parentb66144c1e1422719638751fe4372f4f1f31b9814 (diff)
Add a useful method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19301 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/CodeGen/ValueTypes.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h
index 77524ec0d2..e67a52a582 100644
--- a/include/llvm/CodeGen/ValueTypes.h
+++ b/include/llvm/CodeGen/ValueTypes.h
@@ -49,6 +49,22 @@ namespace MVT { // MVT = Machine Value Types
static inline bool isFloatingPoint(ValueType VT) {
return VT >= f32 && VT <= f128;
}
+
+ static inline unsigned getSizeInBits(ValueType VT) {
+ switch (VT) {
+ default: assert(0 && "ValueType has no known size!");
+ case MVT::i1 : return 1;
+ case MVT::i8 : return 8;
+ case MVT::i16 : return 16;
+ case MVT::f32 :
+ case MVT::i32 : return 32;
+ case MVT::f64 :
+ case MVT::i64 : return 64;
+ case MVT::f80 : return 80;
+ case MVT::f128:
+ case MVT::i128: return 128;
+ }
+ }
};
} // End llvm namespace