[llvm-commits] [llvm-gcc-4.2] r43621 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-types.cpp
Duncan Sands
baldrick at free.fr
Thu Nov 1 13:56:26 PDT 2007
Author: baldrick
Date: Thu Nov 1 15:56:26 2007
New Revision: 43621
URL: http://llvm.org/viewvc/llvm-project?rev=43621&view=rev
Log:
Change most uses of getTypeSize to getTypeStoreSize or
getABITypeSize, hopefully correctly.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=43621&r1=43620&r2=43621&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Nov 1 15:56:26 2007
@@ -2885,7 +2885,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.
@@ -5712,7 +5712,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
@@ -5834,7 +5834,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!");
Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=43621&r1=43620&r2=43621&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Thu Nov 1 15:56:26 2007
@@ -1173,7 +1173,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.
@@ -1859,7 +1859,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())
@@ -1892,7 +1892,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);
}
More information about the llvm-commits
mailing list