Change most uses of getTypeSize to getTypeStoreSize or
getABITypeSize, hopefully correctly.
llvm-svn: 43622
diff --git a/llvm-gcc-4.0/gcc/llvm-convert.cpp b/llvm-gcc-4.0/gcc/llvm-convert.cpp
index 808080a..6497717 100644
--- a/llvm-gcc-4.0/gcc/llvm-convert.cpp
+++ b/llvm-gcc-4.0/gcc/llvm-convert.cpp
@@ -3364,7 +3364,7 @@
// We can't get the type size (and thus convert to using a GEP instr) from
// pointers to opaque structs if the type isn't abstract.
if (ElTy->isSized()) {
- int64_t EltSize = TD.getTypeSize(ElTy);
+ int64_t EltSize = TD.getABITypeSize(ElTy);
// If EltSize exactly divides Offset, then we know that we can turn this
// into a getelementptr instruction.
@@ -6152,7 +6152,7 @@
static Constant *ConvertStructFieldInitializerToType(Constant *Val,
const Type *FieldTy) {
const TargetData &TD = getTargetData();
- assert(TD.getTypeSize(FieldTy) == TD.getTypeSize(Val->getType()) &&
+ assert(TD.getABITypeSize(FieldTy) == TD.getABITypeSize(Val->getType()) &&
"Mismatched initializer type isn't same size as initializer!");
// If this is an integer initializer for an array of ubytes, we are
@@ -6271,7 +6271,7 @@
tree UnionType = TREE_TYPE(exp);
if (TYPE_SIZE(UnionType) && TREE_CODE(TYPE_SIZE(UnionType)) == INTEGER_CST) {
unsigned UnionSize = ((unsigned)TREE_INT_CST_LOW(TYPE_SIZE(UnionType))+7)/8;
- unsigned InitSize = getTargetData().getTypeSize(Elts[0]->getType());
+ unsigned InitSize = getTargetData().getABITypeSize(Elts[0]->getType());
if (UnionSize != InitSize) {
const Type *FillTy;
assert(UnionSize > InitSize && "Init shouldn't be larger than union!");
diff --git a/llvm-gcc-4.0/gcc/llvm-types.cpp b/llvm-gcc-4.0/gcc/llvm-types.cpp
index eec82a4..0fb3b66 100644
--- a/llvm-gcc-4.0/gcc/llvm-types.cpp
+++ b/llvm-gcc-4.0/gcc/llvm-types.cpp
@@ -1149,7 +1149,7 @@
/// getTypeSize - Return the size of the specified type in bytes.
///
unsigned getTypeSize(const Type *Ty) const {
- return TD.getTypeSize(Ty);
+ return Packed ? TD.getTypeStoreSize(Ty) : TD.getABITypeSize(Ty);
}
/// getLLVMType - Return the LLVM type for the specified object.
@@ -1849,7 +1849,7 @@
const Type *TheTy = ConvertType(TREE_TYPE(Field));
bool isPacked = false;
- unsigned Size = TD.getTypeSize(TheTy);
+ unsigned Size = TD.getABITypeSize(TheTy);
unsigned Align = TD.getABITypeAlignment(TheTy);
if (const StructType *STy = dyn_cast<StructType>(TheTy))
if (STy->isPacked())
@@ -1882,7 +1882,7 @@
std::vector<const Type*> UnionElts;
unsigned UnionSize = 0;
if (UnionTy) { // Not an empty union.
- UnionSize = TD.getTypeSize(UnionTy);
+ UnionSize = TD.getABITypeSize(UnionTy);
UnionElts.push_back(UnionTy);
}