[llvm-commits] CVS: llvm/include/llvm/CodeGen/ValueTypes.h
Chris Lattner
lattner at cs.uiuc.edu
Wed Jan 5 19:24:13 PST 2005
Changes in directory llvm/include/llvm/CodeGen:
ValueTypes.h updated: 1.7 -> 1.8
---
Log message:
Add a useful method
---
Diffs of the changes: (+16 -0)
Index: llvm/include/llvm/CodeGen/ValueTypes.h
diff -u llvm/include/llvm/CodeGen/ValueTypes.h:1.7 llvm/include/llvm/CodeGen/ValueTypes.h:1.8
--- llvm/include/llvm/CodeGen/ValueTypes.h:1.7 Wed Jan 5 16:14:14 2005
+++ llvm/include/llvm/CodeGen/ValueTypes.h Wed Jan 5 21:23:59 2005
@@ -49,6 +49,22 @@
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
More information about the llvm-commits
mailing list