[llvm-commits] CVS: llvm/lib/Target/TargetData.cpp
Reid Spencer
reid at x10sys.com
Sat Jan 20 15:32:20 PST 2007
Changes in directory llvm/lib/Target:
TargetData.cpp updated: 1.79 -> 1.80
---
Log message:
Implement a getTypeSizeInBits method. This helps in transforms that want
to ensure the bit size of a type is identical before proceeding.
---
Diffs of the changes: (+10 -0)
TargetData.cpp | 10 ++++++++++
1 files changed, 10 insertions(+)
Index: llvm/lib/Target/TargetData.cpp
diff -u llvm/lib/Target/TargetData.cpp:1.79 llvm/lib/Target/TargetData.cpp:1.80
--- llvm/lib/Target/TargetData.cpp:1.79 Sat Jan 20 17:07:13 2007
+++ llvm/lib/Target/TargetData.cpp Sat Jan 20 17:32:04 2007
@@ -426,6 +426,16 @@
return Size;
}
+uint64_t TargetData::getTypeSizeInBits(const Type *Ty) const {
+ if (Ty->isInteger())
+ return cast<IntegerType>(Ty)->getBitWidth();
+
+ uint64_t Size;
+ unsigned char Align;
+ getTypeInfoABI(Ty, this, Size, Align);
+ return Size * 8;
+}
+
unsigned char TargetData::getTypeAlignmentABI(const Type *Ty) const {
uint64_t Size;
unsigned char Align;
More information about the llvm-commits
mailing list