[llvm-commits] [llvm-gcc-4.2] r62100 - in /llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386.cpp llvm-abi.h llvm-convert.cpp llvm-types.cpp
Duncan Sands
baldrick at free.fr
Mon Jan 12 12:48:31 PST 2009
Author: baldrick
Date: Mon Jan 12 14:48:30 2009
New Revision: 62100
URL: http://llvm.org/viewvc/llvm-project?rev=62100&view=rev
Log:
Rename getABITypeSize to getTypePaddedSize.
Modified:
llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
llvm-gcc-4.2/trunk/gcc/llvm-abi.h
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/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=62100&r1=62099&r2=62100&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Mon Jan 12 14:48:30 2009
@@ -1019,7 +1019,7 @@
const Type *llvm_x86_scalar_type_for_struct_return(tree type, unsigned *Offset) {
*Offset = 0;
const Type *Ty = ConvertType(type);
- unsigned Size = getTargetData().getABITypeSize(Ty);
+ unsigned Size = getTargetData().getTypePaddedSize(Ty);
if (Size == 0)
return Type::VoidTy;
else if (Size == 1)
Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=62100&r1=62099&r2=62100&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Mon Jan 12 14:48:30 2009
@@ -205,7 +205,7 @@
// target independent implementation.
static const Type* getLLVMScalarTypeForStructReturn(tree type, unsigned *Offset) {
const Type *Ty = ConvertType(type);
- unsigned Size = getTargetData().getABITypeSize(Ty);
+ unsigned Size = getTargetData().getTypePaddedSize(Ty);
*Offset = 0;
if (Size == 0)
return Type::VoidTy;
@@ -653,20 +653,20 @@
const StructType *STy = StructType::get(Elts, false);
- unsigned Size = getTargetData().getABITypeSize(STy);
+ unsigned Size = getTargetData().getTypePaddedSize(STy);
const StructType *InSTy = dyn_cast<StructType>(Ty);
unsigned InSize = 0;
// If Ty and STy size does not match then last element is accessing
// extra bits.
unsigned LastEltSizeDiff = 0;
if (InSTy) {
- InSize = getTargetData().getABITypeSize(InSTy);
+ InSize = getTargetData().getTypePaddedSize(InSTy);
if (InSize < Size) {
unsigned N = STy->getNumElements();
const llvm::Type *LastEltTy = STy->getElementType(N-1);
if (LastEltTy->isInteger())
LastEltSizeDiff =
- getTargetData().getABITypeSize(LastEltTy) - (Size - InSize);
+ getTargetData().getTypePaddedSize(LastEltTy) - (Size - InSize);
}
}
for (unsigned i = 0, e = Elts.size(); i != e; ++i) {
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=62100&r1=62099&r2=62100&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Jan 12 14:48:30 2009
@@ -1349,7 +1349,7 @@
}
} else {
const ArrayType *ATy = cast<ArrayType>(ElTy);
- unsigned EltSize = getTargetData().getABITypeSize(ATy->getElementType());
+ unsigned EltSize = getTargetData().getTypePaddedSize(ATy->getElementType());
for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) {
Value *DElPtr = Builder.CreateStructGEP(DestLoc.Ptr, i);
Value *SElPtr = Builder.CreateStructGEP(SrcLoc.Ptr, i);
@@ -1460,7 +1460,7 @@
}
} else {
const ArrayType *ATy = cast<ArrayType>(ElTy);
- unsigned EltSize = getTargetData().getABITypeSize(ATy->getElementType());
+ unsigned EltSize = getTargetData().getTypePaddedSize(ATy->getElementType());
for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) {
Value *Ptr = Builder.CreateStructGEP(DestLoc.Ptr, i);
unsigned Alignment = MinAlign(DestLoc.Alignment, i * EltSize);
@@ -3456,7 +3456,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.getABITypeSize(ElTy);
+ int64_t EltSize = TD.getTypePaddedSize(ElTy);
// If EltSize exactly divides Offset, then we know that we can turn this
// into a getelementptr instruction.
@@ -5750,7 +5750,7 @@
Value *ImagPtr = Builder.CreateStructGEP(SrcComplex.Ptr, 1, "imag");
Imag = Builder.CreateLoad(ImagPtr, SrcComplex.Volatile, "imag");
cast<LoadInst>(Imag)->setAlignment(
- MinAlign(SrcComplex.Alignment, TD.getABITypeSize(Real->getType()))
+ MinAlign(SrcComplex.Alignment, TD.getTypePaddedSize(Real->getType()))
);
}
@@ -5765,7 +5765,7 @@
Value *ImagPtr = Builder.CreateStructGEP(DestComplex.Ptr, 1, "imag");
St = Builder.CreateStore(Imag, ImagPtr, DestComplex.Volatile);
St->setAlignment(
- MinAlign(DestComplex.Alignment, TD.getABITypeSize(Real->getType()))
+ MinAlign(DestComplex.Alignment, TD.getTypePaddedSize(Real->getType()))
);
}
@@ -5997,7 +5997,7 @@
Value *Ptr = Builder.CreateGEP(ArrayAddr, Idxs, Idxs + 2);
const Type *ATy = cast<PointerType>(ArrayAddr->getType())->getElementType();
const Type *ElementTy = cast<ArrayType>(ATy)->getElementType();
- unsigned Alignment = MinAlign(ArrayAlign, TD.getABITypeSize(ElementTy));
+ unsigned Alignment = MinAlign(ArrayAlign, TD.getTypePaddedSize(ElementTy));
return LValue(BitCastToType(Ptr,
PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))),
Alignment);
@@ -6218,7 +6218,7 @@
if (LLVMFieldTy->isInteger() &&
LLVMFieldTy->getPrimitiveSizeInBits() >= BitStart + BitfieldSize &&
LLVMFieldTy->getPrimitiveSizeInBits() ==
- TD.getABITypeSizeInBits(LLVMFieldTy))
+ TD.getTypePaddedSizeInBits(LLVMFieldTy))
FieldTy = LLVMFieldTy;
else
// If the field result type T is a bool or some other curiously sized
@@ -6228,10 +6228,10 @@
// sized like an i24 there may be trouble: incrementing a T* will move
// the position by 32 bits not 24, leaving the upper 8 of those 32 bits
// inaccessible. Avoid this by rounding up the size appropriately.
- FieldTy = IntegerType::get(TD.getABITypeSizeInBits(FieldTy));
+ FieldTy = IntegerType::get(TD.getTypePaddedSizeInBits(FieldTy));
assert(FieldTy->getPrimitiveSizeInBits() ==
- TD.getABITypeSizeInBits(FieldTy) && "Field type not sequential!");
+ TD.getTypePaddedSizeInBits(FieldTy) && "Field type not sequential!");
// If this is a bitfield, the field may span multiple fields in the LLVM
// type. As such, cast the pointer to be a pointer to the declared type.
@@ -6308,7 +6308,7 @@
assert(BitSize <= ValueSizeInBits &&
"ValTy isn't large enough to hold the value loaded!");
- assert(ValueSizeInBits == TD.getABITypeSizeInBits(ValTy) &&
+ assert(ValueSizeInBits == TD.getTypePaddedSizeInBits(ValTy) &&
"FIXME: BIT_FIELD_REF logic is broken for non-round types");
// BIT_FIELD_REF values can have BitStart values that are quite large. We
@@ -6344,7 +6344,8 @@
Alignment = Ptr.Alignment;
else
// IMAGPART alignment = MinAlign(Ptr.Alignment, sizeof field);
- Alignment = MinAlign(Ptr.Alignment, TD.getABITypeSize(Ptr.Ptr->getType()));
+ Alignment = MinAlign(Ptr.Alignment,
+ TD.getTypePaddedSize(Ptr.Ptr->getType()));
return LValue(Builder.CreateStructGEP(Ptr.Ptr, Idx), Alignment);
}
@@ -7032,7 +7033,7 @@
static Constant *ConvertStructFieldInitializerToType(Constant *Val,
const Type *FieldTy) {
const TargetData &TD = getTargetData();
- assert(TD.getABITypeSize(FieldTy) == TD.getABITypeSize(Val->getType()) &&
+ assert(TD.getTypePaddedSize(FieldTy) == TD.getTypePaddedSize(Val->getType()) &&
"Mismatched initializer type isn't same size as initializer!");
// If this is an integer initializer for an array of ubytes, we are
@@ -7140,11 +7141,11 @@
Constant *retval = ConstantStruct::get(ResultElts, STy->isPacked());
const Type *NewSTy = retval->getType();
- unsigned oldLLVMSize = getTargetData().getABITypeSize(STy);
+ unsigned oldLLVMSize = getTargetData().getTypePaddedSize(STy);
unsigned oldLLVMAlign = getTargetData().getABITypeAlignment(STy);
oldLLVMSize = ((oldLLVMSize+oldLLVMAlign-1)/oldLLVMAlign)*oldLLVMAlign;
- unsigned newLLVMSize = getTargetData().getABITypeSize(NewSTy);
+ unsigned newLLVMSize = getTargetData().getTypePaddedSize(NewSTy);
unsigned newLLVMAlign = getTargetData().getABITypeAlignment(NewSTy);
newLLVMSize = ((newLLVMSize+newLLVMAlign-1)/newLLVMAlign)*newLLVMAlign;
@@ -7181,7 +7182,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().getABITypeSize(Elts[0]->getType());
+ unsigned InitSize = getTargetData().getTypePaddedSize(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=62100&r1=62099&r2=62100&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Jan 12 14:48:30 2009
@@ -72,11 +72,11 @@
static const Type * llvm_set_type(tree Tr, const Type *Ty) {
// For x86 long double, llvm records the size of the data (80) while
- // gcc's TYPE_SIZE including alignment padding. getABITypeSizeInBits
+ // gcc's TYPE_SIZE including alignment padding. getTypePaddedSizeInBits
// is used to compensate for this.
assert((!TYPE_SIZE(Tr) || !Ty->isSized() || !isInt64(TYPE_SIZE(Tr), true) ||
getInt64(TYPE_SIZE(Tr), true) ==
- getTargetData().getABITypeSizeInBits(Ty))
+ getTargetData().getTypePaddedSizeInBits(Ty))
&& "LLVM type size doesn't match GCC type size!");
unsigned &TypeSlot = LTypesMap[Ty];
@@ -1346,7 +1346,7 @@
/// getTypeSize - Return the size of the specified type in bytes.
///
uint64_t getTypeSize(const Type *Ty) const {
- return TD.getABITypeSize(Ty);
+ return TD.getTypePaddedSize(Ty);
}
/// getLLVMType - Return the LLVM type for the specified object.
@@ -2272,7 +2272,7 @@
}
#endif
const Type *TheTy = ConvertType(TheGccTy);
- unsigned Size = TD.getABITypeSize(TheTy);
+ unsigned Size = TD.getTypePaddedSize(TheTy);
unsigned Align = TD.getABITypeAlignment(TheTy);
adjustPaddingElement(GccUnionTy, TheGccTy);
@@ -2309,7 +2309,7 @@
unsigned EltSize = 0;
if (UnionTy) { // Not an empty union.
EltAlign = TD.getABITypeAlignment(UnionTy);
- EltSize = TD.getABITypeSize(UnionTy);
+ EltSize = TD.getTypePaddedSize(UnionTy);
UnionElts.push_back(UnionTy);
}
More information about the llvm-commits
mailing list