Add getABITypeSize, getABITypeSizeInBits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42488 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp
index 3028426..0bdb23b 100644
--- a/lib/Target/TargetData.cpp
+++ b/lib/Target/TargetData.cpp
@@ -471,7 +471,12 @@
return getTypeSize(Ty) * 8;
}
-
+uint64_t TargetData::getABITypeSizeInBits(const Type *Ty) const {
+ if (Ty->isInteger())
+ return cast<IntegerType>(Ty)->getBitWidth();
+ else
+ return getABITypeSize(Ty) * 8;
+}
/*!
\param abi_or_pref Flag that determines which alignment is returned. true
returns the ABI alignment, false returns the preferred alignment.